{"id":51609595,"url":"https://github.com/safetymp/asclepius","last_synced_at":"2026-07-12T06:02:26.411Z","repository":{"id":369370293,"uuid":"1289526788","full_name":"SafetyMP/Asclepius","owner":"SafetyMP","description":"Asclepius — a FHIR-native clinical data platform (reference implementation, NOT for clinical use).","archived":false,"fork":false,"pushed_at":"2026-07-12T01:49:45.000Z","size":530,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-12T02:11:03.389Z","etag":null,"topics":["clinical-data","fhir","fhir-r4","healthcare","healthcare-interoperability","hl7","hono","reference-implementation","typescript","zod"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SafetyMP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.md","maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-07-04T21:41:01.000Z","updated_at":"2026-07-12T01:49:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/SafetyMP/Asclepius","commit_stats":null,"previous_names":["safetymp/asclepius"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SafetyMP/Asclepius","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafetyMP%2FAsclepius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafetyMP%2FAsclepius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafetyMP%2FAsclepius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafetyMP%2FAsclepius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SafetyMP","download_url":"https://codeload.github.com/SafetyMP/Asclepius/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SafetyMP%2FAsclepius/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35383520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-12T02:00:06.386Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clinical-data","fhir","fhir-r4","healthcare","healthcare-interoperability","hl7","hono","reference-implementation","typescript","zod"],"created_at":"2026-07-12T06:02:25.487Z","updated_at":"2026-07-12T06:02:26.404Z","avatar_url":"https://github.com/SafetyMP.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asclepius — FHIR-native Clinical Data Platform\n\n[![CI](https://github.com/SafetyMP/Asclepius/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/SafetyMP/Asclepius/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/SafetyMP/Asclepius/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/SafetyMP/Asclepius/actions/workflows/codeql.yml)\n[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/SafetyMP/Asclepius/badge)](https://scorecard.dev/viewer/?uri=github.com/SafetyMP/Asclepius)\n[![License: Apache-2.0](https://img.shields.io/github/license/SafetyMP/Asclepius)](LICENSE)\n[![Node](https://img.shields.io/badge/node-%E2%89%A522-339933?logo=node.js\u0026logoColor=white)](#getting-started)\n\n\u003e ⚠️ **NOT FOR CLINICAL USE.** Asclepius is a **reference implementation** that\n\u003e demonstrates the architecture of a FHIR-native clinical data platform. It is\n\u003e **not** HIPAA-certified, **not** a regulated medical device, and its\n\u003e drug-interaction knowledge base is intentionally **incomplete**. Do **not**\n\u003e store, process, or base clinical decisions on real patient data with this\n\u003e software. See the [regulatory disclaimer](#regulatory-disclaimer) below.\n\nA from-scratch, layered implementation of the pillars of a clinical data\nplatform, built to be **correct and testable** rather than feature-complete.\nEvery architectural choice is documented with first-principles reasoning and an\nhonest \"better tool for production\" callout in [Architecture Decision Records](docs/adr/).\n\n## Status\n\nThis is a **partial implementation** — the foundation is real and tested; most\npillars are planned. The status column is the source of truth for what exists\ntoday.\n\n| Pillar                    | Implementation                                                                                                                                                                                                                                                                | Status                                                            |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |\n| FHIR R4 resource model    | Hand-authored zod schemas (single source of truth → inferred TS types); 9 resources, primitives, datatypes, Bundle, OperationOutcome                                                                                                                                          | ✅ Built                                                          |\n| Storage                   | `ResourceRepository` **port** + in-memory versioned adapter (immutable snapshots, history, soft delete)                                                                                                                                                                       | ✅ Built                                                          |\n| Storage (persistent)      | SQLite adapter via `better-sqlite3` (WAL, JSON columns); selected by `STORAGE=sqlite`                                                                                                                                                                                         | ✅ Built ([ADR 0004](docs/adr/0004-storage-sqlite-and-memory.md)) |\n| FHIR search               | Hand-built query-plan **compiler** (param types, modifiers, prefixes) + **executor** (path extraction, per-type matching, reference chaining, `_sort`/`_count`/`_page`)                                                                                                       | ✅ Built                                                          |\n| REST API                  | Hono HTTP adapter: create/read/vread/update(+create-on-update)/delete, ETag/Location/versioning, instance + type history Bundles, search (GET ?params + POST _search → searchset Bundle, incl. reference chaining + self/next/prev pagination links), OperationOutcome errors | ✅ Built ([ADR 0005](docs/adr/0005-hono-http.md))                 |\n| Validation                | zod structural validation + profile-level rules (Patient identity, Observation code system, MedicationRequest medication[x]); `$validate` operation (`POST /{Type}/$validate`) + create/update gating                                                                         | ✅ Built                                                          |\n| Clinical Decision Support | Composable rule DSL (pure functions `PatientContext → CdsCard[]`) + CDS Hooks endpoint (`POST /cds-services/:id`); MVP rules: drug-allergy + warfarin-NSAID bleeding risk                                                                                                     | ✅ Built ([ADR 0007](docs/adr/0007-cds-rule-dsl.md))              |\n| Drug–drug interactions    | In-memory knowledge base (6 RxNorm interactions) + bidirectional checker; `POST /MedicationRequest/$check-interactions` endpoint + DDI CDS rule                                                                                                                               | ✅ Built                                                          |\n| AuthN/AuthZ               | JWT (HS256, jose) + SMART-style scope middleware (`system/Patient.read`, `user/*.write`); dev-only `/auth/token` issuer (prod-disabled). Patient-compartment filtering + role-based overrides deferred                                                                        | ✅ Built ([ADR 0008](docs/adr/0008-jwt-and-smart-scopes.md))      |\n| Audit                     | Hash-chained, append-only, tamper-evident log (SHA-256 chain; in-memory + SQLite adapters; every request recorded via middleware)                                                                                                                                             | ✅ Built ([ADR 0009](docs/adr/0009-hash-chained-audit.md))        |\n\n## Architecture (ports \u0026 adapters)\n\n```\n        ┌─────────────────────── HTTP / CLI (entry) ────────────────────────┐\n        │  adapter/http · adapter/auth · adapter/audit                       │\n        └───────────────────────────────┼───────────────────────────────────┘\n                                        │ depends on ports only\n        ┌───────────────────────────────▼───────────────────────────────────┐\n        │  service: search · validation · cds · ddi   (application logic)    │\n        └───────────────────────────────┼───────────────────────────────────┘\n                                        │ depends on domain only\n        ┌───────────────────────────────▼───────────────────────────────────┐\n        │  domain: fhir resources · value objects · OperationOutcome         │\n        └───────────────────────────────┼───────────────────────────────────┘\n                                        │ port interfaces\n        ┌───────────────────────────────▼───────────────────────────────────┐\n        │  adapter/storage: in-memory · sqlite   (port implementations)      │\n        └───────────────────────────────────────────────────────────────────┘\n```\n\n_Target architecture — see the [Status](#status) table above for what is\nimplemented today (e.g. SQLite/HTTP/auth/audit adapters are not yet built)._\n\nDependencies point **inward**: `domain` depends on nothing; `service` depends on\n`domain` + `port`; adapters depend on `port` + `domain`. `src/app.ts` is the\nsingle composition root that wires adapters to services.\n\n## Getting started\n\nRequires **Node.js ≥ 22** (see `.nvmrc` for the dev version).\n\n```bash\nnpm install              # dependencies (builds better-sqlite3's native module)\nnpm run dev              # run via tsx (no compile step), hot reload\nnpm test                 # run the test suite\nnpm run gate             # format:check → lint → typecheck → test → build\n```\n\nThe project is configured for **max-strict TypeScript** (`strict`,\n`noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`, `verbatimModuleSyntax`).\nA change is not done until `npm run gate` is green.\n\n## Why these tools (and where there's a better one)\n\nEvery component choice is documented with its first-principles rationale and an\nhonest \"better tool for production\" callout in `docs/adr/`. Summary:\n\n- **TypeScript** — models FHIR's structural types; compiler verifies shape.\n  _Production FHIR servers: Java (HAPI) or .NET (Firely)._\n- **zod** — single source of truth for types + runtime validation.\n  _Full FHIR profiling: Firely validator._\n- **In-memory + SQLite** — zero-config real persistence + fast tests.\n  _Scale: Postgres + JSONB/GIN._\n- **Hono** — web-standard, portable, fast. _Larger ecosystem: Fastify._\n- **Hand-built search** — the hard core; no library does FHIR search correctly.\n  _Scale: Elasticsearch._\n- **CDS rule DSL** — testable pure functions. _Production: CQL._\n- **JWT + scopes** — models FHIR's resource/action access.\n  _Production: full SMART-on-FHIR OAuth2 via a real IdP._\n\nSee [`docs/adr/`](docs/adr/) for the full reasoning on each.\n\n## Contributing\n\nContributions are welcome. Please read [`CONTRIBUTING.md`](CONTRIBUTING.md)\n(the `npm run gate` requirement, code style, and the ADR-first decision process)\nbefore opening a pull request. For security issues, see [`SECURITY.md`](SECURITY.md)\n— **do not** file vulnerabilities as public issues.\n\n## Regulatory disclaimer\n\nAsclepius is a **reference / educational implementation**. It is **not** a\ncertified medical device, is **not** HIPAA- or HITRUST-compliant, and carries no\nwarranty of fitness for any clinical purpose. The DDI knowledge base is\nintentionally incomplete; missing interaction data is a patient-safety hazard.\n**Never** connect this software to real clinical systems, pharmacies, or EHRs,\nor use it to store or make decisions about real patient data.\n\n## License\n\nLicensed under the **Apache License, Version 2.0**. See [`LICENSE`](LICENSE) and\n[`NOTICE.md`](NOTICE.md). Unless required by applicable law or agreed to in\nwriting, software distributed under the License is distributed on an \"AS IS\"\nBASIS, **WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND**, express or implied.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafetymp%2Fasclepius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsafetymp%2Fasclepius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafetymp%2Fasclepius/lists"}