Skip to main content

HACS Healthcare Data Models - Pure Pydantic models for FHIR-compliant healthcare data

Project description

HACS Models

Pure Healthcare Data Models for AI Agent Systems

Python 3.11+ Type Checked Code Quality FHIR Compliant

Overview

hacs-models provides pure, type-safe Pydantic data models for healthcare applications. These models are designed for AI agent communication and are fully compliant with FHIR R4/R5 standards.

Design Principles

  • Pure Data Models: No business logic, just data structures
  • Type Safety: Full type annotations with mypy strict mode
  • FHIR Compliance: Adherent to healthcare data standards
  • Zero Dependencies: Minimal dependency footprint (only Pydantic)
  • Immutable Design: Designed for functional programming patterns
  • AI-Optimized: Structured for AI agent communication

Features

Core Healthcare Models

  • Patient - Patient demographics and identifiers
  • Observation - Clinical observations and measurements
  • Encounter - Healthcare encounters and visits
  • Condition - Medical conditions and diagnoses
  • Medication - Medication information
  • MedicationRequest - Medication prescriptions
  • Procedure - Medical procedures
  • Goal - Care goals and objectives

Specialized Models

  • MemoryBlock - AI agent memory structures
  • AgentMessage - Inter-agent communication
  • ResourceBundle - FHIR resource collections
  • WorkflowDefinition - Clinical workflow definitions

Base Classes

  • BaseResource - Foundation for all healthcare resources
  • DomainResource - Base for domain-specific resources
  • BackboneElement - Reusable data structures

Installation

# Install from PyPI (when published)
pip install hacs-models

# Install in development mode
uv add -e packages/hacs-models

Quick Start

from hacs_models import Patient, Observation
from datetime import date

# Create a patient
patient = Patient(
    id="patient-001",
    full_name="Jane Doe",
    birth_date=date(1990, 1, 15),
    gender="female"
)

# Create an observation
observation = Observation(
    id="obs-001",
    subject_reference=f"Patient/{patient.id}",
    code="85354-9",  # Blood pressure
    value_quantity={"value": 120, "unit": "mmHg"}
)

# Models are immutable and type-safe
print(f"Patient: {patient.full_name}")
print(f"Blood Pressure: {observation.value_quantity}")

Architecture

hacs-models/
├── base_resource.py     # BaseResource, DomainResource
├── patient.py          # Patient model
├── observation.py      # Observation model  
├── encounter.py        # Encounter model
├── condition.py        # Condition model
├── medication.py       # Medication models
├── procedure.py        # Procedure model
├── goal.py            # Goal model
├── memory.py          # AI memory models
├── workflow.py        # Workflow models
└── types.py           # Common types and enums

Development

# Run tests
uv run pytest

# Type checking  
uv run mypy src/hacs_models

# Code formatting
uv run ruff format src/hacs_models

# Linting
uv run ruff check src/hacs_models

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new models
  4. Ensure 100% type coverage
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

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

hacs_models-0.4.3.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

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

hacs_models-0.4.3-py3-none-any.whl (57.5 kB view details)

Uploaded Python 3

File details

Details for the file hacs_models-0.4.3.tar.gz.

File metadata

  • Download URL: hacs_models-0.4.3.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for hacs_models-0.4.3.tar.gz
Algorithm Hash digest
SHA256 ec9b3f99764213c74b610a78d49b5eaab0e6941667b9593a28cfe3af4c90b96d
MD5 9ed787980ca0564752688859cbab57a7
BLAKE2b-256 bddc1903a9120923b8011a0c40cf27dc28931293525bfeee75e4470cca7c0193

See more details on using hashes here.

File details

Details for the file hacs_models-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: hacs_models-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 57.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for hacs_models-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6836a4cf5088e9cdb0572aedaa0ee5a02f8dfb429a0bbe4006684a5e270b1044
MD5 eb18b0fd1f42d9c847a7e46eb5c435bd
BLAKE2b-256 4f6ee2f9cfe964b89ae9c6be279d73149645b0a1cf2e33eacc4366881f0e46ce

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