FhirEx.Types.Ratio (fhir_ex v0.3.0)

Copy Markdown View Source

FHIR R5 Ratio data type.

A relationship of two Quantity values expressed as a numerator and a denominator. Used in lab results (e.g., INR, titers) and medication dosages.

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

Example

# INR ratio
%Ratio{
  numerator: %Quantity{value: 1.5, unit: "1", system: "http://unitsofmeasure.org", code: "1"},
  denominator: %Quantity{value: 1.0, unit: "1", system: "http://unitsofmeasure.org", code: "1"}
}

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

t()

@type t() :: %FhirEx.Types.Ratio{
  denominator: FhirEx.Types.Quantity.t() | nil,
  numerator: FhirEx.Types.Quantity.t() | 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(r)

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

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