FhirEx.Resources.Patient (fhir_ex v0.3.0)

Copy Markdown View Source

FHIR R5 Patient resource.

Demographics and other administrative information about an individual receiving care or other health-related services.

https://www.hl7.org/fhir/R5/patient.html

Example

alias FhirEx.Resources.Patient
alias FhirEx.Types.{HumanName, Identifier, ContactPoint, Address, CodeableConcept, Coding}

patient = %Patient{
  id: "patient-001",
  identifier: [
    %Identifier{
      use: "official",
      system: "http://hospital.example.org/mrn",
      value: "MRN-12345"
    }
  ],
  active: true,
  name: [
    %HumanName{use: "official", family: "Doe", given: ["John", "Michael"]}
  ],
  gender: "male",
  birth_date: "1985-04-23",
  telecom: [
    %ContactPoint{system: "phone", value: "+1-555-555-5555", use: "home"}
  ]
}

json = FhirEx.JSON.encode!(patient)

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.

Returns the FHIR resource type name string.

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

Types

communication()

@type communication() :: %{
  language: FhirEx.Types.CodeableConcept.t(),
  preferred: boolean() | nil
}

contact()

@type contact() :: %{
  relationship: [FhirEx.Types.CodeableConcept.t()] | nil,
  name: FhirEx.Types.HumanName.t() | nil,
  telecom: [FhirEx.Types.ContactPoint.t()] | nil,
  address: FhirEx.Types.Address.t() | nil,
  gender: gender() | nil,
  organization: FhirEx.Types.Reference.t() | nil,
  period: FhirEx.Types.Period.t() | nil
}

gender()

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

link()

@type link() :: %{other: FhirEx.Types.Reference.t(), type: String.t()}

t()

@type t() :: %FhirEx.Resources.Patient{
  active: boolean() | nil,
  address: [FhirEx.Types.Address.t()] | nil,
  birth_date: String.t() | nil,
  communication: [communication()] | nil,
  contact: [contact()] | nil,
  deceased_boolean: boolean() | nil,
  deceased_date_time: String.t() | nil,
  extension: [FhirEx.Types.Extension.t()] | nil,
  gender: gender() | nil,
  general_practitioner: [FhirEx.Types.Reference.t()] | nil,
  id: String.t() | nil,
  identifier: [FhirEx.Types.Identifier.t()] | nil,
  link: [link()] | nil,
  managing_organization: FhirEx.Types.Reference.t() | nil,
  marital_status: FhirEx.Types.CodeableConcept.t() | nil,
  meta: FhirEx.Types.Meta.t() | nil,
  multiple_birth_boolean: boolean() | nil,
  multiple_birth_integer: integer() | nil,
  name: [FhirEx.Types.HumanName.t()] | nil,
  telecom: [FhirEx.Types.ContactPoint.t()] | nil,
  text: FhirEx.Types.Narrative.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.

resource_type()

@spec resource_type() :: String.t()

Returns the FHIR resource type name string.

to_map(p)

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

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