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.2.1.tar.gz (10.5 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.2.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for healthcare_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 04ffb0252d32c3f7f5348ec2a6c47681b3c6fb1a045bd7547a9b26948100f8a5
MD5 55f0666caf70de41914e089c93e7ccef
BLAKE2b-256 902870b6c25918113514ae91e70ddca23f943405b15e02147a0f1762d699e55d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for healthcare_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68075c8cd8de2479097e2491c81d5e7042a07a388bda96d7f2472ffadbb62d3b
MD5 6e315e7a0193ffc4e6e314c3e1198052
BLAKE2b-256 34187f0e59e34d2e220312917eb43ea0321b78fc8d0cf80480df5a55f8f55453

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