Inspiration

Most health apps treat the body and mind as separate products, steps in one app, mood in another, lab PDFs in your email. Meanwhile, NHS guidance is excellent but scattered across dozens of pages, and generic AI chatbots often sound confident without citing anything real.

We built HealthLongi because early prevention should feel human, trustworthy, and NHS-aligned, not like another black-box wellness bot. We wanted a single place where Apple Health, validated questionnaires, and lab results come together into a calm “what to watch this week” view, with every recommendation tied to real NHS patient guidance.

What it does

HealthLongi is an iOS app that:

  • Reads Apple Health data (steps, sleep, resting heart rate, activity trends, and more)
  • Runs validated mental health check-ins (PHQ-9, GAD-7, plus wellbeing/stress/alcohol screens)
  • Accepts lab results (manual entry or import) for metabolic and cardiovascular signals
  • Calculates on-device risk snapshots across heart, mind, and metabolic health
  • Generates an AI health summary with a watchlist, NHS-cited preventive steps, and linked resources
  • Shows trends, a body map of domain status, and GP visit brief export to help users prepare for appointments

Scoring and storage stay on the device. AI receives health metrics and curated NHS excerpts, not your name or NHS number. Crisis routing (e.g. NHS 111) is handled by on-device safety rules, not the model.

How we built it

We used SwiftUI + SwiftData with a clean, protocol-oriented architecture:

  • HealthKit for live metrics and 30-day trend digests
  • RiskCalculator for cardiovascular, metabolic, and mental health scoring (including lab-derived signals and cross-domain correlations)
  • NHSKnowledgeBase a curated set of NHS topics (URLs, excerpts, thresholds) injected into prompts
  • Z.ai / GLM via OpenRouter (Bedrock BYOK) for structured JSON insights — watch items, actions, and references that must cite valid nhsTopicIds
  • On-device validation strips any AI output that references unknown topics; offline fallback uses the same NHS knowledge base
  • AssessmentOrchestrator coordinates HealthKit fetch → scoring → AI → SwiftData persistence

We also built supporting features during the hack: lab report OCR/import, demo health scenarios, expandable dashboard summary, domain detail sheets, and AI debug logging for rapid iteration.

Challenges we ran into

  • Trustworthy AI - Health advice can’t be invented. We moved from a thin “risk boolean” prompt to full-context, NHS-grounded structured output with server-side validation of every citation.
  • HealthKit reality - Simulator limits, permission flows, and missing data required graceful fallbacks and clear “data used” transparency in the UI.
  • UX density - Rich AI output made the dashboard too long; we collapsed details behind Show More while keeping risk badges and a short summary visible.
  • SwiftData evolution - Schema changes during a hack meant careful handling of persisted assessments and new aiInsightJSON fields.

Accomplishments that we're proud of

  • A hybrid engine: rules for safety and scoring, AI for holistic narrative, not one or the other
  • NHS-grounded recommendations with linked resources, not generic wellness tips
  • End-to-end pipeline from HealthKit + questionnaires + labs → dashboard → GP brief
  • Provider-flexible AI layer (GLM) with structured persistence and tests
  • A polished NHS-themed UI that explains what data was used and how the summary was written

What we learned

  • For health AI, citation beats eloquence, curated knowledge + strict JSON schema beats a long free-text prompt
  • Users need transparency: an info sheet showing data sources, scoring logic, and NHS references builds more trust than a slick summary alone
  • On-device first is feasible: send metrics, not identity; validate model output before showing it
  • Hackathon AI integration is as much workflow engineering (logging, fallbacks, retries) as prompt writing

What's next for HealthLongi

  • Android / cross-platform companion for non-iPhone users
  • Deeper NHS service integration (talking therapies self-referral flows, localized content)
  • Clinician-facing export (structured PDF summaries with consent controls)
  • More longitudinal insights, comparing assessments over weeks, not just snapshots
  • Expanded lab and wearable support (HbA1c trends, blood pressure home monitoring)
  • Localization beyond UK NHS (starting with evidence-based public health sources per region)

Built With

Share this project:

Updates