Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the FHIR empty list default with None #41

Merged
merged 22 commits into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions healthchain/fhir_resources/bundleresources.py
Original file line number Diff line number Diff line change
@@ -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).",
)
34 changes: 17 additions & 17 deletions healthchain/fhir_resources/condition.py
Original file line number Diff line number Diff line change
@@ -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.",
)
Loading