Inspiration

Hospital supply crises rarely happen because teams lack expertise. They happen because critical information is fragmented across incompatible spreadsheets, inventory systems, units, naming conventions, and departments.

During an antimicrobial shortage, a hospital may know that stock is low but still struggle to answer the questions that matter:

  • Which hospital will run out first?
  • How many units will be missing over the next 72 hours?
  • Can another hospital safely donate inventory?
  • Will the plan survive a demand surge or route disruption?
  • What evidence supports the recommendation?
  • Who must approve the response before it is executed?

LifelineOS was created to turn disconnected operational data into a transparent, stress-tested, and auditable crisis response.


What it does

LifelineOS — Antimicrobial Crisis Edition is a healthcare operations platform for coordinating a synthetic antibiotic supply emergency across multiple hospitals.

The demonstration models three hospitals with incompatible inventory formats:

  • Hospital A reports stock in vials and daily consumption.
  • Hospital B reports packs and weekly consumption.
  • Hospital C uses a different Excel schema and medication aliases.

LifelineOS transforms these sources into one canonical crisis model, validates the data, forecasts stockouts, optimizes transfers, tests the plan under adverse scenarios, and requires human approval before exporting an operational response package.

Verified demonstration results

In the submitted synthetic scenario:

  • 2 hospitals face projected stockouts.
  • The baseline 72-hour shortage is 220 units.
  • Hospital C transfers 130 units to Hospital A.
  • Hospital C transfers 90 units to Hospital B.
  • The optimized baseline shortage becomes 0 units.
  • The estimated transfer cost is 333.
  • A combined worst-case scenario still leaves 252 units short.

The system does not hide that failure. It labels the plan as fragile and requires human review.


Core workflow

  1. Ingest disconnected hospital files
  2. Normalize medication names, units, and schemas
  3. Validate duplicates, missing values, unknown medicines, and invalid stock
  4. Forecast inventory coverage and stockout risk
  5. Generate a constrained transfer plan
  6. Run deterministic crisis stress tests
  7. Perform a structured multi-agent evidence review
  8. Require explicit human approval
  9. Generate a hashed and auditable response package

The final export contains normalized data, forecasts, transfers, stress-test results, limitations, an incident playbook, and a SHA-256 audit manifest.


How we built it

LifelineOS uses a deterministic-first architecture.

Backend

  • Python
  • FastAPI
  • Pandas
  • Pydantic
  • OR-Tools CP-SAT
  • Pytest
  • OpenAI Agents SDK-compatible orchestration

Frontend

  • Next.js
  • TypeScript
  • Tailwind CSS
  • Recharts
  • A command-center interface for crisis operations

Infrastructure

  • Docker
  • Docker Compose
  • Persistent generated exports
  • Automated PowerShell smoke testing

The numerical decisions are not generated by an LLM.

Forecasting, shortage calculations, safety-stock constraints, route capacities, transfer quantities, and scenario results are produced by deterministic Python services and OR-Tools.

The AI review layer can explain and challenge those results, but it cannot overwrite them.


How Codex was used

Codex was used throughout the real development workflow, not only for initial scaffolding.

It helped:

  • Structure the repository
  • Build hospital ingestion and normalization adapters
  • Implement forecasting services
  • Create the OR-Tools optimization model
  • Build the stress-testing engine
  • Develop the FastAPI mission state machine
  • Build the Next.js Mission Control interface
  • Generate automated tests
  • Diagnose failed builds and runtime errors
  • Create Docker support and smoke tests
  • Build export and audit functionality
  • Review and improve project documentation

A dedicated Codex engineering workflow also produced and tested the Hospital C adapter.

That run generated:

  • The adapter implementation
  • Adapter tests
  • A real code diff
  • Test output
  • A local execution manifest

These artifacts are displayed inside the application as a Verified Local Codex Run.


Runtime agent review disclosure

The submitted zero-cost demo uses a clearly labeled:

VERIFIED REPLAY — No live model call

This replay is a stored, structured, test-verified review of the exact synthetic mission outputs.

It is not presented as a live GPT model call.

The architecture supports live execution through the OpenAI Agents SDK when a valid API configuration and billing are available, but the submitted demonstration does not require a paid API request.

The agent team includes:

  • Data Quality Investigator
  • Pharmacy Supply Safety Agent
  • Operations Response Agent
  • Crisis Red Team Agent
  • Evidence Judge

The Evidence Judge returns a FRAGILE verdict because the baseline plan succeeds while severe stress scenarios remain unresolved.


Challenges we faced

Incompatible data

Each hospital used different medication names, schemas, units, and consumption periods.

We solved this using testable adapters and a canonical inventory model.

Avoiding impressive but unsafe AI behavior

It would have been easy to let an LLM invent recommendations or recalculate values.

Instead, we separated deterministic computation from AI interpretation.

Honest failure reporting

A crisis tool should not always return a green result.

The combined worst-case scenario deliberately remains infeasible, leaving 252 units short.

Reproducibility

Every important layer is tested:

  • Normalization
  • Forecasting
  • Optimization
  • Simulation
  • APIs
  • Agent-review metadata
  • Codex artifacts
  • Export security
  • Audit hashes
  • Docker deployment

Safe export

The response package includes strict path validation, approved filenames, cryptographic hashes, and no secrets or environment files.


Accomplishments that we are proud of

  • Built a complete end-to-end healthcare operations workflow
  • Reduced the synthetic baseline shortage from 220 to 0 units
  • Preserved donor safety stock and route capacities
  • Created deterministic stress testing for multiple crisis scenarios
  • Integrated a real tested Hospital C adapter
  • Built a transparent human approval gate
  • Generated downloadable incident response packages
  • Added SHA-256 verification for exported artifacts
  • Created one-command Docker deployment
  • Built an automated end-to-end Docker smoke test
  • Clearly separated live AI capability from verified replay behavior
  • Avoided patient-level clinical recommendations

What we learned

The most important lesson was that trustworthy AI systems need more than a strong model.

They need:

  • Deterministic tools
  • Explicit constraints
  • Structured outputs
  • Reproducible tests
  • Honest uncertainty
  • Human approval
  • Audit trails
  • Clear failure states

We also learned that showing when a plan fails can be more valuable than producing an artificially confident answer.


Safety and limitations

LifelineOS is a synthetic demonstration project.

It is:

  • Not clinically validated
  • Not connected to real hospitals
  • Not a diagnostic system
  • Not a prescribing system
  • Not intended for patient-level decisions
  • Not a replacement for pharmacists, clinicians, procurement teams, or crisis managers

All data is synthetic.

The transport, demand, and inventory assumptions are simplified.

Real deployment would require independent technical, clinical, regulatory, security, and operational validation.


What's next

Future versions could include:

  • Secure integration with hospital inventory systems
  • Probabilistic demand forecasting
  • Real transport and supplier constraints
  • Multi-drug and multi-region optimization
  • Role-based access control
  • Live OpenAI Agents SDK execution
  • Human-in-the-loop plan editing
  • Continuous supply monitoring
  • Integration with antimicrobial stewardship teams
  • External validation with healthcare operations experts

LifelineOS does not replace human crisis teams.

It turns fragmented data into a tested, explainable, and auditable response.

Built With

Share this project:

Updates