ArvoAgentHub

Pertinência de Anestesia em Procedimentos Endoscópicos

Overview

Deny endoscopy anesthesia when its type does not match procedures on the same date. Evaluates anesthesia TUSS codes 31602231 (diagnostic) and 31602240 (interventional) against endoscopy procedure families on the same id_fatura and calendar day. Anatomopathology/cytopathology billing on that date is treated as evidence of interventional activity when only diagnostic endoscopy codes are present.

Architecture

Field Value
Name Pertinência de Anestesia em Procedimentos Endoscópicos
Agent ID AI020
Version 0.0.0
Nature tech
Layer

Inheritance

EndoscopyAnesthesiaPertinenceRule → BaseAgent → BaseAgent

Core Functionality

  1. load_artifacts
  2. prepare_data
  3. rule_assessment

Business Rules

Pertinência da cobrança

Constantes:

  • MOTIVO_GLOSA_ARVO_TEMPLATE = (
  • SCORE_ARVO = 0.5

Usage

from agents.endoscopyanesthesiapertinencerule import EndoscopyAnesthesiaPertinenceRule

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

Configuration

Sem parâmetros configuráveis identificados.

Input Requirements

Column Type Description
EVENT_COLUMNS.id - -
EVENT_COLUMNS.id_fatura - -
EVENT_COLUMNS.id_evento - -
EVENT_COLUMNS.evento - -
EVENT_COLUMNS.vl_pago - -
EVENT_COLUMNS.qt_paga - -
EVENT_COLUMNS.dt_atendimento - -

Output Format

Glosa DataFrame Columns

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