FhirEx.Resources.Encounter (fhir_ex v0.3.0)

Copy Markdown View Source

FHIR R5 Encounter resource.

An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.

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

R5 Notes

  • class is now a list of CodeableConcept (was a single Coding in R4).
  • hospitalization has been renamed to admission.
  • statusHistory removed; use the history backbone element instead.
  • location.form replaces location.physicalType.

Status codes: planned | in-progress | on-hold | discharged | completed |

          cancelled | discontinued | entered-in-error | unknown

Example

alias FhirEx.Resources.Encounter
alias FhirEx.Types.{Reference, CodeableConcept, Coding, Period, Identifier}

encounter = %Encounter{
  id: "enc-001",
  status: "in-progress",
  class: [
    %CodeableConcept{
      coding: [%Coding{
        system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
        code: "IMP",
        display: "inpatient encounter"
      }]
    }
  ],
  subject: %Reference{reference: "Patient/patient-001"},
  actual_period: %Period{start: "2024-01-15T08:00:00Z"}
}

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

admission()

@type admission() :: %{
  pre_admission_identifier: FhirEx.Types.Identifier.t() | nil,
  origin: FhirEx.Types.Reference.t() | nil,
  admit_source: FhirEx.Types.CodeableConcept.t() | nil,
  re_admission: FhirEx.Types.CodeableConcept.t() | nil,
  destination: FhirEx.Types.Reference.t() | nil,
  discharge_disposition: FhirEx.Types.CodeableConcept.t() | nil
}

diagnosis()

@type diagnosis() :: %{
  condition: [FhirEx.Types.Reference.t()] | nil,
  use: [FhirEx.Types.CodeableConcept.t()] | nil
}

location()

@type location() :: %{
  location: FhirEx.Types.Reference.t(),
  status: String.t() | nil,
  form: FhirEx.Types.CodeableConcept.t() | nil,
  period: FhirEx.Types.Period.t() | nil
}

participant()

@type participant() :: %{
  type: [FhirEx.Types.CodeableConcept.t()] | nil,
  period: FhirEx.Types.Period.t() | nil,
  actor: FhirEx.Types.Reference.t() | nil
}

reason()

@type reason() :: %{
  use: [FhirEx.Types.CodeableConcept.t()] | nil,
  value: [map()] | nil
}

t()

@type t() :: %FhirEx.Resources.Encounter{
  account: [FhirEx.Types.Reference.t()] | nil,
  actual_period: FhirEx.Types.Period.t() | nil,
  admission: admission() | nil,
  appointment: [FhirEx.Types.Reference.t()] | nil,
  care_team: [FhirEx.Types.Reference.t()] | nil,
  class: [FhirEx.Types.CodeableConcept.t()] | nil,
  diagnosis: [diagnosis()] | nil,
  diet_preference: [FhirEx.Types.CodeableConcept.t()] | nil,
  episode_of_care: [FhirEx.Types.Reference.t()] | nil,
  extension: [FhirEx.Types.Extension.t()] | nil,
  id: String.t() | nil,
  identifier: [FhirEx.Types.Identifier.t()] | nil,
  length: map() | nil,
  location: [location()] | nil,
  meta: FhirEx.Types.Meta.t() | nil,
  part_of: FhirEx.Types.Reference.t() | nil,
  participant: [participant()] | nil,
  planned_end_date: String.t() | nil,
  planned_start_date: String.t() | nil,
  priority: FhirEx.Types.CodeableConcept.t() | nil,
  reason: [reason()] | nil,
  service_provider: FhirEx.Types.Reference.t() | nil,
  service_type: [map()] | nil,
  special_arrangement: [FhirEx.Types.CodeableConcept.t()] | nil,
  special_courtesy: [FhirEx.Types.CodeableConcept.t()] | nil,
  status: String.t(),
  subject: FhirEx.Types.Reference.t() | nil,
  subject_status: FhirEx.Types.CodeableConcept.t() | nil,
  text: FhirEx.Types.Narrative.t() | nil,
  type: [FhirEx.Types.CodeableConcept.t()] | nil,
  virtual_service: [map()] | 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(e)

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

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