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

Uploaded Python 3

File details

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

File metadata

  • Download URL: healthcare_sdk-0.2.tar.gz
  • Upload date:
  • Size: 10.4 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.tar.gz
Algorithm Hash digest
SHA256 5a6c79fc1a11b9633d6ff1f50c708e2688c74574607eb8a56eace5a017067bbe
MD5 6f7e629eba385a9b32138feacd7895b5
BLAKE2b-256 6c583bf3661f686b6bf97d23e48683f306d9a60e32ecdb8e0e978132e700e3f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: healthcare_sdk-0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 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-py3-none-any.whl
Algorithm Hash digest
SHA256 7b3dc75f758a0336eefa862d54979e4f0abaca005fa77e6428eee47d8424aa61
MD5 84c8022c20fe77b3ffcb39f36ffcadea
BLAKE2b-256 785382dba188775b319209ded83a9fc34fba1c49e6f35544826d295177140552

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