Skip to main content

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.

Metadata

Release files for hacs-models 0.4.3

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

Source distribution (sdist)

Source distribution for hacs-models 0.4.3
File Size Uploaded Provenance
hacs_models-0.4.3.tar.gz 46.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hacs-models 0.4.3
File Interpreter ABI Platform
hacs_models-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 104.3 kB

Release files / hacs_models-0.4.3.tar.gz

Download URL hacs_models-0.4.3.tar.gz
Size 46.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ec9b3f99764213c74b610a78d49b5eaab0e6941667b9593a28cfe3af4c90b96d
BLAKE2b-256 checksum
How to use checksums
bddc1903a9120923b8011a0c40cf27dc28931293525bfeee75e4470cca7c0193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

Release files / hacs_models-0.4.3-py3-none-any.whl

Download URL hacs_models-0.4.3-py3-none-any.whl
Size 57.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6836a4cf5088e9cdb0572aedaa0ee5a02f8dfb429a0bbe4006684a5e270b1044
BLAKE2b-256 checksum
How to use checksums
4f6ee2f9cfe964b89ae9c6be279d73149645b0a1cf2e33eacc4366881f0e46ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

Security for hacs-models 0.4.3

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.

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