ArvoAgentHub

Reexecução SADT

Overview

Implements the rule for detecting improper reexecution of SADT (Auxiliary Diagnostic and Therapy Services) procedures. This class is responsible for applying business logic to identify cases where SADT procedures are performed or charged again within a minimum interval, according to artifact-based limits. It processes event data, applies tolerance adjustments, loads relevant artifacts, and evaluates both current and historical data to determine if a charge should be denied (glosa) due to reexecution within a restricted period. The relevant informations in the artifact ARTIFACTS.sadt_limits_amb are: - reexecucao: time interval (in days) whether the reexecution is allowed for each SADT code (e.g.: 180 days) - ambulatorial: limit of reexecution of procedures in ambulatory regime (e.g.: 2 times) For instance, consider the following scenario: a procedure is performed on 01/01/2024 and the reexecution is allowed after 30 days (reexecucao = 30). Furthermore, the limit of reexecution of this procedure in ambulatory regime is 2 times (ambulatorial = 2). Therefore, the procedure can be reexecuted 2 times within a period of 30 days. If a 3rd reexecution is performed within 30 days, the charge should be denied. The code performs partial denial, covering cases where the procedure is charged in different lines (different id_arvo) with different qt_paga in each of them. For instance, if a procedure is charged in 2 lines with qt_paga = 2 in line A and qt_paga = 3 in line B, and one charge should be denied, it will be denied 1 charge in line A while the other charge in line A and the charges in line B should be payed. This rule is identified by the agent_id = 'C016' in agent table.

Architecture

Field Value
Name Reexecução SADT
Agent ID C016
Version 9
Nature tech
Layer

Inheritance

SADTReexecutionRule → BaseRule → BaseAgent

Core Functionality

  1. artifacts_tolerance
  2. load_artifacts
  3. prepare_data
  4. rule_assessment

Business Rules

Comportamento indevido

Consultar código-fonte para regras de negócio detalhadas.

Usage

from agents.sadtreexecutionrule import SADTReexecutionRule

rule = SADTReexecutionRule()
violations_df = rule.rule_assessment(claims_df)

Configuration

Sem parâmetros configuráveis identificados.

Input Requirements

Column Type Description
EVENT_COLUMNS.id - -
EVENT_COLUMNS.evento - -
EVENT_COLUMNS.id_evento - -
ARVO_COLUMNS.code_type - -
ARVO_COLUMNS.id_evento_predicted - -
ARVO_COLUMNS.code_type_predicted - -
EVENT_COLUMNS.id_fatura - -
EVENT_COLUMNS.vl_pago - -
EVENT_COLUMNS.categoria - -
EVENT_COLUMNS.subcategoria - -
EVENT_COLUMNS.regime_atendimento - -
EVENT_COLUMNS.dt_atendimento - -
EVENT_COLUMNS.guia - -
EVENT_COLUMNS.pacote - -
BENEFICIARY_COLUMNS.id_matricula - -
EVENT_COLUMNS.qt_paga - -
EVENT_COLUMNS.vl_unitario_pago - -
PROVIDER_COLUMNS.id_prestador - -
ARVO_COLUMNS.partner_id - -

Output Format

Glosa DataFrame Columns

Column Description
agent_id C016
version 9
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.