Skip to main content

HealthCare Interoperability framework

Small SDK project to host interoperability services and adapters.

Folder Architecture

documentation/
└─ frameworkClassDiagram.png
src/
└─ healthcare_sdk/
   ├─ app.py
   ├─ __init__.py
   ├─ transportLayer/
   │  ├─ adapter.py
   │  ├─ restController.py
   │  └─ __init__.py
   ├─ repositories/
   │  ├─ postgreSqlStorage.py
   │  ├─ storage.py
   │  └─ __init__.py
   ├─ usecases/
   │  ├─ healthCareUsecase.py
   │  └─ __init__.py
   └─ tools/
      ├─ aiHelper.py
      ├─ decoder.py
      ├─ normalizer.py
      ├─ validator.py
      └─ __init__.py

Proposed Class Diagram

Framework class diagram

Folder responsibilities:

  • transportLayer/: Transport adapters and server launchers (e.g., REST, HL7 over MLLP).
  • repositories/: Database providers and external data sources used by implementations.
  • usecases/: Application use cases and orchestration logic.
  • tools/: Shared helpers for decoding, validation, and normalization.

Setup (uv)

uv venv
uv add fastapi uvicorn

Run

$env:PYTHONPATH = "src"
python -m healthcare_sdk.app

Then open: http://127.0.0.1:8000/health

Install

pip install -e .

SDK Entry Point

The framework provides a registration helper to import arrays of components that implement the SDK Protocols.

from healthcare_sdk import register_components

components = register_components(
    adapters=[...],
    usecases=[...],
    validators=[...],
    decoders=[...],
    normalizers=[...],
    aihelpers=[...],
    storages=[...],
)

SDK Contracts

This document defines the generic envelope and component contracts for the SDK framework.

Envelope

The framework standardizes a generic envelope that can carry HL7v2, FHIR, or other protocols.

MessageEnvelope
  id: str
  protocol: str
  message_type: str
  raw_payload: str | bytes
  decoded_payload: dict | None
  normalized_payload: dict | None
  metadata: dict
  errors: list[ErrorDetail]
  status: str

Status values

  • received
  • decoded
  • validated
  • normalized
  • stored
  • error

Types

RawMessage
  id: str
  protocol: str
  raw_payload: str | bytes
  metadata: dict
  message_type: str | None

ErrorDetail
  code: str
  message: str
  stage: str
  context: dict | None

ValidationResult
  is_valid: bool
  errors: list[ErrorDetail]

Component contracts

Adapter
  executeServer(port=8000)
  receive() -> RawMessage

Decoder
  decode(raw_message: RawMessage) -> DecodedPayload

Validator
  validate(decoded_payload: DecodedPayload) -> ValidationResult

Normalizer
  normalizeData(decoded_payload: DecodedPayload) -> NormalizedPayload

Usecase
  execute(raw_message: RawMessage) -> MessageEnvelope

Storage
  save(envelope: MessageEnvelope) -> str
  connection() -> Any
  read(query: dict) -> dict
  delete(query: dict) -> bool
  update(query: dict, data: dict) -> bool

Errors

SdkError
  code: str
  message: str
  stage: str
  context: dict

DecodeError
ValidationError
NormalizationError
StorageError

Hl7 v2 examples

ALl the examples were taken of this repository

https://github.com/Work-In-Progress-For-Health/hl7-v2-examples

TO DO

  • Definir tipo de entidades a se armazenar
  • ORM?
  • setup postgreSql to test

Metadata

Release files for healthcare-sdk 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for healthcare-sdk 0.2.1
File Size Uploaded Provenance Actions
healthcare_sdk-0.2.1.tar.gz 10.5 kB Without provenance Details for healthcare_sdk-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for healthcare-sdk 0.2.1
File Interpreter ABI Platform Actions
healthcare_sdk-0.2.1-py3-none-any.whl Python 3 none any Details for healthcare_sdk-0.2.1-py3-none-any.whl

Total release size: 24.2 kB

Release files / healthcare_sdk-0.2.1.tar.gz

Download URL healthcare_sdk-0.2.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
04ffb0252d32c3f7f5348ec2a6c47681b3c6fb1a045bd7547a9b26948100f8a5
BLAKE2b-256 checksum
How to use checksums
902870b6c25918113514ae91e70ddca23f943405b15e02147a0f1762d699e55d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / healthcare_sdk-0.2.1-py3-none-any.whl

Download URL healthcare_sdk-0.2.1-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68075c8cd8de2479097e2491c81d5e7042a07a388bda96d7f2472ffadbb62d3b
BLAKE2b-256 checksum
How to use checksums
34187f0e59e34d2e220312917eb43ea0321b78fc8d0cf80480df5a55f8f55453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for healthcare-sdk 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page