Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Health Intelligence Engine (HIE)

Build the intelligence layer for healthcare — not another healthcare app.

Healthcare data is fragmented across wearables, reports, hospitals and future national infrastructure. HIE unifies it behind one principle:

Every datasource is just a connector. The engine never changes.

Connectors
    ↓
Normalization Layer
    ↓
Canonical Health Events
    ↓
Timeline + Memory + Graph + Insights + Risk
    ↓
Developer SDK

Any startup building in this space can drop in the SDK (@hie/sdk) and get a timeline, health memory, semantic search, knowledge graph, insights and risk signals over their users' health data — without building any of it.

Repo layout

Package What it is
packages/sdk @hie/sdk — the engine itself. Pure TypeScript, zero runtime dependencies. Embed it in any product.
apps/api NestJS API exposing the engine over HTTP (ingestion + query endpoints).
apps/web Basic Next.js dashboard on top of the API.

Quickstart

npm install
npm run build:sdk

# terminal 1 — API on :4000
npm run api

# terminal 2 — dashboard on :3000
npm run web

Using the SDK directly

import { createHealthEngine } from '@hie/sdk';

const health = await createHealthEngine().init();

await health.ingest('manual', { metric: 'fasting glucose', value: 104, unit: 'mg/dL' });
await health.ingest('csv-import', csvText);
await health.ingest('pdf-report', { text: labReportText });
await health.ingest('apple-health', exportXml);
await health.ingest('fitbit', fitbitDayPayload);

health.timeline();       // unified, queryable timeline
health.search('sugar');  // semantic search (synonym-aware TF-IDF)
health.graph();          // knowledge graph of metrics/conditions/sources
health.insights();       // plain-language findings
health.trends();         // per-metric direction + slope
health.patterns();       // Phase 2: weekday/weekend & day-of-week structure
health.correlations();   // Phase 2: cross-metric Pearson correlations (lag 0/1)
health.recovery();       // Phase 2: HRV/RHR/sleep readiness score
health.risks();          // rule-based, factor-transparent risk signals
health.memory();         // durable health profile (latest values, conditions, meds)

Every datasource implements one interface:

interface HealthConnector {
  connect(config?)   // authorize / configure
  sync(input?)       // pull (or accept pushed) raw records
  normalize(raw)     // raw record → canonical HealthEvent[]
}

And everything in the engine runs on one canonical event:

interface HealthEvent {
  id: string
  source: string        // which connector produced it
  type: string          // vital | lab_result | sleep | activity | ...
  code?: string         // canonical metric, e.g. "glucose_fasting"
  timestamp: string
  payload: { value?, unit?, text?, ... }
  confidence: number
  version: number       // event-sourced: corrections append, never mutate
  supersedes?: string
}

The store is an append-only, versioned event log — full medical history stays reconstructable (health.asOf(date)), and corrections create new versions instead of overwriting (health.correct(id, patch) / health.eventHistory(id)).

Roadmap

✅ Phase 1 — MVP (no ABDM dependency)

  • Connectors: PDF reports, manual entries, Apple HealthKit (export.xml), Google Health Connect, CSV import
  • Features: timeline, health memory, semantic search, knowledge graph, AI insights, trend analysis

✅ Phase 2 — Consumer connectors

  • Connectors: Fitbit, Garmin, Oura (webhook/push-friendly for continuous sync)
  • Features: pattern detection, correlation engine, recovery tracking, streaming ingestion (health.onEvent(...))

🔜 Phase 3 — Enterprise & national infrastructure (upcoming)

  • Connectors: ABHA / ABDM, hospital EMRs, diagnostic labs, FHIR, HL7
  • Features: consent-based record fetch, hospital synchronization, enterprise APIs, longitudinal medical history, real-time medical event streaming

Phase 3 datasources require government/partner verification and registration (ABDM onboarding, EMR partnerships), so they ship later. Architecturally nothing changes:

Before:  PDF  → Normalize → Timeline → Insights
After:   ABDM → Normalize → Timeline → Insights

Only the connector changes. The engine remains unchanged.

Writing your own connector

import { BaseConnector, HealthEvent } from '@hie/sdk';

class MyClinicConnector extends BaseConnector<MyRawRecord> {
  readonly id = 'my-clinic';
  readonly label = 'My Clinic';
  readonly phase = 3 as const;

  async sync(input?: unknown): Promise<MyRawRecord[]> { /* fetch raw records */ }

  normalize(raw: MyRawRecord): HealthEvent[] {
    return [this.event({ name: raw.testName, value: raw.result, unit: raw.unit, timestamp: raw.date })];
  }
}

health.registerConnector(new MyClinicConnector());
await health.ingest('my-clinic');

Long-term vision

HIE starts as healthcare infrastructure. The same engine can later power personal assistants (health awareness in an assistant like Jarvis is just another consumer of health.memory() and health.insights()) — and any startup in the space can build on it as an SDK.

Risk and insight output is informational only and not medical advice.

About

Build the intelligence layer for healthcare - not another healthcare app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages