SHC vNext QR proof of concept
SHA-256 Extension · 0x00 0 WASM imports · 0 floats Embedded 8,207-concept SNOMED CT IPS + EDQM + LOINC dictionary

International Patient Summary (IPS)

HL7 FHIR R4 International Patient Summary (document Bundle + Composition) with 8,207 verified SNOMED CT IPS Free Set, EDQM, and LOINC terms BPE-compressed right inside the WASM module.

WASM module243,809 Bips-summary.wasm
Card sizes109–322 Bacross 4 sample records
Max FHIR ÷ card99×deterministic FHIR R4 output
Best QR versionVersion 7-Lup to Version 13-L

Try live in Viewer (complex-multimorbid) Download WASM (by hash) View model.d.ts

Quick launch any sample record in the universal viewer:

complex-multimorbid pediatric-asthma prenatal-summary healthy-minimal

Card header
0x00 followed by the 32-byte SHA-256 digest of the WebAssembly module (35 bytes total card framing including the 2-byte SHA-256 check)
SHA-256
47dbedbe2b671d9751de871f22506ebc0120da1ea798a26f113c6da61df98e74 (download by hash)
WASM exports
memory, shc_alloc, shc_decode, shc_encode (0 host imports)
Machine-readable files
model.d.ts · codecs/ips-summary/ips-summary.wasm · Source on GitHub

Sample records & benchmarks (4)

Each sample record below was encoded at build time by ips-summary.wasm, wrapped in a SHA-256 content-addressed card (0x00 || sha256), and decoded back into a FHIR R4 Bundle. Click any record name to open its live QR card in the universal viewer.

RecordCard & QR (L / M)FHIR JSONDEFLATE (L9)FHIR ÷ cardDownloads
complex-multimorbidComplex older adult traveler (68 yo, 41 FHIR resources) 322 BVersion 13-L / Version 15-M 31,782 B41 entries 3,766 Bfits none 99× model.json · card.txt · fhir.json
pediatric-asthmaPediatric asthma & severe peanut allergy (9 yo) 196 BVersion 10-L / Version 11-M 13,757 B18 entries 2,332 BVersion 36-L 70× model.json · card.txt · fhir.json
prenatal-summaryPregnant traveler IPS with obstetrics & Rh status (31 yo) 183 BVersion 9-L / Version 11-M 14,938 B18 entries 2,387 BVersion 37-L 82× model.json · card.txt · fhir.json
healthy-minimalHealthy adult traveler minimal IPS (34 yo) 109 BVersion 7-L / Version 9-M 6,777 B9 entries 1,512 BVersion 29-L 62× model.json · card.txt · fhir.json

Technical specification & format

Rendered from codecs/ips-summary/README.md in the repository.

