// @generated by fhirkit-gen from hl7.fhir.r4.core 4.0.1. Do not edit.
//! The FHIR R4 `SubstanceSourceMaterial` resource.
#![allow(
unused_imports,
clippy::large_enum_variant,
clippy::too_many_lines,
clippy::doc_markdown
)]
use crate::decode::{
choice_key, required, required_list, resource_type, Choice, Decoder, FhirJson, Obj, ObjWriter,
};
use crate::json::Json;
use crate::primitive::{Decimal, Kind, Primitive};
use crate::r4::*;
/// Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex.
///
/// FHIR path: `SubstanceSourceMaterial`.
#[cfg(feature = "specialized")]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SubstanceSourceMaterial {
/// `id` (0..1): Logical id of this artifact
pub id: Option<String>,
/// `meta` (0..1): Metadata about the resource
pub meta: Option<Meta>,
/// `implicitRules` (0..1): A set of rules under which this content was created
pub implicit_rules: Option<Primitive<String>>,
/// `language` (0..1): Language of the resource content
pub language: Option<Primitive<String>>,
/// `text` (0..1): Text summary of the resource, for human interpretation
pub text: Option<Narrative>,
/// `contained` (0..*): Contained, inline Resources
pub contained: Vec<Resource>,
/// `extension` (0..*): Additional content defined by implementations
pub extension: Vec<Extension>,
/// `modifierExtension` (0..*): Extensions that cannot be ignored
pub modifier_extension: Vec<Extension>,
/// `sourceMaterialClass` (0..1): General high level classification of the source material specific to the origin of the material
pub source_material_class: Option<CodeableConcept>,
/// `sourceMaterialType` (0..1): The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent
pub source_material_type: Option<CodeableConcept>,
/// `sourceMaterialState` (0..1): The state of the source material when extracted
pub source_material_state: Option<CodeableConcept>,
/// `organismId` (0..1): The unique identifier associated with the source material parent organism shall be specified
pub organism_id: Option<Identifier>,
/// `organismName` (0..1): The organism accepted Scientific name shall be provided based on the organism taxonomy
pub organism_name: Option<Primitive<String>>,
/// `parentSubstanceId` (0..*): The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant)
pub parent_substance_id: Vec<Identifier>,
/// `parentSubstanceName` (0..*): The parent substance of the Herbal Drug, or Herbal preparation
pub parent_substance_name: Vec<Primitive<String>>,
/// `countryOfOrigin` (0..*): The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate
pub country_of_origin: Vec<CodeableConcept>,
/// `geographicalLocation` (0..*): The place/region where the plant is harvested or the places/regions where the animal source material has its habitat
pub geographical_location: Vec<Primitive<String>>,
/// `developmentStage` (0..1): Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum)
pub development_stage: Option<CodeableConcept>,
/// `fractionDescription` (0..*): Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels
pub fraction_description: Vec<SubstanceSourceMaterialFractionDescription>,
/// `organism` (0..1): This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf
pub organism: Option<SubstanceSourceMaterialOrganism>,
/// `partDescription` (0..*): To do
pub part_description: Vec<SubstanceSourceMaterialPartDescription>,
}
#[cfg(feature = "specialized")]
impl FhirJson for SubstanceSourceMaterial {
const TYPE_NAME: &'static str = "SubstanceSourceMaterial";
fn decode(v: &Json, d: &mut Decoder) -> Option<Self> {
let mut o = Obj::new(v, d)?;
resource_type(&mut o, d, "SubstanceSourceMaterial");
let r = SubstanceSourceMaterial {
id: o.string(d, "id"),
meta: o.one(d, "meta"),
implicit_rules: o.prim(d, "implicitRules", Kind::Uri),
language: o.prim(d, "language", Kind::Code),
text: o.one(d, "text"),
contained: o.list(d, "contained"),
extension: o.list(d, "extension"),
modifier_extension: o.list(d, "modifierExtension"),
source_material_class: o.one(d, "sourceMaterialClass"),
source_material_type: o.one(d, "sourceMaterialType"),
source_material_state: o.one(d, "sourceMaterialState"),
organism_id: o.one(d, "organismId"),
organism_name: o.prim(d, "organismName", Kind::String),
parent_substance_id: o.list(d, "parentSubstanceId"),
parent_substance_name: o.prim_list(d, "parentSubstanceName", Kind::String),
country_of_origin: o.list(d, "countryOfOrigin"),
geographical_location: o.prim_list(d, "geographicalLocation", Kind::String),
development_stage: o.one(d, "developmentStage"),
fraction_description: o.list(d, "fractionDescription"),
organism: o.one(d, "organism"),
part_description: o.list(d, "partDescription"),
};
o.finish(d);
Some(r)
}
fn encode(&self) -> Json {
let mut w = ObjWriter::new();
w.raw(
"resourceType",
Json::String("SubstanceSourceMaterial".into()),
);
w.string("id", &self.id);
w.one("meta", &self.meta);
w.prim("implicitRules", &self.implicit_rules);
w.prim("language", &self.language);
w.one("text", &self.text);
w.list("contained", &self.contained);
w.list("extension", &self.extension);
w.list("modifierExtension", &self.modifier_extension);
w.one("sourceMaterialClass", &self.source_material_class);
w.one("sourceMaterialType", &self.source_material_type);
w.one("sourceMaterialState", &self.source_material_state);
w.one("organismId", &self.organism_id);
w.prim("organismName", &self.organism_name);
w.list("parentSubstanceId", &self.parent_substance_id);
w.prim_list("parentSubstanceName", &self.parent_substance_name);
w.list("countryOfOrigin", &self.country_of_origin);
w.prim_list("geographicalLocation", &self.geographical_location);
w.one("developmentStage", &self.development_stage);
w.list("fractionDescription", &self.fraction_description);
w.one("organism", &self.organism);
w.list("partDescription", &self.part_description);
w.finish()
}
}
/// Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels
///
/// FHIR path: `SubstanceSourceMaterial.fractionDescription`.
#[cfg(feature = "specialized")]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SubstanceSourceMaterialFractionDescription {
/// `id` (0..1): Unique id for inter-element referencing
pub id: Option<String>,
/// `extension` (0..*): Additional content defined by implementations
pub extension: Vec<Extension>,
/// `modifierExtension` (0..*): Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Vec<Extension>,
/// `fraction` (0..1): This element is capturing information about the fraction of a plant part, or human plasma for fractionation
pub fraction: Option<Primitive<String>>,
/// `materialType` (0..1): The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1
pub material_type: Option<CodeableConcept>,
}
#[cfg(feature = "specialized")]
impl FhirJson for SubstanceSourceMaterialFractionDescription {
const TYPE_NAME: &'static str = "SubstanceSourceMaterialFractionDescription";
fn decode(v: &Json, d: &mut Decoder) -> Option<Self> {
let mut o = Obj::new(v, d)?;
let r = SubstanceSourceMaterialFractionDescription {
id: o.string(d, "id"),
extension: o.list(d, "extension"),
modifier_extension: o.list(d, "modifierExtension"),
fraction: o.prim(d, "fraction", Kind::String),
material_type: o.one(d, "materialType"),
};
o.finish(d);
Some(r)
}
fn encode(&self) -> Json {
let mut w = ObjWriter::new();
w.string("id", &self.id);
w.list("extension", &self.extension);
w.list("modifierExtension", &self.modifier_extension);
w.prim("fraction", &self.fraction);
w.one("materialType", &self.material_type);
w.finish()
}
}
/// This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf
///
/// FHIR path: `SubstanceSourceMaterial.organism`.
#[cfg(feature = "specialized")]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SubstanceSourceMaterialOrganism {
/// `id` (0..1): Unique id for inter-element referencing
pub id: Option<String>,
/// `extension` (0..*): Additional content defined by implementations
pub extension: Vec<Extension>,
/// `modifierExtension` (0..*): Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Vec<Extension>,
/// `family` (0..1): The family of an organism shall be specified
pub family: Option<CodeableConcept>,
/// `genus` (0..1): The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies
pub genus: Option<CodeableConcept>,
/// `species` (0..1): The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies
pub species: Option<CodeableConcept>,
/// `intraspecificType` (0..1): The Intraspecific type of an organism shall be specified
pub intraspecific_type: Option<CodeableConcept>,
/// `intraspecificDescription` (0..1): The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention
pub intraspecific_description: Option<Primitive<String>>,
/// `author` (0..*): 4.9.13.6.1 Author type (Conditional)
pub author: Vec<SubstanceSourceMaterialOrganismAuthor>,
/// `hybrid` (0..1): 4.9.13.8.1 Hybrid species maternal organism ID (Optional)
pub hybrid: Option<SubstanceSourceMaterialOrganismHybrid>,
/// `organismGeneral` (0..1): 4.9.13.7.1 Kingdom (Conditional)
pub organism_general: Option<SubstanceSourceMaterialOrganismOrganismGeneral>,
}
#[cfg(feature = "specialized")]
impl FhirJson for SubstanceSourceMaterialOrganism {
const TYPE_NAME: &'static str = "SubstanceSourceMaterialOrganism";
fn decode(v: &Json, d: &mut Decoder) -> Option<Self> {
let mut o = Obj::new(v, d)?;
let r = SubstanceSourceMaterialOrganism {
id: o.string(d, "id"),
extension: o.list(d, "extension"),
modifier_extension: o.list(d, "modifierExtension"),
family: o.one(d, "family"),
genus: o.one(d, "genus"),
species: o.one(d, "species"),
intraspecific_type: o.one(d, "intraspecificType"),
intraspecific_description: o.prim(d, "intraspecificDescription", Kind::String),
author: o.list(d, "author"),
hybrid: o.one(d, "hybrid"),
organism_general: o.one(d, "organismGeneral"),
};
o.finish(d);
Some(r)
}
fn encode(&self) -> Json {
let mut w = ObjWriter::new();
w.string("id", &self.id);
w.list("extension", &self.extension);
w.list("modifierExtension", &self.modifier_extension);
w.one("family", &self.family);
w.one("genus", &self.genus);
w.one("species", &self.species);
w.one("intraspecificType", &self.intraspecific_type);
w.prim("intraspecificDescription", &self.intraspecific_description);
w.list("author", &self.author);
w.one("hybrid", &self.hybrid);
w.one("organismGeneral", &self.organism_general);
w.finish()
}
}
/// 4.9.13.6.1 Author type (Conditional)
///
/// FHIR path: `SubstanceSourceMaterial.organism.author`.
#[cfg(feature = "specialized")]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SubstanceSourceMaterialOrganismAuthor {
/// `id` (0..1): Unique id for inter-element referencing
pub id: Option<String>,
/// `extension` (0..*): Additional content defined by implementations
pub extension: Vec<Extension>,
/// `modifierExtension` (0..*): Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Vec<Extension>,
/// `authorType` (0..1): The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name
pub author_type: Option<CodeableConcept>,
/// `authorDescription` (0..1): The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank)
pub author_description: Option<Primitive<String>>,
}
#[cfg(feature = "specialized")]
impl FhirJson for SubstanceSourceMaterialOrganismAuthor {
const TYPE_NAME: &'static str = "SubstanceSourceMaterialOrganismAuthor";
fn decode(v: &Json, d: &mut Decoder) -> Option<Self> {
let mut o = Obj::new(v, d)?;
let r = SubstanceSourceMaterialOrganismAuthor {
id: o.string(d, "id"),
extension: o.list(d, "extension"),
modifier_extension: o.list(d, "modifierExtension"),
author_type: o.one(d, "authorType"),
author_description: o.prim(d, "authorDescription", Kind::String),
};
o.finish(d);
Some(r)
}
fn encode(&self) -> Json {
let mut w = ObjWriter::new();
w.string("id", &self.id);
w.list("extension", &self.extension);
w.list("modifierExtension", &self.modifier_extension);
w.one("authorType", &self.author_type);
w.prim("authorDescription", &self.author_description);
w.finish()
}
}
/// 4.9.13.8.1 Hybrid species maternal organism ID (Optional)
///
/// FHIR path: `SubstanceSourceMaterial.organism.hybrid`.
#[cfg(feature = "specialized")]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SubstanceSourceMaterialOrganismHybrid {
/// `id` (0..1): Unique id for inter-element referencing
pub id: Option<String>,
/// `extension` (0..*): Additional content defined by implementations
pub extension: Vec<Extension>,
/// `modifierExtension` (0..*): Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Vec<Extension>,
/// `maternalOrganismId` (0..1): The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal
pub maternal_organism_id: Option<Primitive<String>>,
/// `maternalOrganismName` (0..1): The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal
pub maternal_organism_name: Option<Primitive<String>>,
/// `paternalOrganismId` (0..1): The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary
pub paternal_organism_id: Option<Primitive<String>>,
/// `paternalOrganismName` (0..1): The name of the paternal species constituting the hybrid organism shall be specified
pub paternal_organism_name: Option<Primitive<String>>,
/// `hybridType` (0..1): The hybrid type of an organism shall be specified
pub hybrid_type: Option<CodeableConcept>,
}
#[cfg(feature = "specialized")]
impl FhirJson for SubstanceSourceMaterialOrganismHybrid {
const TYPE_NAME: &'static str = "SubstanceSourceMaterialOrganismHybrid";
fn decode(v: &Json, d: &mut Decoder) -> Option<Self> {
let mut o = Obj::new(v, d)?;
let r = SubstanceSourceMaterialOrganismHybrid {
id: o.string(d, "id"),
extension: o.list(d, "extension"),
modifier_extension: o.list(d, "modifierExtension"),
maternal_organism_id: o.prim(d, "maternalOrganismId", Kind::String),
maternal_organism_name: o.prim(d, "maternalOrganismName", Kind::String),
paternal_organism_id: o.prim(d, "paternalOrganismId", Kind::String),
paternal_organism_name: o.prim(d, "paternalOrganismName", Kind::String),
hybrid_type: o.one(d, "hybridType"),
};
o.finish(d);
Some(r)
}
fn encode(&self) -> Json {
let mut w = ObjWriter::new();
w.string("id", &self.id);
w.list("extension", &self.extension);
w.list("modifierExtension", &self.modifier_extension);
w.prim("maternalOrganismId", &self.maternal_organism_id);
w.prim("maternalOrganismName", &self.maternal_organism_name);
w.prim("paternalOrganismId", &self.paternal_organism_id);
w.prim("paternalOrganismName", &self.paternal_organism_name);
w.one("hybridType", &self.hybrid_type);
w.finish()
}
}
/// 4.9.13.7.1 Kingdom (Conditional)
///
/// FHIR path: `SubstanceSourceMaterial.organism.organismGeneral`.
#[cfg(feature = "specialized")]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SubstanceSourceMaterialOrganismOrganismGeneral {
/// `id` (0..1): Unique id for inter-element referencing
pub id: Option<String>,
/// `extension` (0..*): Additional content defined by implementations
pub extension: Vec<Extension>,
/// `modifierExtension` (0..*): Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Vec<Extension>,
/// `kingdom` (0..1): The kingdom of an organism shall be specified
pub kingdom: Option<CodeableConcept>,
/// `phylum` (0..1): The phylum of an organism shall be specified
pub phylum: Option<CodeableConcept>,
/// `class` (0..1): The class of an organism shall be specified
pub class: Option<CodeableConcept>,
/// `order` (0..1): The order of an organism shall be specified,
pub order: Option<CodeableConcept>,
}
#[cfg(feature = "specialized")]
impl FhirJson for SubstanceSourceMaterialOrganismOrganismGeneral {
const TYPE_NAME: &'static str = "SubstanceSourceMaterialOrganismOrganismGeneral";
fn decode(v: &Json, d: &mut Decoder) -> Option<Self> {
let mut o = Obj::new(v, d)?;
let r = SubstanceSourceMaterialOrganismOrganismGeneral {
id: o.string(d, "id"),
extension: o.list(d, "extension"),
modifier_extension: o.list(d, "modifierExtension"),
kingdom: o.one(d, "kingdom"),
phylum: o.one(d, "phylum"),
class: o.one(d, "class"),
order: o.one(d, "order"),
};
o.finish(d);
Some(r)
}
fn encode(&self) -> Json {
let mut w = ObjWriter::new();
w.string("id", &self.id);
w.list("extension", &self.extension);
w.list("modifierExtension", &self.modifier_extension);
w.one("kingdom", &self.kingdom);
w.one("phylum", &self.phylum);
w.one("class", &self.class);
w.one("order", &self.order);
w.finish()
}
}
/// To do
///
/// FHIR path: `SubstanceSourceMaterial.partDescription`.
#[cfg(feature = "specialized")]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SubstanceSourceMaterialPartDescription {
/// `id` (0..1): Unique id for inter-element referencing
pub id: Option<String>,
/// `extension` (0..*): Additional content defined by implementations
pub extension: Vec<Extension>,
/// `modifierExtension` (0..*): Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Vec<Extension>,
/// `part` (0..1): Entity of anatomical origin of source material within an organism
pub part: Option<CodeableConcept>,
/// `partLocation` (0..1): The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply
pub part_location: Option<CodeableConcept>,
}
#[cfg(feature = "specialized")]
impl FhirJson for SubstanceSourceMaterialPartDescription {
const TYPE_NAME: &'static str = "SubstanceSourceMaterialPartDescription";
fn decode(v: &Json, d: &mut Decoder) -> Option<Self> {
let mut o = Obj::new(v, d)?;
let r = SubstanceSourceMaterialPartDescription {
id: o.string(d, "id"),
extension: o.list(d, "extension"),
modifier_extension: o.list(d, "modifierExtension"),
part: o.one(d, "part"),
part_location: o.one(d, "partLocation"),
};
o.finish(d);
Some(r)
}
fn encode(&self) -> Json {
let mut w = ObjWriter::new();
w.string("id", &self.id);
w.list("extension", &self.extension);
w.list("modifierExtension", &self.modifier_extension);
w.one("part", &self.part);
w.one("partLocation", &self.part_location);
w.finish()
}
}