Inconsistência de Codificação
Overview
Detects when the claim event description does not match the expected taxonomy description for the same id_evento. Uses fuzzy matching first; for pairs below the fuzzy threshold, uses semantic similarity (embeddings) plus jaccard and first-token scores into a hybrid score. Items with hybrid_similarity below threshold_llm are glosed (description inconsistency). Excludes generic/proprietary codes and invalid events via optional artifact tables and code_type; supports Contas and Autorizacao origins and evaluated mode.
Architecture
| Field | Value |
|---|---|
| Name | Inconsistência de Codificação |
| Agent ID | C011 |
| Version | 6 |
| Nature | tech |
| Layer | — |
Inheritance
NameInconsistencyRule → BaseRule → BaseAgent
Core Functionality
- load_artifacts
- tax_embeddings_enrichment
- prepare_data
- validate_emb
- rule_assessment
Business Rules
Conformidade da cobrança
Consultar código-fonte para regras de negócio detalhadas.
Usage
from agents.nameinconsistencyrule import NameInconsistencyRule
rule = NameInconsistencyRule()
violations_df = rule.rule_assessment(claims_df)
Configuration
Sem parâmetros configuráveis identificados.
Input Requirements
| Column | Type | Description |
|---|---|---|
EVENT_COLUMNS.id_evento |
- | - |
EVENT_COLUMNS.vl_unitario_pago |
- | - |
PROVIDER_COLUMNS.id_prestador |
- | - |
EVENT_COLUMNS.categoria |
- | - |
EVENT_COLUMNS.evento |
- | - |
EVENT_COLUMNS.vl_pago |
- | - |
EVENT_COLUMNS.qt_paga |
- | - |
EVENT_COLUMNS.id |
- | - |
EVENT_COLUMNS.id_fatura |
- | - |
EVENT_COLUMNS.pacote |
- | - |
EVENT_COLUMNS.guia |
- | - |
ARVO_COLUMNS.code_type |
- | - |
ARVO_COLUMNS.partner_id |
- | - |
Output Format
Glosa DataFrame Columns
| Column | Description |
|---|---|
agent_id |
C011 |
version |
6 |
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.