diff --git a/healthchain/fhir_resources/bundleresources.py b/healthchain/fhir_resources/bundleresources.py index 53c3d69..603651a 100644 --- a/healthchain/fhir_resources/bundleresources.py +++ b/healthchain/fhir_resources/bundleresources.py @@ -1,5 +1,5 @@ from pydantic import Field, BaseModel, field_validator -from typing import List, Any +from typing import List, Literal, Any from healthchain.fhir_resources.resourceregistry import ImplementedResourceRegistry @@ -24,9 +24,9 @@ def check_enum(cls, value): class Bundle(BaseModel): - resourceType_field: str = "Bundle" + resourceType: Literal["Bundle"] = "Bundle" entry_field: List[BundleEntry] = Field( - default_factory=list, + default=None, alias="entry", description="An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).", ) diff --git a/healthchain/fhir_resources/condition.py b/healthchain/fhir_resources/condition.py index 163f2ec..e05b366 100644 --- a/healthchain/fhir_resources/condition.py +++ b/healthchain/fhir_resources/condition.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( stringModel, @@ -30,12 +30,12 @@ class ConditionParticipant(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -58,12 +58,12 @@ class ConditionStage(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -73,7 +73,7 @@ class ConditionStage(BaseModel): description="A simple summary of the stage such as Stage 3 or Early Onset. The determination of the stage is disease-specific, such as cancer, retinopathy of prematurity, kidney diseases, Alzheimer's, or Parkinson disease.", ) assessment_field: List[Reference] = Field( - default_factory=list, + default=None, alias="assessment", description="Reference to a formal record of the evidence on which the staging assessment is based.", ) @@ -85,7 +85,7 @@ class ConditionStage(BaseModel): class Condition(BaseModel): - resourceType: str = "Condition" + resourceType: Literal["Condition"] = "Condition" id_field: idModel = Field( default=None, alias="id", @@ -112,22 +112,22 @@ class Condition(BaseModel): description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) # contained_field: List[ResourceListModel] = Field( - # default_factory=list, + # default=None, # alias="contained", # description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.", # ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="Business identifiers assigned to this condition by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", ) @@ -142,7 +142,7 @@ class Condition(BaseModel): description="The verification status to support the clinical status of the condition. The verification status pertains to the condition, itself, not to any specific condition attribute.", ) category_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="category", description="A category assigned to the condition.", ) @@ -157,7 +157,7 @@ class Condition(BaseModel): description="Identification of the condition, problem or diagnosis.", ) bodySite_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="bodySite", description="The anatomical location where this condition manifests itself.", ) @@ -217,22 +217,22 @@ class Condition(BaseModel): description="The recordedDate represents when this particular Condition record was created in the system, which is often a system-generated date.", ) participant_field: List[ConditionParticipant] = Field( - default_factory=list, + default=None, alias="participant", description="Indicates who or what participated in the activities related to the condition and how they were involved.", ) stage_field: List[ConditionStage] = Field( - default_factory=list, + default=None, alias="stage", description="A simple summary of the stage such as Stage 3 or Early Onset. The determination of the stage is disease-specific, such as cancer, retinopathy of prematurity, kidney diseases, Alzheimer's, or Parkinson disease.", ) evidence_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="evidence", description="Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition.", ) note_field: List[Annotation] = Field( - default_factory=list, + default=None, alias="note", description="Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis.", ) diff --git a/healthchain/fhir_resources/documentreference.py b/healthchain/fhir_resources/documentreference.py index 4baac1e..33d505c 100644 --- a/healthchain/fhir_resources/documentreference.py +++ b/healthchain/fhir_resources/documentreference.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( idModel, @@ -31,12 +31,12 @@ class DocumentReferenceAttester(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -64,12 +64,12 @@ class DocumentReferenceRelatesTo(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -92,12 +92,12 @@ class DocumentReferenceProfile(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -113,12 +113,12 @@ class DocumentReferenceContent(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -128,14 +128,14 @@ class DocumentReferenceContent(BaseModel): description="The document or URL of the document along with critical metadata to prove content has integrity.", ) profile_field: List[DocumentReferenceProfile] = Field( - default_factory=list, + default=None, alias="profile", description="An identifier of the document constraints, encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.", ) class DocumentReference(BaseModel): - resourceType_field: str = "DocumentReference" + resourceType: Literal["DocumentReference"] = "DocumentReference" id_field: idModel = Field( default=None, alias="id", @@ -162,22 +162,22 @@ class DocumentReference(BaseModel): description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) # contained_field: List[ResourceListModel] = Field( - # default_factory=list, + # default=None, # alias="contained", # description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.", # ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="Other business identifiers associated with the document, including version independent identifiers.", ) @@ -187,7 +187,7 @@ class DocumentReference(BaseModel): description="An explicitly assigned identifer of a variation of the content in the DocumentReference.", ) basedOn_field: List[Reference] = Field( - default_factory=list, + default=None, alias="basedOn", description="A procedure that is fulfilled in whole or in part by the creation of this media.", ) @@ -202,7 +202,7 @@ class DocumentReference(BaseModel): description="The status of the underlying document.", ) modality_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="modality", description="Imaging modality used. This may include both acquisition and non-acquisition modalities.", ) @@ -212,7 +212,7 @@ class DocumentReference(BaseModel): description="Specifies the particular kind of document referenced (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.", ) category_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="category", description="A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.", ) @@ -222,17 +222,17 @@ class DocumentReference(BaseModel): description="Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).", ) context_field: List[Reference] = Field( - default_factory=list, + default=None, alias="context", description="Describes the clinical encounter or type of care that the document content is associated with.", ) event_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="event", description="This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a History and Physical Report in which the procedure being documented is necessarily a History and Physical act.", ) bodySite_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="bodySite", description="The anatomic structures included in the document.", ) @@ -257,12 +257,12 @@ class DocumentReference(BaseModel): description="When the document reference was created.", ) author_field: List[Reference] = Field( - default_factory=list, + default=None, alias="author", description="Identifies who is responsible for adding the information to the document.", ) attester_field: List[DocumentReferenceAttester] = Field( - default_factory=list, + default=None, alias="attester", description="A participant who has authenticated the accuracy of the document.", ) @@ -272,7 +272,7 @@ class DocumentReference(BaseModel): description="Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.", ) relatesTo_field: List[DocumentReferenceRelatesTo] = Field( - default_factory=list, + default=None, alias="relatesTo", description="Relationships that this document has with other document references that already exist.", ) @@ -282,12 +282,12 @@ class DocumentReference(BaseModel): description="Human-readable description of the source document.", ) securityLabel_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="securityLabel", description="A set of Security-Tag codes specifying the level of privacy/security of the Document found at DocumentReference.content.attachment.url. Note that DocumentReference.meta.security contains the security labels of the data elements in DocumentReference, while DocumentReference.securityLabel contains the security labels for the document the reference refers to. The distinction recognizes that the document may contain sensitive information, while the DocumentReference is metadata about the document and thus might not be as sensitive as the document. For example: a psychotherapy episode may contain highly sensitive information, while the metadata may simply indicate that some episode happened.", ) content_field: List[DocumentReferenceContent] = Field( - default_factory=list, + default=None, alias="content", description="The document and format referenced. If there are multiple content element repetitions, these must all represent the same document in different format, or attachment metadata.", ) diff --git a/healthchain/fhir_resources/encounter.py b/healthchain/fhir_resources/encounter.py index 118fe56..2b96580 100644 --- a/healthchain/fhir_resources/encounter.py +++ b/healthchain/fhir_resources/encounter.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( stringModel, @@ -27,17 +27,17 @@ class EncounterParticipant(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) type_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="type", description="Role of participant in encounter.", ) @@ -60,22 +60,22 @@ class EncounterReason(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) use_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="use", description="What the reason value should be used as e.g. Chief Complaint, Health Concern, Health Maintenance (including screening).", ) value_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="value", description="Reason the encounter takes place, expressed as a code or a reference to another resource. For admissions, this can be used for a coded admission diagnosis.", ) @@ -88,22 +88,22 @@ class EncounterDiagnosis(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) condition_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="condition", description="The coded diagnosis or a reference to a Condition (with other resources referenced in the evidence.detail), the use property will indicate the purpose of this specific diagnosis.", ) use_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="use", description="Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …).", ) @@ -116,12 +116,12 @@ class EncounterAdmission(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -164,12 +164,12 @@ class EncounterLocation(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -196,7 +196,7 @@ class EncounterLocation(BaseModel): class Encounter(BaseModel): - resourceType: str = "Encounter" + resourceType: Literal["Encounter"] = "Encounter" id_field: idModel = Field( default=None, alias="id", @@ -222,19 +222,19 @@ class Encounter(BaseModel): alias="text", description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) - # contained_field: List[ResourceListModel] = Field(default_factory=list, alias="contained", description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.") + # contained_field: List[ResourceListModel] = Field(default=None, alias="contained", description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.") extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="Identifier(s) by which this encounter is known.", ) @@ -244,7 +244,7 @@ class Encounter(BaseModel): description="The current state of the encounter (not the state of the patient within the encounter - that is subjectState).", ) class_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="class", description="Concepts representing classification of patient encounter such as ambulatory (outpatient), inpatient, emergency, home health or others due to local variations.", ) @@ -254,12 +254,12 @@ class Encounter(BaseModel): description="Indicates the urgency of the encounter.", ) type_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="type", description="Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).", ) serviceType_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="serviceType", description="Broad categorization of the service that is to be provided (e.g. cardiology).", ) @@ -274,17 +274,17 @@ class Encounter(BaseModel): description="The subjectStatus value can be used to track the patient's status within the encounter. It details whether the patient has arrived or departed, has been triaged or is currently in a waiting status.", ) episodeOfCare_field: List[Reference] = Field( - default_factory=list, + default=None, alias="episodeOfCare", description="Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem. The association is recorded on the encounter as these are typically created after the episode of care and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).", ) basedOn_field: List[Reference] = Field( - default_factory=list, + default=None, alias="basedOn", description="The request this encounter satisfies (e.g. incoming referral or procedure request).", ) careTeam_field: List[Reference] = Field( - default_factory=list, + default=None, alias="careTeam", description="The group(s) of individuals, organizations that are allocated to participate in this encounter. The participants backbone will record the actuals of when these individuals participated during the encounter.", ) @@ -299,16 +299,16 @@ class Encounter(BaseModel): description="The organization that is primarily responsible for this Encounter's services. This MAY be the same as the organization on the Patient record, however it could be different, such as if the actor performing the services was from an external organization (which may be billed seperately) for an external consultation. Refer to the colonoscopy example on the Encounter examples tab.", ) participant_field: List[EncounterParticipant] = Field( - default_factory=list, + default=None, alias="participant", description="The list of people responsible for providing the service.", ) appointment_field: List[Reference] = Field( - default_factory=list, + default=None, alias="appointment", description="The appointment that scheduled this encounter.", ) - # virtualService_field: List[VirtualServiceDetailModel] = Field(default_factory=list, alias="virtualService", description="Connection details of a virtual service (e.g. conference call).") + # virtualService_field: List[VirtualServiceDetailModel] = Field(default=None, alias="virtualService", description="Connection details of a virtual service (e.g. conference call).") actualPeriod_field: Period = Field( default=None, alias="actualPeriod", @@ -326,32 +326,32 @@ class Encounter(BaseModel): ) # length_field: DurationModel = Field(default=None, alias="length", description="Actual quantity of time the encounter lasted. This excludes the time during leaves of absence.") reason_field: List[EncounterReason] = Field( - default_factory=list, + default=None, alias="reason", description="The list of medical reasons that are expected to be addressed during the episode of care.", ) diagnosis_field: List[EncounterDiagnosis] = Field( - default_factory=list, + default=None, alias="diagnosis", description="The list of diagnosis relevant to this encounter.", ) account_field: List[Reference] = Field( - default_factory=list, + default=None, alias="account", description="The set of accounts that may be used for billing for this Encounter.", ) dietPreference_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="dietPreference", description="Diet preferences reported by the patient.", ) specialArrangement_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="specialArrangement", description="Any special requests that have been made for this encounter, such as the provision of specific equipment or other things.", ) specialCourtesy_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="specialCourtesy", description="Special courtesies that may be provided to the patient during the encounter (VIP, board member, professional courtesy).", ) @@ -361,7 +361,7 @@ class Encounter(BaseModel): description="Details about the stay during which a healthcare service is provided.", ) location_field: List[EncounterLocation] = Field( - default_factory=list, + default=None, alias="location", description="List of locations where the patient has been during this encounter.", ) diff --git a/healthchain/fhir_resources/generalpurpose.py b/healthchain/fhir_resources/generalpurpose.py index 9bc10f5..54f5c21 100644 --- a/healthchain/fhir_resources/generalpurpose.py +++ b/healthchain/fhir_resources/generalpurpose.py @@ -30,7 +30,7 @@ class Extension(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -48,7 +48,7 @@ class Period(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -71,7 +71,7 @@ class Identifier(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -110,7 +110,7 @@ class Coding(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -148,12 +148,12 @@ class CodeableConcept(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) coding_field: List[Coding] = Field( - default_factory=list, + default=None, alias="coding", description="A reference to a code defined by a terminology system.", ) @@ -171,7 +171,7 @@ class Reference(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -204,7 +204,7 @@ class CodeableReference(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -227,7 +227,7 @@ class Narrative(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -246,7 +246,7 @@ class Age(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -282,7 +282,7 @@ class Quantity(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -314,7 +314,7 @@ class Range(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -337,7 +337,7 @@ class Ratio(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -356,17 +356,17 @@ class Timing(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) event_field: List[dateTimeModel] = Field( - default_factory=list, + default=None, alias="event", description="Identifies specific times when the event occurs.", ) @@ -389,12 +389,12 @@ class TimingRepeat(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -456,12 +456,12 @@ class TimingRepeat(BaseModel): ) # Timing_Repeat_periodUnit_field: periodUnitModel = Field(..., alias="periodUnit", description="The units of time for the period in UCUM units") dayOfWeek_field: List[codeModel] = Field( - default_factory=list, + default=None, alias="dayOfWeek", description="If one or more days of week is provided, then the action happens only on the specified day(s).", ) timeOfDay_field: List[timeModel] = Field( - default_factory=list, + default=None, alias="timeOfDay", description="Specified time of day for action to take place.", ) @@ -479,7 +479,7 @@ class Meta(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -499,17 +499,17 @@ class Meta(BaseModel): description="A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", ) profile_field: List[canonicalModel] = Field( - default_factory=list, + default=None, alias="profile", description="A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].", ) security_field: List[Coding] = Field( - default_factory=list, + default=None, alias="security", description="Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", ) tag_field: List[Coding] = Field( - default_factory=list, + default=None, alias="tag", description="Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", ) @@ -522,7 +522,7 @@ class Duration(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -554,7 +554,7 @@ class Annotation(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -582,7 +582,7 @@ class Attachment(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) diff --git a/healthchain/fhir_resources/medicationadministration.py b/healthchain/fhir_resources/medicationadministration.py index d9f1309..00b966e 100644 --- a/healthchain/fhir_resources/medicationadministration.py +++ b/healthchain/fhir_resources/medicationadministration.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( stringModel, @@ -32,12 +32,12 @@ class MedicationAdministrationPerformer(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -60,12 +60,12 @@ class MedicationAdministrationDosage(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -107,7 +107,7 @@ class MedicationAdministrationDosage(BaseModel): class MedicationAdministration(BaseModel): - resourceType_field: str = "MedicationAdministration" + resourceType: Literal["MedicationAdministration"] = "MedicationAdministration" id_field: idModel = Field( default=None, alias="id", @@ -134,32 +134,32 @@ class MedicationAdministration(BaseModel): description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) # contained_field: List[ResourceListModel] = Field( - # default_factory=list, + # default=None, # alias="contained", # description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.", # ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="Identifiers associated with this Medication Administration that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", ) basedOn_field: List[Reference] = Field( - default_factory=list, + default=None, alias="basedOn", description="A plan that is fulfilled in whole or in part by this MedicationAdministration.", ) partOf_field: List[Reference] = Field( - default_factory=list, + default=None, alias="partOf", description="A larger event of which this particular event is a component or step.", ) @@ -169,12 +169,12 @@ class MedicationAdministration(BaseModel): description="Will generally be set to show that the administration has been completed. For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.", ) statusReason_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="statusReason", description="A code indicating why the administration was not performed.", ) category_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="category", description="The type of medication administration (for example, drug classification like ATC, where meds would be administered, legal category of the medication).", ) @@ -194,7 +194,7 @@ class MedicationAdministration(BaseModel): description="The visit, admission, or other contact between patient and health care provider during which the medication administration was performed.", ) supportingInformation_field: List[Reference] = Field( - default_factory=list, + default=None, alias="supportingInformation", description="Additional information (for example, patient height and weight) that supports the administration of the medication. This attribute can be used to provide documentation of specific characteristics of the patient present at the time of administration. For example, if the dose says give x if the heartrate exceeds y, then the heart rate can be included using this attribute.", ) @@ -219,17 +219,17 @@ class MedicationAdministration(BaseModel): description="An indication that the full dose was not administered.", ) subPotentReason_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="subPotentReason", description="The reason or reasons why the full dose was not administered.", ) performer_field: List[MedicationAdministrationPerformer] = Field( - default_factory=list, + default=None, alias="performer", description="The performer of the medication treatment. For devices this is the device that performed the administration of the medication. An IV Pump would be an example of a device that is performing the administration. Both the IV Pump and the practitioner that set the rate or bolus on the pump can be listed as performers.", ) reason_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="reason", description="A code, Condition or observation that supports why the medication was administered.", ) @@ -239,12 +239,12 @@ class MedicationAdministration(BaseModel): description="The original request, instruction or authority to perform the administration.", ) device_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="device", description="The device that is to be used for the administration of the medication (for example, PCA Pump).", ) note_field: List[Annotation] = Field( - default_factory=list, + default=None, alias="note", description="Extra information about the medication administration that is not conveyed by the other attributes.", ) @@ -254,7 +254,7 @@ class MedicationAdministration(BaseModel): description="Describes the medication dosage information details e.g. dose, rate, site, route, etc.", ) eventHistory_field: List[Reference] = Field( - default_factory=list, + default=None, alias="eventHistory", description="A summary of the events of interest that have occurred, such as when the administration was verified.", ) diff --git a/healthchain/fhir_resources/medicationrequest.py b/healthchain/fhir_resources/medicationrequest.py index fb198bb..c2114e2 100644 --- a/healthchain/fhir_resources/medicationrequest.py +++ b/healthchain/fhir_resources/medicationrequest.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( stringModel, @@ -33,12 +33,12 @@ class DosageDoseAndRate(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -77,12 +77,12 @@ class Dosage(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -97,7 +97,7 @@ class Dosage(BaseModel): description="Free text dosage instructions e.g. SIG.", ) additionalInstruction_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="additionalInstruction", description="Supplemental instructions to the patient on how to take the medication (e.g. with meals ortake half to one hour before food) or warnings for the patient about the medication (e.g. may cause drowsiness or avoid exposure of skin to direct sunlight or sunlamps).", ) @@ -117,7 +117,7 @@ class Dosage(BaseModel): description="Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option).", ) asNeededFor_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="asNeededFor", description="Indicates whether the Medication is only taken based on a precondition for taking the Medication (CodeableConcept).", ) @@ -133,12 +133,12 @@ class Dosage(BaseModel): description="Technique for administering medication.", ) doseAndRate_field: List[DosageDoseAndRate] = Field( - default_factory=list, + default=None, alias="doseAndRate", description="Depending on the resource,this is the amount of medication administered, to be administered or typical amount to be administered.", ) maxDosePerPeriod_field: List[Ratio] = Field( - default_factory=list, + default=None, alias="maxDosePerPeriod", description="Upper limit on medication per unit of time.", ) @@ -161,7 +161,7 @@ class Medication(BaseModel): class MedicationRequest(BaseModel): - resourceType_field: str = "MedicationRequest" + resourceType: Literal["MedicationRequest"] = "MedicationRequest" id_field: idModel = Field( default=None, alias="id", @@ -188,27 +188,27 @@ class MedicationRequest(BaseModel): description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) contained_field: List[Medication] = Field( - default_factory=list, + default=None, alias="contained", description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", ) basedOn_field: List[Reference] = Field( - default_factory=list, + default=None, alias="basedOn", description="A plan or request that is fulfilled in whole or in part by this medication request.", ) @@ -243,7 +243,7 @@ class MedicationRequest(BaseModel): description="Whether the request is a proposal, plan, or an original order.", ) category_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="category", description="An arbitrary categorization or grouping of the medication request. It could be used for indicating where meds are intended to be administered, eg. in an inpatient setting or in a patient's home, or a legal category of the medication.", ) @@ -268,7 +268,7 @@ class MedicationRequest(BaseModel): description="The individual or group for whom the medication has been requested.", ) informationSource_field: List[Reference] = Field( - default_factory=list, + default=None, alias="informationSource", description="The person or organization who provided the information about this request, if the source is someone other than the requestor. This is often used when the MedicationRequest is reported by another person.", ) @@ -278,7 +278,7 @@ class MedicationRequest(BaseModel): description="The Encounter during which this [x] was created or to which the creation of this record is tightly associated.", ) supportingInformation_field: List[Reference] = Field( - default_factory=list, + default=None, alias="supportingInformation", description="Information to support fulfilling (i.e. dispensing or administering) of the medication, for example, patient height and weight, a MedicationStatement for the patient).", ) @@ -303,12 +303,12 @@ class MedicationRequest(BaseModel): description="Indicates the type of performer of the administration of the medication.", ) performer_field: List[Reference] = Field( - default_factory=list, + default=None, alias="performer", description="The specified desired performer of the medication treatment (e.g. the performer of the medication administration). For devices, this is the device that is intended to perform the administration of the medication. An IV Pump would be an example of a device that is performing the administration. Both the IV Pump and the practitioner that set the rate or bolus on the pump can be listed as performers.", ) device_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="device", description="The intended type of device that is to be used for the administration of the medication (for example, PCA Pump).", ) @@ -318,7 +318,7 @@ class MedicationRequest(BaseModel): description="The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", ) reason_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="reason", description="The reason or the indication for ordering or not ordering the medication.", ) @@ -328,11 +328,11 @@ class MedicationRequest(BaseModel): description="The description of the overall pattern of the administration of the medication to the patient.", ) insurance_field: List[Reference] = Field( - default_factory=list, + default=None, alias="insurance", description="Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.", ) - # note_field: List[AnnotationModel] = Field(default_factory=list, alias="note", description="Extra information about the prescription that could not be conveyed by the other attributes.") + # note_field: List[AnnotationModel] = Field(default=None, alias="note", description="Extra information about the prescription that could not be conveyed by the other attributes.") # renderedDosageInstruction_field: markdownModel = Field(default=None, alias="renderedDosageInstruction", description="The full representation of the dose of the medication included in all dosage instructions. To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.") effectiveDosePeriod_field: Period = Field( default=None, @@ -340,14 +340,14 @@ class MedicationRequest(BaseModel): description="The period over which the medication is to be taken. Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions.", ) dosageInstruction_field: List[Dosage] = Field( - default_factory=list, + default=None, alias="dosageInstruction", description="Specific instructions for how the medication is to be used by the patient.", ) # dispenseRequest_field: MedicationRequest_DispenseRequestModel = Field(default=None, alias="dispenseRequest", description="Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.") # substitution_field: MedicationRequest_SubstitutionModel = Field(default=None, alias="substitution", description="Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.") eventHistory_field: List[Reference] = Field( - default_factory=list, + default=None, alias="eventHistory", description="Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", ) diff --git a/healthchain/fhir_resources/patient.py b/healthchain/fhir_resources/patient.py index 2065539..5d5c73c 100644 --- a/healthchain/fhir_resources/patient.py +++ b/healthchain/fhir_resources/patient.py @@ -1,5 +1,5 @@ from pydantic import Field, BaseModel -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( idModel, @@ -28,7 +28,7 @@ class Address(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -46,7 +46,7 @@ class Address(BaseModel): description="Specifies the entire address as it should be displayed e.g. on a postal label. This may be provided instead of or as well as the specific parts.", ) line_field: List[stringModel] = Field( - default_factory=list, + default=None, alias="line", description="This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.", ) @@ -89,7 +89,7 @@ class ContactPoint(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -127,7 +127,7 @@ class HumanName(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) @@ -145,15 +145,15 @@ class HumanName(BaseModel): description="The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.", ) given_field: List[stringModel] = Field( - default_factory=list, alias="given", description="Given name." + default=None, alias="given", description="Given name." ) prefix_field: List[stringModel] = Field( - default_factory=list, + default=None, alias="prefix", description="Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.", ) suffix_field: List[stringModel] = Field( - default_factory=list, + default=None, alias="suffix", description="Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.", ) @@ -171,12 +171,12 @@ class PatientLink(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -199,17 +199,17 @@ class PatientContact(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) relationship_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="relationship", description="The nature of the relationship between the patient and the contact person.", ) @@ -219,7 +219,7 @@ class PatientContact(BaseModel): description="A name associated with the contact person.", ) telecom_field: List[ContactPoint] = Field( - default_factory=list, + default=None, alias="telecom", description="A contact detail for the person, e.g. a telephone number or an email address.", ) @@ -250,12 +250,12 @@ class PatientCommunication(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -272,7 +272,7 @@ class PatientCommunication(BaseModel): class Patient(BaseModel): - resourceType: str = "Patient" + resourceType: Literal["Patient"] = "Patient" id_field: idModel = Field( default=None, alias="id", @@ -299,19 +299,19 @@ class Patient(BaseModel): alias="text", description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) - # contained_field: List[ResourceListModel] = Field(default_factory=list, alias="contained", description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.") + # contained_field: List[ResourceListModel] = Field(default=None, alias="contained", description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.") extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="An identifier for this patient.", ) @@ -321,12 +321,12 @@ class Patient(BaseModel): description="Whether this patient record is in active use. ", ) name_field: List[HumanName] = Field( - default_factory=list, + default=None, alias="name", description="A name associated with the individual.", ) telecom_field: List[ContactPoint] = Field( - default_factory=list, + default=None, alias="telecom", description="A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.", ) @@ -341,7 +341,7 @@ class Patient(BaseModel): description="The date of birth for the individual.", ) address_field: List[Address] = Field( - default_factory=list, + default=None, alias="address", description="An address for the individual.", ) @@ -350,19 +350,19 @@ class Patient(BaseModel): alias="maritalStatus", description="This field contains a patient's most recent marital (civil) status.", ) - # photo_field: List[AttachmentModel] = Field(default_factory=list, alias="photo", description="Image of the patient.") + # photo_field: List[AttachmentModel] = Field(default=None, alias="photo", description="Image of the patient.") contact_field: List[PatientContact] = Field( - default_factory=list, + default=None, alias="contact", description="A contact party (e.g. guardian, partner, friend) for the patient.", ) communication_field: List[PatientCommunication] = Field( - default_factory=list, + default=None, alias="communication", description="A language which may be used to communicate with the patient about his or her health.", ) generalPractitioner_field: List[Reference] = Field( - default_factory=list, + default=None, alias="generalPractitioner", description="Patient's nominated care provider.", ) @@ -372,7 +372,7 @@ class Patient(BaseModel): description="Organization that is the custodian of the patient record.", ) link_field: List[PatientLink] = Field( - default_factory=list, + default=None, alias="link", description="Link to a Patient or RelatedPerson resource that concerns the same actual individual.", ) diff --git a/healthchain/fhir_resources/practitioner.py b/healthchain/fhir_resources/practitioner.py index b9d4778..ca7ced0 100644 --- a/healthchain/fhir_resources/practitioner.py +++ b/healthchain/fhir_resources/practitioner.py @@ -1,5 +1,5 @@ from pydantic import Field, BaseModel -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( idModel, @@ -32,17 +32,17 @@ class PractitionerQualification(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="An identifier that applies to this person's qualification.", ) @@ -70,12 +70,12 @@ class PractitionerCommunication(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -92,7 +92,7 @@ class PractitionerCommunication(BaseModel): class Practitioner(BaseModel): - resourceType: str = "Practitioner" + resourceType: Literal["Practitioner"] = "Practitioner" id_field: idModel = Field( default=None, alias="id", @@ -118,19 +118,19 @@ class Practitioner(BaseModel): alias="text", description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) - # contained_field: List[ResourceListModel] = Field(default_factory=list, alias="contained", description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.") + # contained_field: List[ResourceListModel] = Field(default=None, alias="contained", description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.") extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="An identifier that applies to this person in this role.", ) @@ -140,12 +140,12 @@ class Practitioner(BaseModel): description="Whether this practitioner's record is in active use.", ) name_field: List[HumanName] = Field( - default_factory=list, + default=None, alias="name", description="The name(s) associated with the practitioner.", ) telecom_field: List[ContactPoint] = Field( - default_factory=list, + default=None, alias="telecom", description="A contact detail for the practitioner, e.g. a telephone number or an email address.", ) @@ -160,18 +160,18 @@ class Practitioner(BaseModel): description="The date of birth for the practitioner.", ) address_field: List[Address] = Field( - default_factory=list, + default=None, alias="address", description="Address(es) of the practitioner that are not role specific (typically home address). ", ) - # photo_field: List[AttachmentModel] = Field(default_factory=list, alias="photo", description="Image of the person.") + # photo_field: List[AttachmentModel] = Field(default=None, alias="photo", description="Image of the person.") qualification_field: List[PractitionerQualification] = Field( - default_factory=list, + default=None, alias="qualification", description="The official qualifications, certifications, accreditations, training, licenses (and other types of educations/skills/capabilities) that authorize or otherwise pertain to the provision of care by the practitioner.", ) communication_field: List[PractitionerCommunication] = Field( - default_factory=list, + default=None, alias="communication", description="A language which may be used to communicate with the practitioner, often for correspondence/administrative purposes.", ) diff --git a/healthchain/fhir_resources/procedure.py b/healthchain/fhir_resources/procedure.py index 262dd4c..f05643e 100644 --- a/healthchain/fhir_resources/procedure.py +++ b/healthchain/fhir_resources/procedure.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from typing import List +from typing import List, Literal from healthchain.fhir_resources.primitives import ( stringModel, @@ -31,12 +31,12 @@ class ProcedurePerformer(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -69,12 +69,12 @@ class ProcedureFocalDevice(BaseModel): description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) @@ -91,7 +91,7 @@ class ProcedureFocalDevice(BaseModel): class Procedure(BaseModel): - resourceType: str = "Procedure" + resourceType: Literal["Procedure"] = "Procedure" id_field: idModel = Field( default=None, alias="id", @@ -118,42 +118,42 @@ class Procedure(BaseModel): description="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it clinically safe for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", ) # contained_field: List[ResourceListModel] = Field( - # default_factory=list, + # default=None, # alias="contained", # description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.", # ) extension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="extension", description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", ) modifierExtension_field: List[Extension] = Field( - default_factory=list, + default=None, alias="modifierExtension", description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", ) identifier_field: List[Identifier] = Field( - default_factory=list, + default=None, alias="identifier", description="Business identifiers assigned to this procedure by the performer or other systems which remain constant as the resource is updated and is propagated from server to server.", ) instantiatesCanonical_field: List[canonicalModel] = Field( - default_factory=list, + default=None, alias="instantiatesCanonical", description="The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.", ) instantiatesUri_field: List[uriModel] = Field( - default_factory=list, + default=None, alias="instantiatesUri", description="The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.", ) basedOn_field: List[Reference] = Field( - default_factory=list, + default=None, alias="basedOn", description="A reference to a resource that contains details of the request for this procedure.", ) partOf_field: List[Reference] = Field( - default_factory=list, + default=None, alias="partOf", description="A larger event of which this particular procedure is a component or step.", ) @@ -168,7 +168,7 @@ class Procedure(BaseModel): description="Captures the reason for the current state of the procedure.", ) category_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="category", description="A code that classifies the procedure for searching, sorting and display purposes (e.g. Surgical Procedure).", ) @@ -228,7 +228,7 @@ class Procedure(BaseModel): description="Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", ) performer_field: List[ProcedurePerformer] = Field( - default_factory=list, + default=None, alias="performer", description="Indicates who or what performed the procedure and how they were involved.", ) @@ -238,12 +238,12 @@ class Procedure(BaseModel): description="The location where the procedure actually happened. E.g. a newborn at home, a tracheostomy at a restaurant.", ) reason_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="reason", description="The coded reason or reference why the procedure was performed. This may be a coded entity of some type, be present as text, or be a reference to one of several resources that justify the procedure.", ) bodySite_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="bodySite", description="Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.", ) @@ -253,37 +253,37 @@ class Procedure(BaseModel): description="The outcome of the procedure - did it resolve the reasons for the procedure being performed?", ) report_field: List[Reference] = Field( - default_factory=list, + default=None, alias="report", description="This could be a histology result, pathology report, surgical report, etc.", ) complication_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="complication", description="Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.", ) followUp_field: List[CodeableConcept] = Field( - default_factory=list, + default=None, alias="followUp", description="If the procedure required specific follow up - e.g. removal of sutures. The follow up may be represented as a simple note or could potentially be more complex, in which case the CarePlan resource can be used.", ) # note_field: List[AnnotationModel] = Field( - # default_factory=list, + # default=None, # alias="note", # description="Any other notes and comments about the procedure.", # ) focalDevice_field: List[ProcedureFocalDevice] = Field( - default_factory=list, + default=None, alias="focalDevice", description="A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.", ) used_field: List[CodeableReference] = Field( - default_factory=list, + default=None, alias="used", description="Identifies medications, devices and any other substance used as part of the procedure.", ) supportingInfo_field: List[Reference] = Field( - default_factory=list, + default=None, alias="supportingInfo", description="Other resources from the patient record that may be relevant to the procedure. The information from these resources was either used to create the instance or is provided to help with its interpretation. This extension should not be used if more specific inline elements or extensions are available.", ) diff --git a/healthchain/fhir_resources/resourceregistry.py b/healthchain/fhir_resources/resourceregistry.py index e581f04..87f70e3 100644 --- a/healthchain/fhir_resources/resourceregistry.py +++ b/healthchain/fhir_resources/resourceregistry.py @@ -45,7 +45,6 @@ class UnimplementedResourceRegistry(Enum): CompartmentDefinition: str = "CompartmentDefinition" Composition: str = "Composition" ConceptMap: str = "ConceptMap" - ConditionDefinition: str = "ConditionDefinition" Consent: str = "Consent" Contract: str = "Contract" diff --git a/tests/generators_tests/test_encounter_generators.py b/tests/generators_tests/test_encounter_generators.py index 1c01985..27a1008 100644 --- a/tests/generators_tests/test_encounter_generators.py +++ b/tests/generators_tests/test_encounter_generators.py @@ -33,8 +33,5 @@ def test_EncounterModel(): "discharged", "cancelled", ) - assert encounter.class_field is not None - assert encounter.type_field is not None - assert encounter.subject_field is not None assert encounter.subject_field.reference_field == "Patient/123" assert encounter.subject_field.display_field == "Patient/123" diff --git a/tests/generators_tests/test_medication_request_generators.py b/tests/generators_tests/test_medication_request_generators.py index 2a1537b..b7b8c0c 100644 --- a/tests/generators_tests/test_medication_request_generators.py +++ b/tests/generators_tests/test_medication_request_generators.py @@ -14,5 +14,5 @@ def test_MedicationRequestGenerator(): generator = MedicationRequestGenerator() medication_request = generator.generate() assert medication_request is not None - assert medication_request.resourceType_field == "MedicationRequest" + assert medication_request.resourceType == "MedicationRequest" assert medication_request.id_field is not None