Skip to main content

Open Compute - multi-agent systems for healthtech

Project description

Open Compute

Open-source agentic AI for health-tech

Open Compute is a powerful Python library that uses AI agents to transform patient journeys into standards-compliant FHIR (Fast Healthcare Interoperability Resources) data. Built by Jori Health, this tool enables healthcare developers to bridge the gap between narrative patient experiences and structured healthcare data.

Quick Start

Installation

pip install open-compute

Requirements

  • Python 3.9+
  • OpenAI API Key: Set as environment variable
    export OPENAI_API_KEY='your-api-key-here'
    

Usage

Patient Journey to FHIR Conversion

The primary use case is converting narrative patient journeys into structured, validated FHIR resources:

from open_compute import (
    PatientJourney,
    JourneyStage,
    generate_fhir_from_journey,
)

# 1. Define a patient journey with clinical narrative
journey = PatientJourney(
    patient_id="patient-123",
    summary="58 year old male presents to ER with chest pain, diagnosed with acute MI",
    stages=[
        JourneyStage(
            name="Registration",
            description="Patient registered in ER",
            metadata={
                "timestamp": "2024-01-15T10:30:00Z",
                "location": "Emergency Department"
            }
        ),
        JourneyStage(
            name="Triage",
            description="Initial assessment - chest pain, elevated BP",
            metadata={
                "vital_signs": {
                    "blood_pressure": "150/95 mmHg",
                    "heart_rate": "88 bpm"
                },
                "chief_complaint": "Chest pain"
            }
        ),
        JourneyStage(
            name="Diagnosis",
            description="Diagnosed with acute myocardial infarction",
            metadata={
                "condition": "Acute MI",
                "icd10_code": "I21.9"
            }
        ),
        JourneyStage(
            name="Treatment",
            description="Administered aspirin and nitroglycerin",
            metadata={
                "medications": ["Aspirin 325mg", "Nitroglycerin 0.4mg"]
            }
        ),
    ]
)

# 2. Generate FHIR resources using AI
result = generate_fhir_from_journey(
    journey=journey,
    patient_context="58 year old male named John Doe with history of hypertension",
    model="gpt-4o-mini",  # or "gpt-4", "gpt-3.5-turbo"
    fhir_version="R4",
    max_iterations=3,
    auto_save=True  # Saves to output/john_doe/
)

# 3. Check results
print(f"✅ Success: {result.success}")
print(f"📊 Generated {len(result.generated_resources)} FHIR resources")
print(f"🔄 Iterations: {result.iterations}")

# View generated resource types
for resource in result.generated_resources:
    print(f"  - {resource['resourceType']}/{resource.get('id', 'no-id')}")

Output Structure

When auto_save=True, generated files are saved to output/{firstname_lastname}/:

output/john_doe/
├── patient_bundle.json    # Complete FHIR Bundle (all resources)
├── bulk_fhir.jsonl       # Bulk FHIR format (one resource per line)
└── README.txt            # Summary of generated resources

Advanced Configuration

from open_compute import AIJourneyToFHIR

# Create agent with custom configuration
agent = AIJourneyToFHIR(
    api_key="your-openai-key",  # or use env var OPENAI_API_KEY
    model="gpt-4o-mini",
    fhir_version="R4",
    max_iterations=5,
    max_fix_retries=3,
    auto_save=True,
    save_directory="output",
    parallel_generation=True,  # Faster generation
    use_enhanced_context=True  # Better accuracy with FHIR profiles
)

# Generate resources
result = agent.generate(journey, patient_context="...")

Examples

We provide comprehensive examples to help you get started:

Running the Examples

# Make sure you have your OpenAI API key set
export OPENAI_API_KEY='your-api-key-here'

# Run the main example
python examples/patient_journey_to_fhir_example.py

Available Examples

Example Description File
Basic Usage Complete patient journey with ER visit, diagnosis, and treatment examples/patient_journey_to_fhir_example.py

The example demonstrates:

  • Creating a patient journey with multiple stages
  • Generating FHIR resources (Patient, Encounter, Observation, Condition, MedicationStatement, Procedure)
  • Validating generated resources
  • Auto-saving to organized output directory

Contributing

We welcome contributions! Open Compute is an open-source project and we'd love your help.

Areas for Contribution

  • Additional FHIR resource types
  • Support for more FHIR versions
  • Enhanced validation rules
  • Performance optimizations
  • Documentation improvements

Getting Started

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (pytest)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

MIT License - see LICENSE for details

Made with 🏥 for better healthcare interoperability

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

open_compute-0.0.7.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

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

open_compute-0.0.7-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file open_compute-0.0.7.tar.gz.

File metadata

  • Download URL: open_compute-0.0.7.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for open_compute-0.0.7.tar.gz
Algorithm Hash digest
SHA256 29299d10c6a99c1341b6f6cd7b75b058dab3f041adcc00b3fe0be0cd52c75082
MD5 b4e5b7d79919524fad07e3fd76eba9cd
BLAKE2b-256 35d04c2daeeeb074b9bf08f8fa7c70cea0f07fb060dbb4e3c97f7cd6083cd0d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_compute-0.0.7.tar.gz:

Publisher: publish.yml on Jori-Health/Open-Compute

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_compute-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: open_compute-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for open_compute-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 62e9cceff868aa217162974f689964a8db3ea391bef003e94efc53ad0e0a52d4
MD5 fc4151c7e413dab08dc94a81c3c551dd
BLAKE2b-256 922b8480e7eae54cbad5f5b00d5751b4b9fc1688bba88eac5ba9e73bcda2db97

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_compute-0.0.7-py3-none-any.whl:

Publisher: publish.yml on Jori-Health/Open-Compute

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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