FhirEx.Resources.Task (fhir_ex v0.2.0)

Copy Markdown View Source

FHIR R5 Task resource.

A task to be performed, tracking workflow state across systems.

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

Status codes: draft | requested | received | accepted | rejected | ready |

          cancelled | in-progress | on-hold | failed | completed | entered-in-error

Intent codes: unknown | proposal | plan | order | original-order | reflex-order |

          filler-order | instance-order | option

Note on for_subject

The FHIR field for (the subject/patient the task is about) is serialised as "for" in JSON but cannot be an Elixir atom because for is a reserved keyword. This library uses the struct field for_subject and maps it to "for" in JSON.

Example

alias FhirEx.Resources.Task
alias FhirEx.Types.{Reference, CodeableConcept, Coding}

task = %Task{
  id: "task-001",
  status: "requested",
  intent: "order",
  code: %CodeableConcept{
    coding: [%Coding{system: "http://snomed.info/sct", code: "257196009"}],
    text: "Collect specimen"
  },
  for_subject: %Reference{reference: "Patient/patient-001"},
  encounter: %Reference{reference: "Encounter/enc-001"},
  authored_on: "2024-01-15T09:00:00Z",
  last_modified: "2024-01-15T09: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

input()

@type input() :: %{type: FhirEx.Types.CodeableConcept.t(), value: any()}

output()

@type output() :: %{type: FhirEx.Types.CodeableConcept.t(), value: any()}

restriction()

@type restriction() :: %{
  repetitions: integer() | nil,
  period: FhirEx.Types.Period.t() | nil,
  recipient: [FhirEx.Types.Reference.t()] | nil
}

t()

@type t() :: %FhirEx.Resources.Task{
  authored_on: String.t() | nil,
  based_on: [FhirEx.Types.Reference.t()] | nil,
  business_status: FhirEx.Types.CodeableConcept.t() | nil,
  code: FhirEx.Types.CodeableConcept.t() | nil,
  description: String.t() | nil,
  do_not_perform: boolean() | nil,
  encounter: FhirEx.Types.Reference.t() | nil,
  execution_period: FhirEx.Types.Period.t() | nil,
  extension: [FhirEx.Types.Extension.t()] | nil,
  focus: FhirEx.Types.Reference.t() | nil,
  for_subject: FhirEx.Types.Reference.t() | nil,
  group_identifier: FhirEx.Types.Identifier.t() | nil,
  id: String.t() | nil,
  identifier: [FhirEx.Types.Identifier.t()] | nil,
  input: [input()] | nil,
  instantiates_canonical: String.t() | nil,
  instantiates_uri: String.t() | nil,
  intent: String.t(),
  last_modified: String.t() | nil,
  location: FhirEx.Types.Reference.t() | nil,
  meta: FhirEx.Types.Meta.t() | nil,
  note: [FhirEx.Types.Annotation.t()] | nil,
  output: [output()] | nil,
  owner: FhirEx.Types.Reference.t() | nil,
  part_of: [FhirEx.Types.Reference.t()] | nil,
  priority: String.t() | nil,
  relevant_history: [FhirEx.Types.Reference.t()] | nil,
  requested_period: FhirEx.Types.Period.t() | nil,
  requester: FhirEx.Types.Reference.t() | nil,
  restriction: restriction() | nil,
  status: String.t(),
  status_reason: FhirEx.Types.CodeableConcept.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(t)

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

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