FhirEx.Resources.DiagnosticReport (fhir_ex v0.2.0)

Copy Markdown View Source

FHIR R5 DiagnosticReport resource.

The findings and interpretation of diagnostic tests performed on patients. Bundles Observations and provides a formatted report narrative.

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

Status codes: registered | partial | preliminary | modified | final |

          amended | corrected | appended | cancelled | entered-in-error | unknown

Example

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

report = %DiagnosticReport{
  id: "report-001",
  identifier: [%Identifier{system: "http://lab.example.org/reports", value: "RPT-2024-001"}],
  based_on: [%Reference{reference: "ServiceRequest/order-001"}],
  status: "final",
  category: [
    %CodeableConcept{
      coding: [%Coding{
        system: "http://terminology.hl7.org/CodeSystem/v2-0074",
        code: "HM",
        display: "Hematology"
      }]
    }
  ],
  code: %CodeableConcept{
    coding: [%Coding{system: "http://loinc.org", code: "58410-2", display: "CBC panel"}],
    text: "Complete Blood Count"
  },
  subject: %Reference{reference: "Patient/patient-001"},
  encounter: %Reference{reference: "Encounter/enc-001"},
  effective: {:date_time, "2024-01-15T10:00:00Z"},
  issued: "2024-01-15T10:30:00Z",
  performer: [%Reference{reference: "Organization/org-001"}],
  result: [
    %Reference{reference: "Observation/obs-001"},
    %Reference{reference: "Observation/obs-002"}
  ],
  specimen: [%Reference{reference: "Specimen/spec-001"}]
}

Summary

Functions

Builds the struct from a string-keyed map (e.g., from decoded FHIR JSON). The effective[x] field is decoded into a tagged tuple.

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. The effective[x] field is serialised to its FHIR JSON key.

Types

media()

@type media() :: %{comment: String.t() | nil, link: FhirEx.Types.Reference.t()}

supporting_info()

@type supporting_info() :: %{
  type: FhirEx.Types.CodeableConcept.t(),
  reference: FhirEx.Types.Reference.t()
}

t()

@type t() :: %FhirEx.Resources.DiagnosticReport{
  based_on: [FhirEx.Types.Reference.t()] | nil,
  category: [FhirEx.Types.CodeableConcept.t()] | nil,
  code: FhirEx.Types.CodeableConcept.t(),
  composition: FhirEx.Types.Reference.t() | nil,
  conclusion: String.t() | nil,
  conclusion_code: [FhirEx.Types.CodeableConcept.t()] | nil,
  effective:
    {:date_time, String.t()} | {:period, FhirEx.Types.Period.t()} | nil,
  encounter: FhirEx.Types.Reference.t() | nil,
  extension: [FhirEx.Types.Extension.t()] | nil,
  id: String.t() | nil,
  identifier: [FhirEx.Types.Identifier.t()] | nil,
  issued: String.t() | nil,
  media: [media()] | nil,
  meta: FhirEx.Types.Meta.t() | nil,
  note: [FhirEx.Types.Annotation.t()] | nil,
  performer: [FhirEx.Types.Reference.t()] | nil,
  presented_form: [map()] | nil,
  result: [FhirEx.Types.Reference.t()] | nil,
  results_interpreter: [FhirEx.Types.Reference.t()] | nil,
  specimen: [FhirEx.Types.Reference.t()] | nil,
  status: String.t(),
  study: [FhirEx.Types.Reference.t()] | nil,
  subject: FhirEx.Types.Reference.t() | nil,
  supporting_info: [supporting_info()] | 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). The effective[x] field is decoded into a tagged tuple.

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(dr)

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

Converts the struct to a string-keyed map for use with FhirEx.JSON. The effective[x] field is serialised to its FHIR JSON key.