{"_id":"@br-health-kit/tiss","name":"@br-health-kit/tiss","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@br-health-kit/tiss","version":"1.0.0","description":"Vocabularios controlados do Padrao TISS da ANS, extraidos dos schemas oficiais","license":"MIT","engines":{"node":">=20"},"type":"module","sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./web":{"types":"./dist/web.d.ts","import":"./dist/web.js","require":"./dist/web.cjs"},"./data/*":"./data/*"},"dependencies":{"fast-xml-parser":"^4.5.0","@br-health-kit/core":"1.0.0"},"publishConfig":{"access":"public"},"keywords":["tiss","ans","saude suplementar","xml","brasil"],"repository":{"type":"git","url":"git+https://github.com/arielff3/br-health-kit.git","directory":"packages/tiss"},"homepage":"https://github.com/arielff3/br-health-kit/tree/main/packages/tiss#readme","bugs":{"url":"https://github.com/arielff3/br-health-kit/issues"},"scripts":{"build":"tsup","clean":"node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""},"_id":"@br-health-kit/tiss@1.0.0","_integrity":"sha512-TiDxD8dHbuk80hIlRK6zvcf6Qc6+ihIo1yPm+S1NelYiKmVBgsOYs0aiiMq11yvDQ955bBLtQGmpqEaN7Mzg9w==","_resolved":"C:\\Users\\ariel\\AppData\\Local\\Temp\\cc82d756e548173fc9f6b6c07c11ad97\\br-health-kit-tiss-1.0.0.tgz","_from":"file:br-health-kit-tiss-1.0.0.tgz","_nodeVersion":"22.17.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-TiDxD8dHbuk80hIlRK6zvcf6Qc6+ihIo1yPm+S1NelYiKmVBgsOYs0aiiMq11yvDQ955bBLtQGmpqEaN7Mzg9w==","shasum":"0abdbbe5fb3682bb7957a328c6732283b553d297","tarball":"https://registry.npmjs.org/@br-health-kit/tiss/-/tiss-1.0.0.tgz","fileCount":61,"unpackedSize":4342186,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICzGDickECPKe9o03pGz857fFo2+1md+z4jPIRddh/PCAiEA0E1pXtkeuNIhc+IVrImv/jS6f0Hu31ywCIb1TBgPAGY="}]},"_npmUser":{"name":"arielff03","email":"arielfrancoferreira5@gmail.com"},"directories":{},"maintainers":[{"name":"arielff03","email":"arielfrancoferreira5@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tiss_1.0.0_1787770229941_0.3482134010694933"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-26T18:50:29.810Z","1.0.0":"2026-08-26T18:50:30.126Z","modified":"2026-08-26T18:50:30.413Z"},"maintainers":[{"name":"arielff03","email":"arielfrancoferreira5@gmail.com"}],"description":"Vocabularios controlados do Padrao TISS da ANS, extraidos dos schemas oficiais","homepage":"https://github.com/arielff3/br-health-kit/tree/main/packages/tiss#readme","keywords":["tiss","ans","saude suplementar","xml","brasil"],"repository":{"type":"git","url":"git+https://github.com/arielff3/br-health-kit.git","directory":"packages/tiss"},"bugs":{"url":"https://github.com/arielff3/br-health-kit/issues"},"license":"MIT","readme":"# @br-health-kit/tiss\n\nThe TISS standard (Padrão para Troca de Informação de Saúde Suplementar) as\ntyped data extracted from the official ANS XSD schemas: 14 versions, from\n3.02.00 to 4.03.00.\n\n```bash\nnpm install @br-health-kit/tiss\n```\n\n```ts\nimport { tiss } from '@br-health-kit/tiss'\n\ntiss.values('caraterAtendimento')\n// [{ value: '1', label: 'Eletiva' }, { value: '2', label: 'Urgência/Emergência' }]\n\ntiss.isValidValue('caraterAtendimento', '3')   // false\ntiss.label('conselhoProfissional', '06')       // 'CRM Conselho Regional de Medicina'\ntiss.load('3.05.00')                           // pin your partner's version\n```\n\n## The problem it solves\n\nToday every healthtech copies these tables out of PDFs and into their own\ncode: professional council codes, care character, consultation type, rejection\nreason, participation degree. That is **89 vocabularies and over 2,000\nvalues** in version 4.03.00. Copied by hand, they age and drift.\n\n## Version matters\n\nTrading partners run different TISS versions. Pin the one you exchange:\n\n```ts\ntiss.versions()      // '3.02.00' ... '4.03.00'\ntiss.load('4.01.00')\n```\n\nThe vocabulary grew from 1,273 values in 3.02.00 to 2,090 in 4.03.00.\n\n## What is verified and what is not\n\nThis distinction is taken seriously:\n\n| | Origin | Reliability |\n| --- | --- | --- |\n| **Values** | `enumeration` elements in the official XSD | **They are the schema.** Authoritative. |\n| **Labels** | XML comments beside the values | Best-effort, about 88% coverage |\n\nWhen the schema carries no comment for a value, the label is `null`, never\ninferred. A wrong label on a billing field is worse than a missing one.\n\nLabel extraction is driven by the values themselves: a comment line only\nbecomes a label if it **starts with a real value** of that enumeration. That\nhandles the several styles ANS uses without prose paragraphs becoming labels\nby accident.\n\n## Guide structure and validation\n\nThe package also carries the **structure** of every guide and message: 126\ntypes, 36 of them message level (`ctm_` for medical, `cto_` for dental):\n\n```ts\ntiss.messages()                       // the standard's guides and messages\ntiss.complexType('ctm_consultaGuia')  // elements, types and cardinality\n\ntiss.validate('ctm_consultaGuia', myGuide)\n// { valid: false, issues: [{ path: 'dadosBeneficiario.numeroCarteira',\n//                            code: 'missing', ... }] }\n```\n\nValidation checks required elements, cardinality, unknown elements and each\nleaf value against its domain, recursively, reporting a dotted path.\n\n### The limit of that validation\n\nIt verifies what the **schema** states. It does not verify business semantics:\nwhether the procedure is covered by the plan, whether the dates are coherent,\nwhether that operator accepts that combination of fields. Those rules live in\nANS manuals and in each operator's own rulebook, not in the XSD.\n\n**A guide that passes here can still be rejected.** That line is drawn on\npurpose and stated, not blurred.\n\n## XML in schema order\n\n```ts\nconst xml = tiss.toXml('ctm_consultaGuia', guide)\nconst object = tiss.fromXml('ctm_consultaGuia', xml)\n```\n\n**Element order comes from the schema, not from your object.** That is the\npoint: an XSD `sequence` is ordered, and an operator's validator rejects a\nguide with shuffled elements even when every value is correct. It is the most\ncommon failure in hand-written TISS integrations, and it disappears by\nconstruction here.\n\nOther guarantees:\n\n- zero-padded codes stay strings: `00012345` never becomes `12345`\n- a key the schema does not declare **throws** instead of vanishing from the\n  XML; silently dropping billing data would be the worst possible outcome\n- when reading, unknown elements are preserved so `validate()` can report them\n- `toXml` does not require a complete guide, since building one incrementally\n  is normal; `validate()` is the gate\n\n## What this package does not do\n\nDigital signature (`ds:Signature`) is out of scope. The ANS schema defines it\nas optional, and signing requires the provider's ICP-Brasil certificate: a\ndata library should not handle private keys. See\n[`ROADMAP.md`](../../ROADMAP.md#out-of-scope).\n\n## Environment\n\nNode 20+ through the default entry. For a client bundle use\n`@br-health-kit/tiss/web`. See [`docs/browser.md`](../../docs/browser.md).\n\n## Provenance\n\nPublic ANS schemas (`ans.gov.br/padroes/tiss/schemas`), redistributed without\ncontent modification. Code under MIT.\n","readmeFilename":"README.md","_rev":"1-356b5459f82ef30e8806a161df670258"}