Quantidade excessiva de luvas
Overview
Agent for detecting excessive glove usage based on hospitalization time limits. This agent implements custom logic to calculate glove quantity limits based on tempo_internacao and tempo_internacao_uti, identifying violations where qt_paga exceeds the calculated limits.
Architecture
| Field |
Value |
| Name |
Quantidade excessiva de luvas |
| Agent ID |
C063 |
| Version |
0.0.0 |
| Nature |
audit |
| Layer |
— |
Inheritance
ExcessiveProcedureGlovesAmountRule → BaseAgent → BaseAgent
Core Functionality
- aplica_glosa_parcial
- load_artifacts
- prepare_data
- rule_assessment
- get_max_surgical_gloves
- get_max_non_surgical_gloves
Business Rules
Pertinência da cobrança
Consultar código-fonte para regras de negócio detalhadas.
Usage
from agents.excessiveprocedureglovesamountrule import ExcessiveProcedureGlovesAmountRule
rule = ExcessiveProcedureGlovesAmountRule()
violations_df = rule.rule_assessment(claims_df)
Configuration
rule = ExcessiveProcedureGlovesAmountRule(
estrategia="mais_baratas") -> None:,
estrategia=estrategia,
qtd_cumulativa=luvas_ordenadas["qt_paga"].cumsum(),
glosa_cumulativa=np.minimum(excedente,
qtd_glosa=glosa_cumulativa.diff().fillna(glosa_cumulativa.iloc[0]) # The diff is used to get the glosa quantity for each row,
min_qty_per_day=6,
dias_cirurgia=fatura[fatura["is_surgery"] == 1]["dt_atendimento"].unique(),
glosado_por_dia_cirurgico={dia: 0 for dia in dias_cirurgia},
)
| Column |
Type |
Description |
EVENT_COLUMNS.id |
- |
- |
EVENT_COLUMNS.id_fatura |
- |
- |
EVENT_COLUMNS.id_evento |
- |
- |
EVENT_COLUMNS.vl_pago |
- |
- |
EVENT_COLUMNS.qt_paga |
- |
- |
EVENT_COLUMNS.categoria |
- |
- |
EVENT_COLUMNS.regime_atendimento |
- |
- |
EVENT_COLUMNS.dt_atendimento |
- |
- |
Glosa DataFrame Columns
| Column |
Description |
agent_id |
C063 |
version |
0.0.0 |
id_arvo |
Original record ID |
vl_glosa_arvo |
Glosa value |
qt_glosa_arvo |
Glosa quantity |
score_arvo |
Confidence score |
motivo_glosa_arvo |
Detailed reason in Portuguese |
motivo_glosa_ANS |
ANS standard code |
data_dict |
JSON metadata with calculation details |
Error Handling
- DataFrames vazios retornam estrutura vazia com colunas obrigatórias.
- Colunas ausentes geram warning mas não causam crash.
- Conversões numéricas usam
errors="coerce" para evitar falhas.