FHIR R5 primitive type definitions as Elixir typespecs.
All dates and times are represented as strings in FHIR's ISO 8601 format, matching how they appear in FHIR JSON serialization.
Examples
@spec birth_date() :: FhirEx.Types.Primitives.fhir_date()
def birth_date, do: "1985-04-23"
@spec created_at() :: FhirEx.Types.Primitives.fhir_instant()
def created_at, do: "2024-01-15T09:32:00.000Z"
Summary
Types
A stream of bytes, base64-encoded (RFC 4648).
A boolean value: true or false.
A canonical URI that refers to a resource by its canonical URL.
A string that references a defined set of codes (e.g., a ValueSet). Codes are case-sensitive. No whitespace.
A date in the format YYYY, YYYY-MM, or YYYY-MM-DD. No timezone. Example: "2024-01-15"
A date, date-time or partial date in the format YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DDThh:mm:ss+zz:zz. Example: "2024-01-15T09:32:00+00:00"
A rational number with implicit precision (JSON number). Represented as float.
Any combination of upper or lower case ASCII letters, digits, "-" and ".", 1–64 chars.
An instant in time in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. Must include a timezone. Microseconds are allowed. Example: "2024-01-15T09:32:00.000Z"
A signed 32-bit integer.
A string with optional markdown formatting (GitHub Flavored Markdown).
An OID represented as "urn:oid:" followed by the dotted notation. Example: "urn:oid:2.16.840.1"
A positive integer (1 or greater).
A UTF-8 string. Must not start/end with whitespace, no empty strings.
A time during the day in the format hh:mm:ss (no timezone). Example: "09:32:00"
A non-negative integer (0 or greater).
A Uniform Resource Identifier (RFC 3986). May be relative.
A URL — an absolute URI that identifies a location (RFC 1738).
A UUID represented as "urn:uuid:" followed by the UUID. Example: "urn:uuid:c757873d-ec9a-4326-a141-556f43239520"
A string of limited XHTML content (for Narrative.div).
Types
@type fhir_base64_binary() :: String.t()
A stream of bytes, base64-encoded (RFC 4648).
@type fhir_boolean() :: boolean()
A boolean value: true or false.
@type fhir_canonical() :: String.t()
A canonical URI that refers to a resource by its canonical URL.
@type fhir_code() :: String.t()
A string that references a defined set of codes (e.g., a ValueSet). Codes are case-sensitive. No whitespace.
@type fhir_date() :: String.t()
A date in the format YYYY, YYYY-MM, or YYYY-MM-DD. No timezone. Example: "2024-01-15"
@type fhir_date_time() :: String.t()
A date, date-time or partial date in the format YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DDThh:mm:ss+zz:zz. Example: "2024-01-15T09:32:00+00:00"
@type fhir_decimal() :: float()
A rational number with implicit precision (JSON number). Represented as float.
@type fhir_id() :: String.t()
Any combination of upper or lower case ASCII letters, digits, "-" and ".", 1–64 chars.
@type fhir_instant() :: String.t()
An instant in time in the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. Must include a timezone. Microseconds are allowed. Example: "2024-01-15T09:32:00.000Z"
@type fhir_integer() :: integer()
A signed 32-bit integer.
@type fhir_markdown() :: String.t()
A string with optional markdown formatting (GitHub Flavored Markdown).
@type fhir_oid() :: String.t()
An OID represented as "urn:oid:" followed by the dotted notation. Example: "urn:oid:2.16.840.1"
@type fhir_positive_int() :: pos_integer()
A positive integer (1 or greater).
@type fhir_string() :: String.t()
A UTF-8 string. Must not start/end with whitespace, no empty strings.
@type fhir_time() :: String.t()
A time during the day in the format hh:mm:ss (no timezone). Example: "09:32:00"
@type fhir_unsigned_int() :: non_neg_integer()
A non-negative integer (0 or greater).
@type fhir_uri() :: String.t()
A Uniform Resource Identifier (RFC 3986). May be relative.
@type fhir_url() :: String.t()
A URL — an absolute URI that identifies a location (RFC 1738).
@type fhir_uuid() :: String.t()
A UUID represented as "urn:uuid:" followed by the UUID. Example: "urn:uuid:c757873d-ec9a-4326-a141-556f43239520"
@type fhir_xhtml() :: String.t()
A string of limited XHTML content (for Narrative.div).