FhirEx.Resources.Specimen (fhir_ex v0.3.0)

Copy Markdown View Source

FHIR R5 Specimen resource.

A sample to be used for analysis. Represents the biological material collected from a patient for lab testing.

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

Status codes: available | unavailable | unsatisfactory | entered-in-error

Example

alias FhirEx.Resources.Specimen
alias FhirEx.Types.{Reference, CodeableConcept, Coding, Identifier, Quantity}

specimen = %Specimen{
  id: "spec-001",
  identifier: [%Identifier{system: "http://lab.example.org/specimens", value: "SPEC-2024-001"}],
  accession_identifier: %Identifier{system: "http://lab.example.org/accession", value: "ACC-2024-001"},
  status: "available",
  type: %CodeableConcept{
    coding: [%Coding{system: "http://snomed.info/sct", code: "119297000", display: "Blood specimen"}]
  },
  subject: %Reference{reference: "Patient/patient-001"},
  received_time: "2024-01-15T08:30:00Z",
  collection: %{
    collector: %Reference{reference: "Practitioner/pract-001"},
    collected: {:date_time, "2024-01-15T08:00:00Z"},
    body_site: %CodeableConcept{
      coding: [%Coding{system: "http://snomed.info/sct", code: "368209003", display: "Right arm"}]
    },
    method: %CodeableConcept{
      coding: [%Coding{system: "http://snomed.info/sct", code: "28520004", display: "Venipuncture"}]
    }
  }
}

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

collection()

@type collection() :: %{
  collector: FhirEx.Types.Reference.t() | nil,
  collected:
    {:date_time, String.t()} | {:period, FhirEx.Types.Period.t()} | nil,
  duration: map() | nil,
  quantity: FhirEx.Types.Quantity.t() | nil,
  method: FhirEx.Types.CodeableConcept.t() | nil,
  device: FhirEx.Types.Reference.t() | nil,
  procedure: FhirEx.Types.Reference.t() | nil,
  body_site: FhirEx.Types.CodeableConcept.t() | nil,
  fasting_status:
    {:codeable_concept, FhirEx.Types.CodeableConcept.t()}
    | {:duration, map()}
    | nil
}

container()

@type container() :: %{
  device: FhirEx.Types.Reference.t() | nil,
  location: FhirEx.Types.Reference.t() | nil,
  specimen_quantity: FhirEx.Types.Quantity.t() | nil
}

processing()

@type processing() :: %{
  description: String.t() | nil,
  method: FhirEx.Types.CodeableConcept.t() | nil,
  additive: [FhirEx.Types.Reference.t()] | nil,
  time: {:date_time, String.t()} | {:period, FhirEx.Types.Period.t()} | nil
}

t()

@type t() :: %FhirEx.Resources.Specimen{
  accession_identifier: FhirEx.Types.Identifier.t() | nil,
  collection: collection() | nil,
  combined: String.t() | nil,
  condition: [FhirEx.Types.CodeableConcept.t()] | nil,
  container: [container()] | nil,
  extension: [FhirEx.Types.Extension.t()] | nil,
  feature: [map()] | nil,
  id: String.t() | nil,
  identifier: [FhirEx.Types.Identifier.t()] | nil,
  meta: FhirEx.Types.Meta.t() | nil,
  note: [FhirEx.Types.Annotation.t()] | nil,
  parent: [FhirEx.Types.Reference.t()] | nil,
  processing: [processing()] | nil,
  received_time: String.t() | nil,
  request: [FhirEx.Types.Reference.t()] | nil,
  role: [FhirEx.Types.CodeableConcept.t()] | nil,
  status: String.t() | nil,
  subject: FhirEx.Types.Reference.t() | nil,
  text: FhirEx.Types.Narrative.t() | nil,
  type: 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(s)

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

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