Primitive Type

FHIR primitive types are a single value. In Gleam, primitive types are record fields with a single value, rather than with child fields. For example, the Patient resource has a Patient.active boolean element, which in Gleam is a Bool in resources.Patient.

Patient.active

import fhir/r4/resources
import gleam/option.{Some}

pub fn main() {
  let pat = resources.patient_new()
  let pat = resources.Patient(..pat, active: Some(False))
  echo pat.active
}

Time is represented in valid FHIR formats with primitive types for date, dateTime, instant, and time.

A code field can be either an enum from valuesets if the field has a required binding, or a String if not.

Primitive TypeIn Gleam
base64BinaryString
booleanBool
canonicalString
codeenum if required binding, otherwise String
datefhir/primitive_types.Date
dateTimefhir/primitive_types.DateTime
decimalFloat
idString
instantfhir/primitive_types.Instant
integerInt
integer64String
markdownString
oidString
stringString
positiveIntInt
timefhir/primitive_types.Time
unsignedIntInt
uriString
urlString
uuidString
Search Document