Inspiration

A Catastrophic Life Care Plan is the most important document in any spinal-cord, brain-injury, burn, or amputation lawsuit — but it costs the family $6,000–$7,500, takes 4–6 weeks to produce by hand, and 90% of the patients who need one never get one.

Self-funded plaintiffs, Medicaid-bound families, and public-defender clients are simply priced out of a deliverable that anchors their entire settlement. Lastmile collapses that 4-week, $7,500 deliverable into one chat prompt inside Prompt Opinion.

What it does

A clinician, case manager, or attorney opens a patient in Po, types one sentence — "draft a catastrophic care plan" — and gets back two hosted HTML reports that replicate what a board-certified Life Care Planner charges thousands for.

The clinical Life Care Plan — five differentiators

Layer What it adds
📈 SVG trajectory timeline The whole 6-month course as 14 color-coded event dots — admission → surgery → ICU → rehab → discharge. Pure-Python regex extraction, no LLM.
📚 LLM-generated 7-section body Patient summary, functional baseline, 13 care-plan categories with annual costs, predictable complications, year-by-year cost projection, prognosis, review notes.
🔬 PubMed evidence grounding Every prognosis claim cites a real, recent peer-reviewed paper. Click any [PMID] in the report and verify.
⚠️ Pre-discharge red-flag audit Surfaces required-workup items the chart is missing. For our demo patient it caught 6 real gaps — 2 critical.
📊 NSCISC actuarial projection Life-expectancy + lifetime medical cost via Monte Carlo (10,000 simulations), rendered inline as a fan chart. The legally defensible spine.

Demo patient — Marcus Chen, 28M, C6 ASIA-A tetraplegia: Life expectancy 33.1 yr (95% CI 28.2–38.1) vs. 51.2 yr for the non-injured cohort — 18.1-year reduction. Lifetime medical cost: $8.01M median, 90% CI $5.16M–$11.5M.

The family summary

A plain-English, 6th-grade reading-level companion document — what the injury means, what to expect, daily care, equipment, costs, complications, self-care for caregivers. Generated in parallel with the clinical report.

How we built it

Architecture

                              Prompt Opinion
                       (patient context + FHIR creds)
                                    │
                                    │  A2A v1 protocol
                                    │  (SHARP fhir-context extension)
                                    ▼
              ┌───────────────────────────────────────────┐
              │       Lastmile External A2A Agent         │
              │                                           │
              │  generate_complete_lcp_report()  ← 1 tool │
              │                                           │
              │  1. Fetch FHIR DocumentReferences         │
              │  2. Classify injury domain                │
              │  3. Extract patient details (regex)       │
              │  4. PubMed E-utilities → 5 citations      │
              │  4b. SVG timeline (deterministic)         │
              │  4c. Red-flag audit (deterministic)       │
              │  5. NSCISC Monte Carlo (10K simulations)  │
              │  6+7. Gemini clinical + family (parallel) │
              │  8. Write 2 hosted HTML reports           │
              └───────────────────────────────────────────┘
                                    │
                                    ▼
                       chat-card with 2 clickable URLs

Built With

  • a2a-sdk
  • fhir-r4
  • gemini-2.5-flash
  • google-adk
  • html
  • httpx
  • litellm
  • matplotlib
  • monte-carlo
  • ncbi-e-utilities
  • ngrok
  • nscisc-actuarial-tables
  • numpy
  • pillow
  • prompt-opinion
  • pubmed-eutils
  • python
  • regex
  • starlette
  • svg
  • uvicorn
Share this project:

Updates