ArvoAgentHub

Pertinencia de procedimento por sexo

Overview

Rule engine responsible for validating procedure pertinence based on the beneficiary's sex. This rule loads a sex-based pertinence artifact and filters events that are incompatible with expected sex restrictions. The rule: - Loads a TUSS-to-sex pertinence artifact. - Validates input metadata and required columns. - Removes events with missing or invalid sex information. - Filters events whose (code_tuss, sex) pair is not allowed. - Tracks evaluated items and emits flags for inconsistent data. - Outputs glosa (denial/adjustment) items when pertinence fails. - Carryover (Arraste): If enabled, identifies and denies associated items (materials, medications, and fees) in invoices where the main procedure was denied due to sex pertinence, ensuring financial consistency for the entire bill.

Architecture

Field Value
Name Pertinencia de procedimento por sexo
Agent ID C066
Version 0.0.1
Nature tech
Layer

Inheritance

PertinentProcSexRule → PertinenceRule → BaseAgent

Core Functionality

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

Business Rules

Pertinência da cobrança

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

Usage

from agents.pertinentprocsexrule import PertinentProcSexRule

rule = PertinentProcSexRule()
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_evento - -
ARVO_COLUMNS.id_evento_predicted - -
EVENT_COLUMNS.id_fatura - -
EVENT_COLUMNS.evento - -
EVENT_COLUMNS.vl_pago - -
EVENT_COLUMNS.qt_paga - -
EVENT_COLUMNS.regime_atendimento - -
EVENT_COLUMNS.categoria - -
BENEFICIARY_COLUMNS.sexo - -
ARVO_COLUMNS.code_type - -

Output Format

Glosa DataFrame Columns

Column Description
agent_id C066
version 0.0.1
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.