Codes
One source of truth for the FHIR systems and values you use.
FHIR resources are full of coded values: a code has a system and a code, an identifier has a system, an extension has a url. Get one of these strings wrong and a search silently returns nothing. Palamond solves this by publishing every FHIR coordinate with the SDK, as @palamond/sdk/codes, and asking you to import from it instead of typing the strings by hand.
Why a single source of truth
The coordinates that matter (code-system URLs, extension URLs, identifier systems, tag values) are the contract between your app and the platform. Both sides must agree on them exactly. A magic string copied into three files drifts the moment one copy changes.
@palamond/sdk/codes is the one place those coordinates are defined, published from the same source the platform itself uses. When a value changes, it changes once, and every caller that imported it moves with it. Reference the shared coordinates, do not hardcode them.
Treat the codes module the way you treat an enum. The literal strings are an implementation detail. Your code should name the concept, not repeat the value.
Searching with codes
The token helpers build the system|code search tokens for you. A search for heart-rate observations:
import { loinc } from '@palamond/sdk/codes';
await palamond.searchResources('Observation', {
code: loinc('8867-4'),
});searchToken does the same for any coding constant, such as the tag marking the patient's own tasks:
import { PATIENT_TASK_TAG, searchToken } from '@palamond/sdk/codes';
await palamond.searchResources('Task', {
_tag: searchToken(PATIENT_TASK_TAG),
});Your search shares its definition with the platform that wrote the record, so they cannot disagree.
What the module covers
The shared codes cover every Palamond-defined coordinate, including:
- Code-system URLs, such as
LOINC_SYSTEM,ICD10CM_SYSTEM,RXNORM_SYSTEM, andSNOMED_CT_SYSTEMfor clinical terminologies. - Extension URLs for the platform's custom fields (appointment-scoped patient tasks, order destinations, reschedule links, and more). FHIR has no native field for these, so the extension URL is the contract.
- Identifier systems for stable business keys (organizations, episodes, care-team queues, and the idempotency keys platform automation uses).
meta.tagvalues that mark audience or visibility, such as the tag distinguishing patient-facing tasks from clinician workflow tasks, and the tag marking a catalog entry public.- Small code sets with typed values (encounter modality, order fulfillment methods, spine steps, consent decisions).
- Search-token helpers (
loinc,snomed,rxnorm,icd10cm,searchToken) that buildsystem|codetokens for FHIR searches.
Each constant is documented at its definition with what it means and where it is stamped, so the module doubles as a reference for the data model.
The rule
When you need a system, an extension url, an identifier system, or a tag, import it from @palamond/sdk/codes. Do not paste the literal. This keeps your app in lockstep with the platform, and it means a coordinate change is a one-line update, not a hunt through your codebase.
Next
- FHIR Basics - Where systems and codes appear in resources.
- Codes Reference - The full list of coordinates.
- Conventions - Other platform conventions worth following.