Rust Healthcare terminology Apache-2.0

SNOMED CT for Rust

A local-first Rust workspace for working with SNOMED CT, the international clinical terminology used in electronic health records: parse official RF2 release files, validate SCTIDs, build an in-memory snapshot store, run hierarchy and subsumption queries, evaluate ECL queries, answer FHIR terminology-service operations, parse OWL axioms, and classify them — all with zero external dependencies.

License note

Workspace layout

Nine crates, each scoped to one layer of the RF2 → store → ECL/FHIR/OWL pipeline.

Crate Purpose
snomed Facade: re-exports everything, prelude, end-to-end tests
snomed-core SCTID parse/validate/compose (Verhoeff check digit), EffectiveTime, Concept/Description/Relationship, well-known constants
snomed-rf2 RF2 file name parsing, Full/Snapshot/Delta types, streaming typed reader, reference set members
snomed-store Snapshot builder, IS-A hierarchy, ancestors/descendants/subsumption, HistoryStore for point-in-time queries
snomed-ecl Expression Constraint Language: lexer, parser, evaluator for simple constraints + basic refinements
snomed-fhir FHIR terminology service building blocks: $subsumes, $lookup, $expand
snomed-owl Parser for the OWL 2 functional-syntax subset used in the OWL Expression reference set
snomed-classify EL-profile subsumption classifier plus necessary normal form (RF2 relationship) generation
snomed-cli snomed-cli binary: sctid, load, lookup, ecl, export, validate, classify, nnf subcommands

Quick start

use snomed::prelude::*;

// Identify what a release file contains from its name.
let f = ReleaseFileName::parse("sct2_Concept_Snapshot_INT_20250801.txt")?;
assert_eq!(f.release_type, ReleaseType::Snapshot);

// Validate an SCTID, check digit and all.
let id = SctId::parse("22298006")?; // |Myocardial infarction|
assert_eq!(id.component_type(), Some(ComponentType::Concept));

// Stream typed records from any RF2 file.
let file = std::io::BufReader::new(std::fs::File::open("sct2_Concept_Snapshot_INT_20250801.txt")?);
let mut builder = SnapshotStore::builder();
for concept in Rf2Reader::<_, Concept>::new(file)? {
    builder.add_concept(concept?);
}

Where this fits

The SNOMED CT software ecosystem spans several tiers: terminology servers exposing FHIR APIs, browsers for exploring hierarchies, authoring platforms such as Snow Owl for building national extensions, and local developer toolchains that turn raw RF2 data dumps into queryable structures on your own machine. This workspace targets that last tier — a typed, tested Rust foundation you can embed in CLIs, services, or analytics pipelines.

Read the docs

Documentation map: spec / crate-README / AGENTS layers, plus a worked example spanning four crates.

Follow the tutorial

A guided, runnable, six-step walkthrough you can run with cargo run --example tutorial -p snomed.

RF2 spec distillation

A project-local distillation of the official RF2 Release File Specification — the normative reference for this codebase.