Metadata-Version: 2.4
Name: sqllocks-shape-healthcare-standards
Version: 0.9.1
Summary: Shape plugin: healthcare standard outputs (X12 837/835/834, FHIR R4, OMOP CDM, NCPDP mapping) and X12 / HL7 v2 readers
License-Expression: MIT
Project-URL: Homepage, https://github.com/sqllocks/shape
Project-URL: Repository, https://github.com/sqllocks/shape
Project-URL: Issues, https://github.com/sqllocks/shape/issues
Project-URL: Documentation, https://github.com/sqllocks/shape/tree/main/plugins/shape-healthcare-standards
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sqllocks-shape==0.9.1
Provides-Extra: test
Requires-Dist: pyx12<5,>=4.0; extra == "test"
Requires-Dist: fhir.resources<9,>=8.3; extra == "test"
Requires-Dist: duckdb<2,>=1.1; extra == "test"
Dynamic: license-file

# sqllocks-shape-healthcare-standards

Shape plugin: standard healthcare outputs from a domain pack's tables.

| Sink / emitter / source | Output |
|---|---|
| `x12-837p`, `x12-837i` | X12 005010 claims, one interchange per file |
| `x12-835` | X12 005010 remittance advice |
| `x12-277ca` | X12 005010X214 claim acknowledgment (277CA) |
| `x12-834` | X12 005010 benefit enrollment |
| `fhir-ndjson`, `fhir-bundle` | FHIR R4 resources (Bulk FHIR ndjson; one JSON bundle per file) |
| `omop` | OMOP CDM v5.4 tables (CSV or Parquet) |
| `ncpdp` | bring-your-own-specification mapping layer (no spec text is shipped) |
| `fhir` (emitter) | FHIR resources as events |
| `x12` (source) | reads X12 interchanges (`x12://FILE`, `.x12`, `.edi`) into an `x12_segment` table, and for the 835 one table per loop (`loops="tables"`) |
| `hl7v2` (source) | reads HL7 v2 messages (`.hl7`, MLLP framing allowed) into an `hl7_segment` table, and one table per segment id (`segments="tables"`) |

Details: `docs/plugins/healthcare-standards.md`.

The input is the table contract in `shape_healthcare_standards.contract` (also the source of
truth for the column names and types a domain pack must produce). Every identifier is
synthetic, and the X12 envelopes carry clearly synthetic sender and receiver ids.

Installing the validators the tests use: `pip install 'sqllocks-shape-healthcare-standards[test]'`.

The two readers are structural: they split interchanges and messages into segments and fields and
interpret no code. Table layouts and options are in
[`docs/plugins/healthcare-standards.md`](../../docs/plugins/healthcare-standards.md).

The writers read the tables other than the one they are given from the `tables` option (a mapping
from contract table name to an Arrow table or record batch). The option, which tables each writer
needs, the precedence rule and the errors are a stable interface in 1.x:
[Companion tables](../../docs/plugins/healthcare-standards.md#companion-tables-tables), and
`shape_healthcare_standards.companion_tables(sink_name)` for the same data in code.
