voa-tiss
English: Offline Python tools for ANS TISS documents.
Biblioteca Python para validar lotes TISS, ler demonstrativos e consultar TUSS sem rede.
Requer Python 3.10+.
Site técnico: tiss-api.voa.health.
Instalação
pip install voa-tiss
pip install "voa-tiss[pdf]" # renderização SP/SADT
Início rápido
from voa_tiss import examples, validate
report = validate(examples.load("lote-com-erros"))
[(finding.code, finding.severity) for finding in report.findings]
API
| Símbolo | Uso |
|---|---|
validate |
Valida um lote TISS e retorna um relatório. |
check |
Verifica um lote JSON e propõe correções. |
apply_fixes |
Aplica correções determinísticas ao lote JSON. |
build_lote |
Gera o XML TISS a partir de um lote validado. |
parse_lote |
Converte XML TISS em um lote JSON. |
audit |
Audita o lote com o contexto da operadora. |
hash_epilogo |
Calcula o hash do epílogo. |
glosa |
Consulta um código da Tabela 38. |
dominio.lookup / dominio.search |
Consulta tabelas de domínio TISS. |
operadoras.lookup / operadoras.search |
Consulta operadoras ativas na ANS. |
operadoras.perfil |
Junta o cadastro e os indicadores de glosa da ANS. |
parse_demonstrativo |
Lê um demonstrativo e retorna decisões por guia. |
plan_reconciliation |
Propõe conciliação entre decisões e guias. |
sadt_missing |
Lista campos obrigatórios ausentes da guia SP/SADT. |
sadt_catalog |
Retorna uma cópia do catálogo SP/SADT. |
render_sadt (extra pdf) |
Gera um PDF da guia SP/SADT. |
tuss.lookup |
Consulta um código TUSS. |
tuss.search |
Busca registros TUSS por texto. |
rede.* |
Consulta vínculos da rede hospitalar da ANS. |
json_schema |
Retorna o esquema JSON de um tipo público. |
examples |
Disponibiliza exemplos sintéticos do pacote. |
voa_tiss.rede baixa e verifica os dados na primeira consulta. Defina
VOA_TISS_REDE com o caminho de um SQLite local para usar uma cópia própria.
Fluxo
flowchart LR
A["Lote JSON"] --> B["check"]
B --> C{"Há correções?"}
C -->|sim| D["apply_fixes"]
D --> B
C -->|não| E["build_lote"]
E --> F["XML TISS"]
Achados
| Campo | Significado |
|---|---|
code |
Código estável em docs/codigos.md |
severity |
error ou warning |
guia |
Identificador da guia, quando houver |
xpath |
Localização no XML, quando houver |
message |
Descrição concisa do achado |
pointer |
JSON Pointer no lote JSON, quando houver |
fix |
Correção em JSON Patch, quando determinística |
needs |
Campos necessários para completar a guia |
glosa |
Código provável da Tabela 38, quando houver |
rule |
Regra de operadora que gerou o achado, quando houver |
Garantias
- Offline e determinístico.
- XSD fixado por hash.
- Texto livre da guia é dado, nunca instrução.
API e MCP
Instale o extra do servidor e inicie a API local:
pip install "voa-tiss[server]"
python -m voa_tiss.server --host 127.0.0.1 --port 8000
Valide XML como JSON ou como corpo XML:
python -c 'import json, pathlib; print(json.dumps({"xml": pathlib.Path("lote.xml").read_text()}))' \
| curl https://tiss-api.voa.health/v1/validate \
-H 'Content-Type: application/json' \
--data-binary @-
curl https://tiss-api.voa.health/v1/validate \
-H 'Content-Type: application/xml' \
--data-binary @lote.xml
Conecte clientes MCP:
claude mcp add --transport http voa-tiss https://tiss-api.voa.health/mcp
No Codex, adicione a ~/.codex/config.toml:
[mcp_servers.voa-tiss]
url = "https://tiss-api.voa.health/mcp"
No Cursor, adicione ao mcp.json:
{
"mcpServers": {
"voa-tiss": {
"url": "https://tiss-api.voa.health/mcp"
}
}
}
Consulte o OpenAPI e o catálogo de operações.
Sem chave, só as operações do sandbox respondem. Para as demais, entre com a conta Voa em tiss-api.voa.health/chaves e envie a chave recebida. Não há limite diário.
curl https://tiss-api.voa.health/v1/validate \
-H "Authorization: Bearer $VOA_TISS_API_KEY" \
-H 'Content-Type: application/xml' \
--data-binary @lote.xml
A chave vale 24 horas. Renove com o refresh_token recebido no login; chave
inválida ou expirada retorna 401:
curl https://tiss-api.voa.health/v1/keys/refresh \
-H 'Content-Type: application/json' \
-d '{"refresh_token": "..."}'
O serviço não armazena nem registra payloads e não os usa para treinar modelos.
Quando ativada por POSTHOG_KEY, a telemetria agregada contém apenas operação,
códigos de achados, registro ANS, versão TISS e data. Envie
X-Voa-Telemetry: off para desativá-la. A biblioteca local permanece offline e
nunca envia telemetria. VOA_TISS_API_KEY é a variável que clientes HTTP locais
podem ler para enviar uma chave de acesso.
Guias e contratos
Metadata
Release files for voa-tiss 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| voa_tiss-0.2.0.tar.gz | 1.1 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| voa_tiss-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.4 MB
Release files / voa_tiss-0.2.0.tar.gz
| Download URL | voa_tiss-0.2.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a02511c26092e5b8ef4a7c3dd4bcbce732cbf18ef7c319f9de1d4a281c51daa8
|
|
BLAKE2b-256 checksum How to use checksums |
85ed8ec3f818ea0a4288d631ef2084ffff505358691e58bf86ede423e7143df7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / voa_tiss-0.2.0-py3-none-any.whl
| Download URL | voa_tiss-0.2.0-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed976691615e1950b132bc213e110daaa1d7a41a3d3c0490089041ae8355bf0d
|
|
BLAKE2b-256 checksum How to use checksums |
b2b64cffdd9c8da1e48f92151c5ed6ce6f9cc35da0830c2528a9dba65f39408e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for voa-tiss 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for voa_tiss-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.