FhirEx.Types.Primitives (fhir_ex v0.2.0)

Copy Markdown View Source

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

fhir_base64_binary()

@type fhir_base64_binary() :: String.t()

A stream of bytes, base64-encoded (RFC 4648).

fhir_boolean()

@type fhir_boolean() :: boolean()

A boolean value: true or false.

fhir_canonical()

@type fhir_canonical() :: String.t()

A canonical URI that refers to a resource by its canonical URL.

fhir_code()

@type fhir_code() :: String.t()

A string that references a defined set of codes (e.g., a ValueSet). Codes are case-sensitive. No whitespace.

fhir_date()

@type fhir_date() :: String.t()

A date in the format YYYY, YYYY-MM, or YYYY-MM-DD. No timezone. Example: "2024-01-15"

fhir_date_time()

@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"

fhir_decimal()

@type fhir_decimal() :: float()

A rational number with implicit precision (JSON number). Represented as float.

fhir_id()

@type fhir_id() :: String.t()

Any combination of upper or lower case ASCII letters, digits, "-" and ".", 1–64 chars.

fhir_instant()

@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"

fhir_integer()

@type fhir_integer() :: integer()

A signed 32-bit integer.

fhir_markdown()

@type fhir_markdown() :: String.t()

A string with optional markdown formatting (GitHub Flavored Markdown).

fhir_oid()

@type fhir_oid() :: String.t()

An OID represented as "urn:oid:" followed by the dotted notation. Example: "urn:oid:2.16.840.1"

fhir_positive_int()

@type fhir_positive_int() :: pos_integer()

A positive integer (1 or greater).

fhir_string()

@type fhir_string() :: String.t()

A UTF-8 string. Must not start/end with whitespace, no empty strings.

fhir_time()

@type fhir_time() :: String.t()

A time during the day in the format hh:mm:ss (no timezone). Example: "09:32:00"

fhir_unsigned_int()

@type fhir_unsigned_int() :: non_neg_integer()

A non-negative integer (0 or greater).

fhir_uri()

@type fhir_uri() :: String.t()

A Uniform Resource Identifier (RFC 3986). May be relative.

fhir_url()

@type fhir_url() :: String.t()

A URL — an absolute URI that identifies a location (RFC 1738).

fhir_uuid()

@type fhir_uuid() :: String.t()

A UUID represented as "urn:uuid:" followed by the UUID. Example: "urn:uuid:c757873d-ec9a-4326-a141-556f43239520"

fhir_xhtml()

@type fhir_xhtml() :: String.t()

A string of limited XHTML content (for Narrative.div).