Skip to content

Commit

Permalink
Replace the FHIR empty list default with None (#41)
Browse files Browse the repository at this point in the history
* Added workflows to publish documentation and removed as dependencies in poetry

* Update README

* Update README

* Add logo

* Fix run command

* Add assets

* Edit index page cards and why hc section

* Edit text and checked working code samples

* Add contributing guidelines link

* Change pydantic model dump to exclude unset

* Remove markdown validation in CDSResponse

* Fix timeout issue

* Fix tests

* README

* Switch json parser for csv

* add exception for file not found

* replace list with none

* fix resource type bug

* simpler alternative to constant

---------

Co-authored-by: jenniferajiang <[email protected]>
Co-authored-by: adam-kells-ab <[email protected]>
  • Loading branch information
3 people authored Jun 20, 2024
1 parent add3e7a commit c45f8af
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 232 deletions.
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

Expand All @@ -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,
Expand Down Expand Up @@ -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.",
)
Expand All @@ -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.",
)
Expand All @@ -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.",
)
Expand All @@ -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",
Expand All @@ -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.",
)
Expand All @@ -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.",
)
Expand All @@ -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.",
)
Expand Down Expand Up @@ -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

0 comments on commit c45f8af

Please sign in to comment.