FhirEx.Resources.Communication (fhir_ex v0.4.0)

Copy Markdown View Source

FHIR R5 Communication resource.

A record of a communication that has occurred, is occurring, or is planned to occur between participants (e.g. a clinician notifying a patient, or an automated alert sent to a care team).

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

Status codes: preparation | in-progress | not-done | on-hold | stopped |

          completed | entered-in-error | unknown

Priority codes: routine | urgent | asap | stat

Note on reason

FHIR models reason as CodeableReference, but this library does not yet have a general CodeableReference type. reason is represented here as a plain list of CodeableConcept, the same simplification already used for MessageHeader.reason.

Note on payload

Each payload entry carries a polymorphic content[x], represented as a tagged tuple:

%{content: {:reference, %Reference{reference: "Media/media-001"}}}
%{content: {:codeable_concept, %CodeableConcept{text: "Discharge instructions provided verbally"}}}

FHIR also allows contentAttachment, but this library does not yet model Attachment, so that variant is not supported.

Example

alias FhirEx.Resources.Communication
alias FhirEx.Types.{Reference, CodeableConcept}

communication = %Communication{
  id: "comm-001",
  status: "completed",
  subject: %Reference{reference: "Patient/patient-001"},
  sender: %Reference{reference: "Practitioner/prac-001"},
  recipient: [%Reference{reference: "Patient/patient-001"}],
  sent: "2024-01-15T09:00:00Z",
  payload: [
    %{content: {:codeable_concept, %CodeableConcept{text: "Your lab results are ready."}}}
  ]
}

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

content_type()

@type content_type() ::
  {:reference, FhirEx.Types.Reference.t()}
  | {:codeable_concept, FhirEx.Types.CodeableConcept.t()}

payload()

@type payload() :: %{content: content_type()}

t()

@type t() :: %FhirEx.Resources.Communication{
  about: [FhirEx.Types.Reference.t()] | nil,
  based_on: [FhirEx.Types.Reference.t()] | nil,
  category: [FhirEx.Types.CodeableConcept.t()] | nil,
  encounter: FhirEx.Types.Reference.t() | nil,
  extension: [FhirEx.Types.Extension.t()] | nil,
  id: String.t() | nil,
  identifier: [FhirEx.Types.Identifier.t()] | nil,
  in_response_to: [FhirEx.Types.Reference.t()] | nil,
  instantiates_canonical: [String.t()] | nil,
  instantiates_uri: [String.t()] | nil,
  medium: [FhirEx.Types.CodeableConcept.t()] | nil,
  meta: FhirEx.Types.Meta.t() | nil,
  note: [FhirEx.Types.Annotation.t()] | nil,
  part_of: [FhirEx.Types.Reference.t()] | nil,
  payload: [payload()] | nil,
  priority: String.t() | nil,
  reason: [FhirEx.Types.CodeableConcept.t()] | nil,
  received: String.t() | nil,
  recipient: [FhirEx.Types.Reference.t()] | nil,
  sender: FhirEx.Types.Reference.t() | nil,
  sent: String.t() | nil,
  status: String.t(),
  status_reason: FhirEx.Types.CodeableConcept.t() | nil,
  subject: FhirEx.Types.Reference.t() | nil,
  text: FhirEx.Types.Narrative.t() | nil,
  topic: FhirEx.Types.CodeableConcept.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(c)

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

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