Skip to main content

Healthcare interoperability framework SDK

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

healthcare_sdk-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

healthcare_sdk-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file healthcare_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: healthcare_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for healthcare_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af0f359a145d4b9699488b416dabb5ec3bd0e9fbad9ee09d4022cc57d0808f05
MD5 876a097e20d095881077e750617c3205
BLAKE2b-256 1bc64c5b29571935320661f6e1b91f636fcda47cf5a0619f9c2ca5fb46282fef

See more details on using hashes here.

File details

Details for the file healthcare_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: healthcare_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for healthcare_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d720f94c74c064db14e4b11fac49ae8e72c19e1e991c6dc817b96b56074cb5c5
MD5 c3e36ffc2cb9a0b1eaacb35ff4131309
BLAKE2b-256 c15f6c113457c26ccd550c1c06d29c83cf64469fd133b4d0f2916e3cf865572d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page