SHC vNext QR proof of concept
SHA-256 Extension · 0x00 0 WASM imports · 0 floats 2D spatial anatomical differential coding (32 teeth × 6 sites)

Dental & Periodontal Exam

Full 32-tooth adult restorative and 6-site periodontal charting using arch-order spatial prediction, expanding to FHIR R4 Observation bundles plus computed AAP/EFP summary metrics.

WASM module38,290 Bdental-chart.wasm
Card sizes147–248 Bacross 4 sample records
Max FHIR ÷ card982×deterministic FHIR R4 output
Best QR versionVersion 8-Lup to Version 11-L

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

Quick launch any sample record in the universal viewer:

stage3-periodontitis restorative-implants caries-recall healthy-adult

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
5068296198af4824ac326e7f50718830b2552e5456a37518d7f1d26d76947335 (download by hash)
WASM exports
memory, shc_alloc, shc_decode, shc_encode (0 host imports)
Machine-readable files
model.d.ts · codecs/dental-chart/dental-chart.wasm · Source on GitHub

Sample records & benchmarks (4)

Each sample record below was encoded at build time by dental-chart.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
stage3-periodontitisStage III periodontitis with furcations, mobility & deep pockets 248 BVersion 11-L / Version 13-M 196,513 B72 entries 5,186 Bfits none 792× model.json · card.txt · fhir.json
restorative-implantsExtensive crowns, implants, root canals & composite fillings 189 BVersion 10-L / Version 11-M 185,560 B75 entries 4,850 Bfits none 982× model.json · card.txt · fhir.json
caries-recallRoutine recall with interproximal caries & localized gingivitis 181 BVersion 9-L / Version 11-M 145,623 B74 entries 4,257 Bfits none 805× model.json · card.txt · fhir.json
healthy-adultHealthy adult 28-tooth dentition (wisdom teeth absent) 147 BVersion 8-L / Version 10-M 137,187 B66 entries 3,912 Bfits none 933× model.json · card.txt · fhir.json

Technical specification & format

Rendered from codecs/dental-chart/README.md in the repository.

Content-addressed (0x00 || sha256(wasm)) SHA-256 extension codec conforming to CODEC-ABI.md v0.1.

Encodes a complete 32-tooth adult periodontal and restorative dental examination (6-site probing depths, 6-site gingival margins, 6-site bleeding on probing, Miller mobility grades, furcation grades, active caries surfaces, and restorations/implants/endodontic findings) into 112–213 bytes (QR Version 8–10 at EC Level L, including the 33-byte SHA-256 codec header and 2-byte card check), expanding deterministically in zero-float, zero-panic #![no_std] WebAssembly into 66–75 rich FHIR R4 resources (137–197 KB of FHIR JSON).

WASM Artifact

PropertyValue
Binarycodecs/dental-chart/dental-chart.wasm
Size38,290 bytes (37.4 KiB)
SHA-2565068296198af4824ac326e7f50718830b2552e5456a37518d7f1d26d76947335
auditWasm violations0 (0 imports, 0 floats, 0 SIMD/threads, no start function, max memory 16,384 pages)
Core safety#![no_std], #![forbid(unsafe_code)], link-time zero-panic guard

Measured Benchmarks (4 Clinical Showcase Samples)

SampleFHIR ResourcesFHIR JSON (B)Raw DEFLATE-9 (B)Codec Input (B)SHA-256 Card (B)QR Version-LRatio vs FHIRDecode Time
healthy-adult66137,1873,912112147V8-L (49×49)933×~2–3 ms
stage3-periodontitis72196,5135,186213248V10-L (57×57)792×~3 ms
restorative-implants75185,5604,850154189V9-L (53×53)982×~2–4 ms
caries-recall74145,6234,257146181V8-L (49×49)805×~2–4 ms

