nbrain-dicom-sr-ihe-air
# `nbrain-dicom-sr-ihe-air` — Radiology AI `DICOM PS3.16 TID 1500`, `IHE AI Results (AIR)` & `HL7 FHIR R4` Bidirectional Engine + MCP Server
[](./LICENSE)
[](./pyproject.toml)
[](./server.json)
Engineered by **[Eng. Nadeem Mohamed Badr El-Din](https://nadeembadr.com)** at **[NBrain (`منظومة إن برين` — nbra.in)](https://nbra.in)** to bridge clinical deep-learning models (such as **Nabd Masr** 14-pathology Thoracic CXR and **MedCore CephTrace** 29-landmark cephalometrics) into hospital PACS and EHR systems without clinical coding drift.
## Standards Implemented
1. **DICOM PS3.5 Section B.2 (`2.25.<UUID-int>`)**: Deterministic UUIDv5-backed DICOM UID generation (`<= 64` chars, strict no-leading-zero component enforcement).
2. **DICOM PS3.16 Template `TID 1500` (`Measurement Report`) & `PS3.18` DICOMweb JSON (`application/dicom+json`)**: Encodes AI algorithm provenance (`TID 1001` Device Observer), 2D `SCOORD` bounding boxes / landmarks, calibrated `Decimal` probabilities, and quantitative angular/linear measurements (`SNA`, `SNB`, `ANB`, `FMA`, `IMPA`).
3. **IHE AI Results (`AIR`) Safety Profile**: Enforces `CompletionFlag = "COMPLETE"` and `VerificationFlag = "UNVERIFIED"` on autonomous AI outputs so unreviewed machine inferences never masquerade as radiologist-signed reports.
4. **HL7 DICOM-SR to FHIR R4 Implementation Guide**: Deterministically translates `TID 1500` reports into FHIR R4 transaction `Bundle`s (`ImagingStudy` + `Device` + coded `Observation`s with SNOMED-CT / RadLex / LOINC / UCUM + `preliminary` `DiagnosticReport`).
## Quick Verification
```bash
PYTHONPATH=src python -m unittest discover -s tests -v
```
TDQS
Scored across 4 tools
Each tool occupies a distinct slot in the pipeline: build (findings→SR), validate (audit SR), translate (SR→FHIR), and UID minting/validation. The descriptors clearly disambiguate direction and object of each operation, so misselection is unlikely.
All names are snake_case with a leading verb (translate_, validate_or_mint_, build_, validate_), which is a predictable pattern. Minor deviations: the compound 'validate_or_mint' verb and varying suffix phrasing (target format spelled out only in some names) make lengths inconsistent.
Four tools is a lean but sensible scope for a narrow build-validate-translate pipeline plus a UID helper. The UID utility is somewhat tangential, but nothing feels redundant.
The build→validate→translate lifecycle is fully covered, with UID handling as a supporting operation. Gaps remain on the output side: there is no validation for the produced FHIR R4 Bundle and no way to fetch or extract measurements back out of an existing SR.