FhirEx.Types.Quantity (fhir_ex v0.2.0)

Copy Markdown View Source

FHIR R5 Quantity data type.

A measured or measurable amount. Used for lab result values, dosages, etc.

https://www.hl7.org/fhir/R5/datatypes.html#Quantity

Comparator codes: < | <= | >= | > | ad

Example

# Hemoglobin level
%Quantity{
  value: 14.5,
  unit: "g/dL",
  system: "http://unitsofmeasure.org",
  code: "g/dL"
}

# White blood cell count
%Quantity{
  value: 6.8,
  unit: "10*3/uL",
  system: "http://unitsofmeasure.org",
  code: "10*3/uL"
}

Summary

Functions

Builds the struct from a string-keyed map (e.g., from decoded FHIR JSON).

Builds a new struct from a map or keyword list of field values.

Converts the struct to a string-keyed map for use with FhirEx.JSON.

Types

comparator()

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

t()

@type t() :: %FhirEx.Types.Quantity{
  code: String.t() | nil,
  comparator: comparator() | nil,
  system: String.t() | nil,
  unit: String.t() | nil,
  value: float() | nil
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Builds the struct from a string-keyed map (e.g., from decoded FHIR JSON).

new(attrs \\ %{})

@spec new(map() | keyword()) :: t()

Builds a new struct from a map or keyword list of field values.

to_map(q)

@spec to_map(t()) :: map()

Converts the struct to a string-keyed map for use with FhirEx.JSON.