ArvoAgentHub

Cobrança de materiais e medicamentos - Intercâmbio

Overview

Implements the price comparison rule for UNIMED Interchange charges of Materials and Medications. Agent: I004 This agent evaluates interchange events (regra_intercambio = NACIONAL) by comparing the unit amount paid against the reference amount from the price artifact (ceiling), while enforcing allowed units of measure and validity periods. Items priced above the ceiling, within configured thresholds, are flagged for denial (glosa) with explanatory messages and metadata. Optionally, it returns a tracking DataFrame (evaluated) with per-item status. Artifact: - Price table keyed by [categoria, code_type_predicted, id_evento_predicted] with validity columns [dt_inicio_vigencia, dt_fim_vigencia], plus 'vl_intercambio_teto', 'unidade_minima', and 'var_percentil_75'.

Architecture

Field Value
Name Cobrança de materiais e medicamentos - Intercâmbio
Agent ID I004
Version 0.0.0
Nature adm
Layer

Inheritance

InterchangeMatMedPriceRule → BaseRule → BaseAgent

Core Functionality

  1. load_artifacts
  2. prepare_data
  3. rule_assessment

Business Rules

Conformidade da cobrança

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

Usage

from agents.interchangematmedpricerule import InterchangeMatMedPriceRule

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

Configuration

Sem parâmetros configuráveis identificados.

Input Requirements

Column Type Description
EVENT_COLUMNS.id - -
self.id_evento_predicted - -
EVENT_COLUMNS.id_evento - -
EVENT_COLUMNS.evento - -
EVENT_COLUMNS.categoria - -
ARVO_COLUMNS.code_type_predicted - -
EVENT_COLUMNS.vl_pago - -
EVENT_COLUMNS.qt_paga - -
EVENT_COLUMNS.vl_unitario_pago - -
EVENT_COLUMNS.dt_atendimento - -
EVENT_COLUMNS.tipo_intercambio - -

Output Format

Glosa DataFrame Columns

Column Description
agent_id I004
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.