(SHA-256 Card = 1 byte 0x00 + 32 bytes sha256(dental-chart.wasm) + codec input + 2 bytes SHA-256 check = codec input + 35 bytes.)

Compression Design: 2D Spatial Arch Differential Coding + Adaptive Range Coder

  1. Format version byte (0x01) followed by a canonical 16-bit binary range-coded bitstream.
  2. Metadata: examDate (days since 2000-01-01), optional patient (family, up to 4 given names, birthDate since 1900-01-01), optional provider.name, optional note (≤ 128 UTF-8 bytes) encoded via a 256-symbol adaptive UTF-8 segment-tree model initialized with an ASCII clinical-text prior.
  3. 32-tooth status vector: Adaptive context split between wisdom teeth (#1, #16, #17, #32) and non-wisdom teeth (#2..15, #18..31).
  4. 2D Spatial Arch Walk for Probing Depths (0..15 mm) & Gingival Margins (-10..+10 mm):
    • Sites are traversed in anatomically contiguous order across all four arch sweeps:
      • Maxillary Buccal (#1→#16: Q1 DB→B→MB, Q2 MB→B→DB)
      • Maxillary Lingual (#16→#1: Q2 DL→L→ML, Q1 ML→L→DL)
      • Mandibular Buccal (#17→#32: Q3 DB→B→MB, Q4 MB→B→DB)
      • Mandibular Lingual (#32→#17: Q4 DL→L→ML, Q3 ML→L→DL)
    • Consecutive deltas d[i] - d[i-1] are coded with a truncated adaptive frequency model restricted to the exact legal range (0..15 for probing, -10..+10 for margin) conditioned on anatomical transition context (interproximal→interproximal, interproximal→mid, mid→interproximal) to capture the classic 3-2-3 gingival contour.
  5. Depth-Conditioned BOP Coding: Bleeding-on-probing bits walk the same continuous arch, conditioned on (probing_depth_bucket ∈ {≤3, 4–5, ≥6}, prev_bop).
  6. Mobility, Furcation, Caries & Restorations: Furcation is conditioned on single- vs multi-rooted tooth anatomy; restoration kinds are conditioned on tooth status (e.g. pontic on missing teeth); surface bitmasks (M, O, D, B, L) omit the last bit when bits 0–3 are all zero.
  7. Bijective Canonicality: shc_decode verifies that re-encoding the decoded chart reproduces the input bytes identically, rejecting trailing padding or non-canonical streams with MALFORMED.

FHIR R4 Output (shc_decode)

Emits a deterministic minified FHIR R4 Bundle (type: "collection"):

  • Patient (id: "0", fullUrl: "resource:0")
  • Optional Practitioner (id: "1", fullUrl: "resource:1")
  • Deterministic zero-float Periodontal Summary Observation (id: "perio-summary"): teeth present, missing, implants, sites probed, BOP % (1 decimal place), sites ≥ 4 mm, sites ≥ 6 mm, max probing depth (mm), active caries tooth count, and optional exam note.
  • Per charted tooth N (Universal 1..32), every Observation.bodySite carries SNOMED CT permanent tooth structure SCTID, ISO 3950 FDI (urn:iso:std:iso:3950), and ADA Universal tooth codings:
    • tooth-<N>: Tooth status (present, missing, implant, unerupted, root-tip)
    • perio-<N>: 6-site Periodontal Probing Depth (code: SNOMED 736535008), with probing-*, margin-*, bop-*, mobility, and furcation components when present
    • caries-<N>: Active Dental Caries (code: SNOMED 80967001) with affected surfaces
    • restoration-<N>-<idx>: Existing restoration / endodontic finding with optional surfaces

Build & Test

# Build dental-chart.wasm (requires rustup stable + wasm32-unknown-unknown target; uses wasm-opt if on PATH)
bash codecs/dental-chart/rust/build.sh

# Run full audit, round-trip, fuzz, and benchmark suite
bun test codecs/dental-chart/dental-chart.test.ts