ArvoAgentHub

Guias idênticas

Overview

Identical Guides rule: flags guides already processed in history for glosa (1305). The agent glosas items when the same guide (same guia and pacote) was already processed in the history artifact (e.g. a previous run). It uses a guide "signature" (dates, provider, totals, quantities, subcategories) to compare current input with history and only applies glosa when the same (guia, pacote) appears in history with a different analyzed_at (avoids confusion with DuplicateClaims, which is same signature across different guides). Main flow: - prepare_data: cleans and summarizes the current input; prepares/loads history. - _identical_in_hist: joins summarized input with history by signature, filters by same (guia, pacote) and different analyzed_at, and produces glosas. - rule_assessment: calls _identical_in_hist and returns glosa rows (deduped by id).

Architecture

Field Value
Name Guias idênticas
Agent ID AC001
Version 0.0.0
Nature audit
Layer

Inheritance

IdenticalGuides → 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.identicalguides import IdenticalGuides

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

Configuration

Sem parâmetros configuráveis identificados.

Input Requirements

Consultar expected_input_columns no código-fonte.

Output Format

Glosa DataFrame Columns

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