Skip to main content

fhir_type

Function fhir_type 

Source
pub fn fhir_type(
    sd: &StructureDefinition,
    element: &ElementDefinition,
) -> String
Expand description

Returns the FHIR type associated with an element.

For the root element of a [StructureDefinition], the type is taken from the structure definition itself (StructureDefinition.type_).

For all other elements, this function expects exactly one declared FHIR type in ElementDefinition.type_ and returns its code.

§Panics

This function will panic if:

  • The root element does not have a StructureDefinition.type_.
  • A non-root element has no type code.
  • A non-root element has multiple declared types, as the FHIR type would be ambiguous.

§Arguments

  • sd - The [StructureDefinition] containing the element.
  • element - The [ElementDefinition] whose FHIR type is to be determined.

§Returns

A String containing the FHIR type name (e.g. "Patient", "string", "CodeableConcept").