A standalone, zero-import, #![no_std] WebAssembly codec (0x00 || sha256(wasm)) for the HL7 FHIR R4 International Patient Summary (IPS) with 8,207 real official SNOMED CT IPS Free Set + EDQM + LOINC + IPS Absent/Unknown concepts embedded directly inside ips-summary.wasm.

  • Module size: 243,809 bytes (238.1 KiB)
  • Module SHA-256: 47dbedbe2b671d9751de871f22506ebc0120da1ea798a26f113c6da61df98e74
  • CODEC-ABI v0.1 audit: 0 violations, 0 imports, 0 floats, 0 SIMD/threads, link-time zero-panic proof (#![forbid(unsafe_code)] in ips_summary_core)
  • Exports: memory (max 16,384 pages / 1 GiB), shc_alloc, shc_decode, shc_encode

Embedded Official HL7 IPS Terminology Table (8,207 Unique Concepts)

Harvested and verified live via scripts/fetch-ips-vocab.ts against https://r4.ontoserver.csiro.au/fhir and https://tx.fhir.org/r4:

Terminology / IPS SubsetVerified ConceptsWire Index (Primary Section)
SNOMED CT IPS Free Set — Problems (problems-snomed-ct-ips-free-set)5,62213 bits
SNOMED CT IPS Free Set — Procedures (procedures-snomed-ct-ips-free-set)69010 bits
SNOMED CT IPS Vaccines (vaccines-uv-ips ∪ vaccines-snomed-ct-ips-free-set)2438 bits
SNOMED CT IPS Medical Devices (medical-devices-snomed-ct-ips-free-set)727 bits
SNOMED CT Blood Group, Presence/Absence, Target Diseases, Pregnancy/Smoking566 bits
SNOMED CT Common Medications (International Edition < 763158003)4069 bits
SNOMED CT Common Allergen Substances (International Edition < 105590001)2438 bits
SNOMED CT Allergy Reactions (allergy-reaction-gps-uv-ips ∪ curated < 404684003)556 bits
EDQM Dose Forms (medicine-doseform)62510 bits
EDQM Routes of Administration (medicine-route-of-administration)857 bits
Core Clinical LOINC Lab, Vital, OB & IPS Document Observations1818 bits
HL7 IPS Absent/Unknown (absent-unknown-uv-ips)1514 bits (global)
Global Deduplicated Total8,207131.8 KiB compressed

Storage & Lookup Design (rust/core/src/vocab.rs + vocab_data.rs):

  • Codes: Sorted numeric SNOMED CT (u64) and EDQM (u32) codes stored in 64-entry blocks with ULEB128 deltas (20.0 KB for 7,301 SNOMED SCTIDs — 2.74 B/code); LOINC and IPS Absent codes stored sorted for O(log N) binary search.
  • Displays: All 8,207 displays sorted lexicographically, blocked front-coded (block size 64), and compressed with 158-rule recursive Byte-Pair Encoding (BPE) (229,924 B raw → 159,168 B front-coded → 89,421 B front-coded + BPE).
  • Performance: O(log N) binary search on encode, O(64) bounded non-recursive decompression on decode (<0.05 ms per concept, ~1.6–2.5 ms total per full IPS Bundle).
  • Lossless Escape Hatch: Any CodeableConcept outside the 8,207 embedded concepts (e.g., RxNorm, ICD-10-CM, ATC, multi-coding concepts, custom displays, or text-only { text: "..." }) falls back cleanly to lossless inline encoding.

Showcase Benchmarks (SHA-256 Content-Addressed Cards)

Each SHA-256 card carries the full content-addressed framing (0x00 + 32-byte sha256(wasm) + raw codec payload + 2-byte SHA-256 check = payload + 35 bytes):

SampleResourcesFHIR JSON BDEFLATE BPayload BSHA-256 Card BQR Version-LRatio vs FHIRRatio vs DEFLATE
complex-multimorbid4131,7823,766287322V12-L98.7×11.7×
pediatric-asthma1813,7572,332161196V9-L70.2×11.9×
prenatal-summary1814,9382,387148183V9-L81.6×13.0×
healthy-minimal96,7771,51274109V6-L62.2×13.9×

Output Structure (shc_decode)

shc_decode verifies strict canonical form (re-encoding the decoded model must match the input bytes bit-for-bit) and emits a deterministic minified HL7 FHIR R4 IPS Document Bundle (type: "document"):

  • Entry 0: Composition (LOINC 60591-5 Patient summary Document, title: "International Patient Summary", subject: Patient/0, author: Organization/1, mandatory IPS sections 48765-2 Allergies, 10160-0 Medications, 11450-4 Problems with standard "No known ..." narrative + nilknown emptyReason when empty, plus optional 11369-6 Immunizations, 47519-4 Procedures, 30954-2 Results, 46264-8 Medical Devices).
  • Patient/0, Organization/1 (and optional custodian Organization/2).
  • AllergyIntolerance, MedicationStatement (with contained Medication carrying EDQM form when doseForm is present), Condition, Immunization, Procedure, Observation (auto-categorized into vital-signs vs laboratory), and Device + DeviceUseStatement resources.

Bounds & Safety

All allocations and counts are strictly bounded to guarantee total, deterministic termination on arbitrary untrusted byte streams:

  • Input card: ≤ 4,096 bytes
  • given ≤ 8, problems ≤ 64, allergies ≤ 64, medications ≤ 64, immunizations ≤ 64, procedures ≤ 64, results ≤ 128, devices ≤ 32, escape codings ≤ 8, strings ≤ 512 bytes.

Build & Test

# Re-fetch official terminologies from Ontoserver & tx.fhir.org (or pass --gen to regenerate from snapshot)
bun codecs/ips-summary/scripts/fetch-ips-vocab.ts --gen

# Build ips-summary.wasm (requires rustup stable + wasm32-unknown-unknown)
bash codecs/ips-summary/rust/build.sh

# Run ABI audit, lossless round-trip, escape, fuzzing, and benchmark tests
bun test codecs/ips-summary/ips-summary.test.ts