Example #1
0
class PractitionerRole(domainresource.DomainResource):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Roles/organizations the practitioner is associated with.
    A specific set of Roles/Locations/specialties/services that a practitioner
    may perform at an organization for a period of time.
    """

    resource_type = Field("PractitionerRole", const=True)

    active: bool = Field(
        None,
        alias="active",
        title="Whether this practitioner role record is in active use",
        description=None,
        # if property is element of this resource.
        element_property=True,
    )
    active__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_active", title="Extension field for ``active``.")

    availabilityExceptions: fhirtypes.String = Field(
        None,
        alias="availabilityExceptions",
        title="Description of availability exceptions",
        description=
        ("A description of site availability exceptions, e.g. public holiday "
         "availability. Succinctly describing all possible exceptions to normal "
         "site availability as details in the available Times and not available "
         "Times."),
        # if property is element of this resource.
        element_property=True,
    )
    availabilityExceptions__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_availabilityExceptions",
        title="Extension field for ``availabilityExceptions``.",
    )

    availableTime: ListType[fhirtypes.PractitionerRoleAvailableTimeType] = Field(
        None,
        alias="availableTime",
        title="Times the Service Site is available",
        description=
        ("A collection of times the practitioner is available or performing this"
         " role at the location and/or healthcareservice."),
        # if property is element of this resource.
        element_property=True,
    )

    code: ListType[fhirtypes.CodeableConceptType] = Field(
        None,
        alias="code",
        title="Roles which this practitioner may perform",
        description=(
            "Roles which this practitioner is authorized to perform for the "
            "organization."),
        # if property is element of this resource.
        element_property=True,
    )

    endpoint: ListType[fhirtypes.ReferenceType] = Field(
        None,
        alias="endpoint",
        title=(
            "Technical endpoints providing access to services operated for the "
            "practitioner with this role"),
        description=None,
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Endpoint"],
    )

    healthcareService: ListType[fhirtypes.ReferenceType] = Field(
        None,
        alias="healthcareService",
        title=
        ("The list of healthcare services that this worker provides for this "
         "role's Organization/Location(s)"),
        description=None,
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["HealthcareService"],
    )

    identifier: ListType[fhirtypes.IdentifierType] = Field(
        None,
        alias="identifier",
        title="Business Identifiers that are specific to a role/location",
        description=None,
        # if property is element of this resource.
        element_property=True,
    )

    location: ListType[fhirtypes.ReferenceType] = Field(
        None,
        alias="location",
        title="The location(s) at which this practitioner provides care",
        description=None,
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Location"],
    )

    notAvailable: ListType[fhirtypes.PractitionerRoleNotAvailableType] = Field(
        None,
        alias="notAvailable",
        title="Not available during this time due to provided reason",
        description=
        ("The practitioner is not available or performing this role during this "
         "period of time due to the provided reason."),
        # if property is element of this resource.
        element_property=True,
    )

    organization: fhirtypes.ReferenceType = Field(
        None,
        alias="organization",
        title="Organization where the roles are available",
        description=
        "The organization where the Practitioner performs the roles associated.",
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Organization"],
    )

    period: fhirtypes.PeriodType = Field(
        None,
        alias="period",
        title=
        ("The period during which the practitioner is authorized to perform in "
         "these role(s)"),
        description=(
            "The period during which the person is authorized to act as a "
            "practitioner in these role(s) for the organization."),
        # if property is element of this resource.
        element_property=True,
    )

    practitioner: fhirtypes.ReferenceType = Field(
        None,
        alias="practitioner",
        title=(
            "Practitioner that is able to provide the defined services for the "
            "organization"),
        description=None,
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Practitioner"],
    )

    specialty: ListType[fhirtypes.CodeableConceptType] = Field(
        None,
        alias="specialty",
        title="Specific specialty of the practitioner",
        description=None,
        # if property is element of this resource.
        element_property=True,
    )

    telecom: ListType[fhirtypes.ContactPointType] = Field(
        None,
        alias="telecom",
        title="Contact details that are specific to the role/location/service",
        description=None,
        # if property is element of this resource.
        element_property=True,
    )
Example #2
0
class GraphExpenditureAttributesConfig(BaseModel):
    sup_opp: str = Field(None, min_length=1, max_length=1)
    purpose: str = Field(None)
    amndt_ind: str = Field(None, min_length=1, max_length=2)
    gt: int = Field(None)
    lte: int = Field(None)
Example #3
0
class DataListConfig(BaseModel):
    terms: List[str] = Field(None)
    ids: List[str] = Field(None)
Example #4
0
class DatesConfig(BaseModel):
    min: datetime.date = Field(
        datetime.datetime.strptime('2020-01-01', '%Y-%m-%d').date())
    max: datetime.date = Field(datetime.datetime.now().date())
Example #5
0
class GraphDonorAttributesConfig(BaseModel):
    employer: str = Field(None)
    occupation: str = Field(None)
    state: str = Field(None, min_length=2, max_length=2)
    zip_code: int = Field(None, ge=500, le=99999)
    entity_tp: str = Field(None, min_length=3, max_length=3)
Example #6
0
 class Config(BaseConfig):
     username: str = Field('phantie', allow_mutation = False)
     password: int = Field(21, allow_mutation = False)
Example #7
0
class Identifier(datatype.DataType):
    """Disclaimer: Any field name ends with ``__ext`` doesn't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    An identifier intended for computation.
    An identifier - identifies some entity uniquely and unambiguously.
    Typically this is used for business identifiers.
    """

    resource_type = Field("Identifier", const=True)

    assigner: fhirtypes.ReferenceType = Field(
        None,
        alias="assigner",
        title="Organization that issued id (may be just text)",
        description="Organization that issued/manages the identifier.",
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Organization"],
    )

    period: fhirtypes.PeriodType = Field(
        None,
        alias="period",
        title="Time period when id is/was valid for use",
        description="Time period during which identifier is/was valid for use.",
        # if property is element of this resource.
        element_property=True,
    )

    system: fhirtypes.Uri = Field(
        None,
        alias="system",
        title="The namespace for the identifier value",
        description=(
            "Establishes the namespace for the value - that is, a URL that "
            "describes a set values that are unique."
        ),
        # if property is element of this resource.
        element_property=True,
    )
    system__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_system", title="Extension field for ``system``."
    )

    type: fhirtypes.CodeableConceptType = Field(
        None,
        alias="type",
        title="Description of identifier",
        description=(
            "A coded type for the identifier that can be used to determine which "
            "identifier to use for a specific purpose."
        ),
        # if property is element of this resource.
        element_property=True,
    )

    use: fhirtypes.Code = Field(
        None,
        alias="use",
        title="usual | official | temp | secondary | old (If known)",
        description="The purpose of this identifier.",
        # if property is element of this resource.
        element_property=True,
        # note: Enum values can be used in validation,
        # but use in your own responsibilities, read official FHIR documentation.
        enum_values=["usual", "official", "temp", "secondary", "old"],
    )
    use__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_use", title="Extension field for ``use``."
    )

    value: fhirtypes.String = Field(
        None,
        alias="value",
        title="The value that is unique",
        description=(
            "The portion of the identifier typically relevant to the user and which"
            " is unique within the context of the system."
        ),
        # if property is element of this resource.
        element_property=True,
    )
    value__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_value", title="Extension field for ``value``."
    )

    @classmethod
    def elements_sequence(cls):
        """returning all elements names from ``Identifier`` according specification,
        with preserving original sequence order.
        """
        return [
            "id",
            "extension",
            "use",
            "type",
            "system",
            "value",
            "period",
            "assigner",
        ]
Example #8
0
class ImplementationGuideDefinitionPage(backboneelement.BackboneElement):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Page/Section in the Guide.
    A page / section in the implementation guide. The root page is the
    implementation guide home page.
    """

    resource_type = Field("ImplementationGuideDefinitionPage", const=True)

    generation: fhirtypes.Code = Field(
        ...,
        alias="generation",
        title="html | markdown | xml | generated",
        description="A code that indicates how the page is generated.",
        # if property is element of this resource.
        element_property=True,
        # note: Enum values can be used in validation,
        # but use in your own responsibilities, read official FHIR documentation.
        enum_values=["html", "markdown", "xml", "generated"],
    )
    generation__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_generation", title="Extension field for ``generation``.")

    nameReference: fhirtypes.ReferenceType = Field(
        None,
        alias="nameReference",
        title="Where to find that page",
        description="The source address for the page.",
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e name[x]
        one_of_many="name",
        one_of_many_required=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Binary"],
    )

    nameUrl: fhirtypes.Url = Field(
        None,
        alias="nameUrl",
        title="Where to find that page",
        description="The source address for the page.",
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e name[x]
        one_of_many="name",
        one_of_many_required=True,
    )
    nameUrl__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_nameUrl", title="Extension field for ``nameUrl``.")

    page: ListType[fhirtypes.ImplementationGuideDefinitionPageType] = Field(
        None,
        alias="page",
        title="Nested Pages / Sections",
        description="Nested Pages/Sections under this page.",
        # if property is element of this resource.
        element_property=True,
    )

    title: fhirtypes.String = Field(
        ...,
        alias="title",
        title="Short title shown for navigational assistance",
        description=
        ("A short title used to represent this page in navigational structures "
         "such as table of contents, bread crumbs, etc."),
        # if property is element of this resource.
        element_property=True,
    )
    title__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_title", title="Extension field for ``title``.")

    @root_validator(pre=True)
    def validate_one_of_many(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        """https://www.hl7.org/fhir/formats.html#choice
        A few elements have a choice of more than one data type for their content.
        All such elements have a name that takes the form nnn[x].
        The "nnn" part of the name is constant, and the "[x]" is replaced with
        the title-cased name of the type that is actually used.
        The table view shows each of these names explicitly.

        Elements that have a choice of data type cannot repeat - they must have a
        maximum cardinality of 1. When constructing an instance of an element with a
        choice of types, the authoring system must create a single element with a
        data type chosen from among the list of permitted data types.
        """
        one_of_many_fields = {"name": ["nameReference", "nameUrl"]}
        for prefix, fields in one_of_many_fields.items():
            assert cls.__fields__[
                fields[0]].field_info.extra["one_of_many"] == prefix
            required = (cls.__fields__[
                fields[0]].field_info.extra["one_of_many_required"] is True)
            found = False
            for field in fields:
                if field in values and values[field] is not None:
                    if found is True:
                        raise ValueError(
                            "Any of one field value is expected from "
                            f"this list {fields}, but got multiple!")
                    else:
                        found = True
            if required is True and found is False:
                raise ValueError(
                    f"Expect any of field value from this list {fields}.")

        return values
Example #9
0
class ImplementationGuideDefinitionResource(backboneelement.BackboneElement):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Resource in the implementation guide.
    A resource that is part of the implementation guide. Conformance resources
    (value set, structure definition, capability statements etc.) are obvious
    candidates for inclusion, but any kind of resource can be included as an
    example resource.
    """

    resource_type = Field("ImplementationGuideDefinitionResource", const=True)

    description: fhirtypes.String = Field(
        None,
        alias="description",
        title="Reason why included in guide",
        description=
        ("A description of the reason that a resource has been included in the "
         "implementation guide."),
        # if property is element of this resource.
        element_property=True,
    )
    description__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_description",
        title="Extension field for ``description``.")

    exampleBoolean: bool = Field(
        None,
        alias="exampleBoolean",
        title="Is an example/What is this an example of?",
        description=
        ("If true or a reference, indicates the resource is an example instance."
         "  If a reference is present, indicates that the example is an example "
         "of the specified profile."),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e example[x]
        one_of_many="example",
        one_of_many_required=False,
    )
    exampleBoolean__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_exampleBoolean",
        title="Extension field for ``exampleBoolean``.")

    exampleCanonical: fhirtypes.Canonical = Field(
        None,
        alias="exampleCanonical",
        title="Is an example/What is this an example of?",
        description=
        ("If true or a reference, indicates the resource is an example instance."
         "  If a reference is present, indicates that the example is an example "
         "of the specified profile."),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e example[x]
        one_of_many="example",
        one_of_many_required=False,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["StructureDefinition"],
    )
    exampleCanonical__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_exampleCanonical",
        title="Extension field for ``exampleCanonical``.",
    )

    fhirVersion: ListType[fhirtypes.Code] = Field(
        None,
        alias="fhirVersion",
        title="Versions this applies to (if different to IG)",
        description=
        ("Indicates the FHIR Version(s) this artifact is intended to apply to. "
         "If no versions are specified, the resource is assumed to apply to all "
         "the versions stated in ImplementationGuide.fhirVersion."),
        # if property is element of this resource.
        element_property=True,
    )
    fhirVersion__ext: ListType[
        Union[fhirtypes.FHIRPrimitiveExtensionType,
              None]] = Field(None,
                             alias="_fhirVersion",
                             title="Extension field for ``fhirVersion``.")

    groupingId: fhirtypes.Id = Field(
        None,
        alias="groupingId",
        title="Grouping this is part of",
        description=
        "Reference to the id of the grouping this resource appears in.",
        # if property is element of this resource.
        element_property=True,
    )
    groupingId__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_groupingId", title="Extension field for ``groupingId``.")

    name: fhirtypes.String = Field(
        None,
        alias="name",
        title="Human Name for the resource",
        description=
        ("A human assigned name for the resource. All resources SHOULD have a "
         "name, but the name may be extracted from the resource (e.g. "
         "ValueSet.name)."),
        # if property is element of this resource.
        element_property=True,
    )
    name__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_name", title="Extension field for ``name``.")

    reference: fhirtypes.ReferenceType = Field(
        ...,
        alias="reference",
        title="Location of the resource",
        description="Where this resource is found.",
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Resource"],
    )

    @root_validator(pre=True)
    def validate_one_of_many(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        """https://www.hl7.org/fhir/formats.html#choice
        A few elements have a choice of more than one data type for their content.
        All such elements have a name that takes the form nnn[x].
        The "nnn" part of the name is constant, and the "[x]" is replaced with
        the title-cased name of the type that is actually used.
        The table view shows each of these names explicitly.

        Elements that have a choice of data type cannot repeat - they must have a
        maximum cardinality of 1. When constructing an instance of an element with a
        choice of types, the authoring system must create a single element with a
        data type chosen from among the list of permitted data types.
        """
        one_of_many_fields = {
            "example": ["exampleBoolean", "exampleCanonical"]
        }
        for prefix, fields in one_of_many_fields.items():
            assert cls.__fields__[
                fields[0]].field_info.extra["one_of_many"] == prefix
            required = (cls.__fields__[
                fields[0]].field_info.extra["one_of_many_required"] is True)
            found = False
            for field in fields:
                if field in values and values[field] is not None:
                    if found is True:
                        raise ValueError(
                            "Any of one field value is expected from "
                            f"this list {fields}, but got multiple!")
                    else:
                        found = True
            if required is True and found is False:
                raise ValueError(
                    f"Expect any of field value from this list {fields}.")

        return values
Example #10
0
class ImplementationGuide(domainresource.DomainResource):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    A set of rules about how FHIR is used.
    A set of rules of how a particular interoperability or standards problem is
    solved - typically through the use of FHIR resources. This resource is used
    to gather all the parts of an implementation guide into a logical whole and
    to publish a computable definition of all the parts.
    """

    resource_type = Field("ImplementationGuide", const=True)

    contact: ListType[fhirtypes.ContactDetailType] = Field(
        None,
        alias="contact",
        title="Contact details for the publisher",
        description=
        ("Contact details to assist a user in finding and communicating with the"
         " publisher."),
        # if property is element of this resource.
        element_property=True,
    )

    copyright: fhirtypes.Markdown = Field(
        None,
        alias="copyright",
        title="Use and/or publishing restrictions",
        description=
        ("A copyright statement relating to the implementation guide and/or its "
         "contents. Copyright statements are generally legal restrictions on the"
         " use and publishing of the implementation guide."),
        # if property is element of this resource.
        element_property=True,
    )
    copyright__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_copyright", title="Extension field for ``copyright``.")

    date: fhirtypes.DateTime = Field(
        None,
        alias="date",
        title="Date last changed",
        description=
        ("The date  (and optionally time) when the implementation guide was "
         "published. The date must change when the business version changes and "
         "it must change if the status code changes. In addition, it should "
         "change when the substantive content of the implementation guide "
         "changes."),
        # if property is element of this resource.
        element_property=True,
    )
    date__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_date", title="Extension field for ``date``.")

    definition: fhirtypes.ImplementationGuideDefinitionType = Field(
        None,
        alias="definition",
        title="Information needed to build the IG",
        description=
        ("The information needed by an IG publisher tool to publish the whole "
         "implementation guide."),
        # if property is element of this resource.
        element_property=True,
    )

    dependsOn: ListType[fhirtypes.ImplementationGuideDependsOnType] = Field(
        None,
        alias="dependsOn",
        title="Another Implementation guide this depends on",
        description=(
            "Another implementation guide that this implementation depends on. "
            "Typically, an implementation guide uses value sets, profiles "
            "etc.defined in other implementation guides."),
        # if property is element of this resource.
        element_property=True,
    )

    description: fhirtypes.Markdown = Field(
        None,
        alias="description",
        title="Natural language description of the implementation guide",
        description=
        ("A free text natural language description of the implementation guide "
         "from a consumer's perspective."),
        # if property is element of this resource.
        element_property=True,
    )
    description__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_description",
        title="Extension field for ``description``.")

    experimental: bool = Field(
        None,
        alias="experimental",
        title="For testing purposes, not real usage",
        description=
        ("A Boolean value to indicate that this implementation guide is authored"
         " for testing purposes (or education/evaluation/marketing) and is not "
         "intended to be used for genuine usage."),
        # if property is element of this resource.
        element_property=True,
    )
    experimental__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_experimental",
        title="Extension field for ``experimental``.")

    fhirVersion: ListType[fhirtypes.Code] = Field(
        ...,
        alias="fhirVersion",
        title="FHIR Version(s) this Implementation Guide targets",
        description=
        ("The version(s) of the FHIR specification that this ImplementationGuide"
         " targets - e.g. describes how to use. The value of this element is the"
         " formal version of the specification, without the revision number, "
         "e.g. [publication].[major].[minor], which is 4.0.1. for this version."
         ),
        # if property is element of this resource.
        element_property=True,
    )
    fhirVersion__ext: ListType[
        Union[fhirtypes.FHIRPrimitiveExtensionType,
              None]] = Field(None,
                             alias="_fhirVersion",
                             title="Extension field for ``fhirVersion``.")

    global_fhir: ListType[fhirtypes.ImplementationGuideGlobalType] = Field(
        None,
        alias="global",
        title="Profiles that apply globally",
        description=
        ("A set of profiles that all resources covered by this implementation "
         "guide must conform to."),
        # if property is element of this resource.
        element_property=True,
    )

    jurisdiction: ListType[fhirtypes.CodeableConceptType] = Field(
        None,
        alias="jurisdiction",
        title="Intended jurisdiction for implementation guide (if applicable)",
        description=(
            "A legal or geographic region in which the implementation guide is "
            "intended to be used."),
        # if property is element of this resource.
        element_property=True,
    )

    license: fhirtypes.Code = Field(
        None,
        alias="license",
        title="SPDX license code for this IG (or not-open-source)",
        description=
        ("The license that applies to this Implementation Guide, using an SPDX "
         "license code, or 'not-open-source'."),
        # if property is element of this resource.
        element_property=True,
    )
    license__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_license", title="Extension field for ``license``.")

    manifest: fhirtypes.ImplementationGuideManifestType = Field(
        None,
        alias="manifest",
        title="Information about an assembled IG",
        description=
        ("Information about an assembled implementation guide, created by the "
         "publication tooling."),
        # if property is element of this resource.
        element_property=True,
    )

    name: fhirtypes.String = Field(
        ...,
        alias="name",
        title="Name for this implementation guide (computer friendly)",
        description=
        ("A natural language name identifying the implementation guide. This "
         "name should be usable as an identifier for the module by machine "
         "processing applications such as code generation."),
        # if property is element of this resource.
        element_property=True,
    )
    name__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_name", title="Extension field for ``name``.")

    packageId: fhirtypes.Id = Field(
        ...,
        alias="packageId",
        title="NPM Package name for IG",
        description=
        ("The NPM package name for this Implementation Guide, used in the NPM "
         "package distribution, which is the primary mechanism by which FHIR "
         "based tooling manages IG dependencies. This value must be globally "
         "unique, and should be assigned with care."),
        # if property is element of this resource.
        element_property=True,
    )
    packageId__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_packageId", title="Extension field for ``packageId``.")

    publisher: fhirtypes.String = Field(
        None,
        alias="publisher",
        title="Name of the publisher (organization or individual)",
        description=(
            "The name of the organization or individual that published the "
            "implementation guide."),
        # if property is element of this resource.
        element_property=True,
    )
    publisher__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_publisher", title="Extension field for ``publisher``.")

    status: fhirtypes.Code = Field(
        ...,
        alias="status",
        title="draft | active | retired | unknown",
        description=
        ("The status of this implementation guide. Enables tracking the life-"
         "cycle of the content."),
        # if property is element of this resource.
        element_property=True,
        # note: Enum values can be used in validation,
        # but use in your own responsibilities, read official FHIR documentation.
        enum_values=["draft", "active", "retired", "unknown"],
    )
    status__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_status", title="Extension field for ``status``.")

    title: fhirtypes.String = Field(
        None,
        alias="title",
        title="Name for this implementation guide (human friendly)",
        description=(
            "A short, descriptive, user-friendly title for the implementation "
            "guide."),
        # if property is element of this resource.
        element_property=True,
    )
    title__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_title", title="Extension field for ``title``.")

    url: fhirtypes.Uri = Field(
        ...,
        alias="url",
        title=
        ("Canonical identifier for this implementation guide, represented as a "
         "URI (globally unique)"),
        description=
        ("An absolute URI that is used to identify this implementation guide "
         "when it is referenced in a specification, model, design or an "
         "instance; also called its canonical identifier. This SHOULD be "
         "globally unique and SHOULD be a literal address at which at which an "
         "authoritative instance of this implementation guide is (or will be) "
         "published. This URL can be the target of a canonical reference. It "
         "SHALL remain the same when the implementation guide is stored on "
         "different servers."),
        # if property is element of this resource.
        element_property=True,
    )
    url__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_url", title="Extension field for ``url``.")

    useContext: ListType[fhirtypes.UsageContextType] = Field(
        None,
        alias="useContext",
        title="The context that the content is intended to support",
        description=
        ("The content was developed with a focus and intent of supporting the "
         "contexts that are listed. These contexts may be general categories "
         "(gender, age, ...) or may be references to specific programs "
         "(insurance plans, studies, ...) and may be used to assist with "
         "indexing and searching for appropriate implementation guide instances."
         ),
        # if property is element of this resource.
        element_property=True,
    )

    version: fhirtypes.String = Field(
        None,
        alias="version",
        title="Business version of the implementation guide",
        description=
        ("The identifier that is used to identify this version of the "
         "implementation guide when it is referenced in a specification, model, "
         "design or instance. This is an arbitrary value managed by the "
         "implementation guide author and is not expected to be globally unique."
         " For example, it might be a timestamp (e.g. yyyymmdd) if a managed "
         "version is not available. There is also no expectation that versions "
         "can be placed in a lexicographical sequence."),
        # if property is element of this resource.
        element_property=True,
    )
    version__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_version", title="Extension field for ``version``.")
Example #11
0
class ImplementationGuideDefinition(backboneelement.BackboneElement):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Information needed to build the IG.
    The information needed by an IG publisher tool to publish the whole
    implementation guide.
    """

    resource_type = Field("ImplementationGuideDefinition", const=True)

    grouping: ListType[
        fhirtypes.ImplementationGuideDefinitionGroupingType] = Field(
            None,
            alias="grouping",
            title="Grouping used to present related resources in the IG",
            description=
            ("A logical group of resources. Logical groups can be used when building"
             " pages."),
            # if property is element of this resource.
            element_property=True,
        )

    page: fhirtypes.ImplementationGuideDefinitionPageType = Field(
        None,
        alias="page",
        title="Page/Section in the Guide",
        description=
        ("A page / section in the implementation guide. The root page is the "
         "implementation guide home page."),
        # if property is element of this resource.
        element_property=True,
    )

    parameter: ListType[
        fhirtypes.ImplementationGuideDefinitionParameterType] = Field(
            None,
            alias="parameter",
            title="Defines how IG is built by tools",
            description=None,
            # if property is element of this resource.
            element_property=True,
        )

    resource: ListType[
        fhirtypes.ImplementationGuideDefinitionResourceType] = Field(
            ...,
            alias="resource",
            title="Resource in the implementation guide",
            description=
            ("A resource that is part of the implementation guide. Conformance "
             "resources (value set, structure definition, capability statements "
             "etc.) are obvious candidates for inclusion, but any kind of resource "
             "can be included as an example resource."),
            # if property is element of this resource.
            element_property=True,
        )

    template: ListType[
        fhirtypes.ImplementationGuideDefinitionTemplateType] = Field(
            None,
            alias="template",
            title="A template for building resources",
            description=None,
            # if property is element of this resource.
            element_property=True,
        )
Example #12
0
class ImplementationGuideManifestResource(backboneelement.BackboneElement):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Resource in the implementation guide.
    A resource that is part of the implementation guide. Conformance resources
    (value set, structure definition, capability statements etc.) are obvious
    candidates for inclusion, but any kind of resource can be included as an
    example resource.
    """

    resource_type = Field("ImplementationGuideManifestResource", const=True)

    exampleBoolean: bool = Field(
        None,
        alias="exampleBoolean",
        title="Is an example/What is this an example of?",
        description=
        ("If true or a reference, indicates the resource is an example instance."
         "  If a reference is present, indicates that the example is an example "
         "of the specified profile."),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e example[x]
        one_of_many="example",
        one_of_many_required=False,
    )
    exampleBoolean__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_exampleBoolean",
        title="Extension field for ``exampleBoolean``.")

    exampleCanonical: fhirtypes.Canonical = Field(
        None,
        alias="exampleCanonical",
        title="Is an example/What is this an example of?",
        description=
        ("If true or a reference, indicates the resource is an example instance."
         "  If a reference is present, indicates that the example is an example "
         "of the specified profile."),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e example[x]
        one_of_many="example",
        one_of_many_required=False,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["StructureDefinition"],
    )
    exampleCanonical__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_exampleCanonical",
        title="Extension field for ``exampleCanonical``.",
    )

    reference: fhirtypes.ReferenceType = Field(
        ...,
        alias="reference",
        title="Location of the resource",
        description="Where this resource is found.",
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Resource"],
    )

    relativePath: fhirtypes.Url = Field(
        None,
        alias="relativePath",
        title="Relative path for page in IG",
        description=
        "The relative path for primary page for this resource within the IG.",
        # if property is element of this resource.
        element_property=True,
    )
    relativePath__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_relativePath",
        title="Extension field for ``relativePath``.")

    @root_validator(pre=True)
    def validate_one_of_many(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        """https://www.hl7.org/fhir/formats.html#choice
        A few elements have a choice of more than one data type for their content.
        All such elements have a name that takes the form nnn[x].
        The "nnn" part of the name is constant, and the "[x]" is replaced with
        the title-cased name of the type that is actually used.
        The table view shows each of these names explicitly.

        Elements that have a choice of data type cannot repeat - they must have a
        maximum cardinality of 1. When constructing an instance of an element with a
        choice of types, the authoring system must create a single element with a
        data type chosen from among the list of permitted data types.
        """
        one_of_many_fields = {
            "example": ["exampleBoolean", "exampleCanonical"]
        }
        for prefix, fields in one_of_many_fields.items():
            assert cls.__fields__[
                fields[0]].field_info.extra["one_of_many"] == prefix
            required = (cls.__fields__[
                fields[0]].field_info.extra["one_of_many_required"] is True)
            found = False
            for field in fields:
                if field in values and values[field] is not None:
                    if found is True:
                        raise ValueError(
                            "Any of one field value is expected from "
                            f"this list {fields}, but got multiple!")
                    else:
                        found = True
            if required is True and found is False:
                raise ValueError(
                    f"Expect any of field value from this list {fields}.")

        return values
Example #13
0
class PipelineActivity(BaseModel):
    """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

    Do not edit the class manually.

    PipelineActivity - a model defined in OpenAPI

        _class: The _class of this PipelineActivity [Optional].
        artifacts: The artifacts of this PipelineActivity [Optional].
        duration_in_millis: The duration_in_millis of this PipelineActivity [Optional].
        estimated_duration_in_millis: The estimated_duration_in_millis of this PipelineActivity [Optional].
        en_queue_time: The en_queue_time of this PipelineActivity [Optional].
        end_time: The end_time of this PipelineActivity [Optional].
        id: The id of this PipelineActivity [Optional].
        organization: The organization of this PipelineActivity [Optional].
        pipeline: The pipeline of this PipelineActivity [Optional].
        result: The result of this PipelineActivity [Optional].
        run_summary: The run_summary of this PipelineActivity [Optional].
        start_time: The start_time of this PipelineActivity [Optional].
        state: The state of this PipelineActivity [Optional].
        type: The type of this PipelineActivity [Optional].
        commit_id: The commit_id of this PipelineActivity [Optional].
    """

    _class: Optional[str] = Field(alias="_class", default=None)
    artifacts: Optional[List[PipelineActivityartifacts]] = Field(alias="artifacts", default=None)
    duration_in_millis: Optional[int] = Field(alias="durationInMillis", default=None)
    estimated_duration_in_millis: Optional[int] = Field(alias="estimatedDurationInMillis", default=None)
    en_queue_time: Optional[str] = Field(alias="enQueueTime", default=None)
    end_time: Optional[str] = Field(alias="endTime", default=None)
    id: Optional[str] = Field(alias="id", default=None)
    organization: Optional[str] = Field(alias="organization", default=None)
    pipeline: Optional[str] = Field(alias="pipeline", default=None)
    result: Optional[str] = Field(alias="result", default=None)
    run_summary: Optional[str] = Field(alias="runSummary", default=None)
    start_time: Optional[str] = Field(alias="startTime", default=None)
    state: Optional[str] = Field(alias="state", default=None)
    type: Optional[str] = Field(alias="type", default=None)
    commit_id: Optional[str] = Field(alias="commitId", default=None)
Example #14
0
class PractitionerRoleAvailableTime(backboneelement.BackboneElement):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Times the Service Site is available.
    A collection of times the practitioner is available or performing this role
    at the location and/or healthcareservice.
    """

    resource_type = Field("PractitionerRoleAvailableTime", const=True)

    allDay: bool = Field(
        None,
        alias="allDay",
        title="Always available? e.g. 24 hour service",
        description=
        ("Is this always available? (hence times are irrelevant) e.g. 24 hour "
         "service."),
        # if property is element of this resource.
        element_property=True,
    )
    allDay__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_allDay", title="Extension field for ``allDay``.")

    availableEndTime: fhirtypes.Time = Field(
        None,
        alias="availableEndTime",
        title="Closing time of day (ignored if allDay = true)",
        description=
        ("The closing time of day. Note: If the AllDay flag is set, then this "
         "time is ignored."),
        # if property is element of this resource.
        element_property=True,
    )
    availableEndTime__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_availableEndTime",
        title="Extension field for ``availableEndTime``.",
    )

    availableStartTime: fhirtypes.Time = Field(
        None,
        alias="availableStartTime",
        title="Opening time of day (ignored if allDay = true)",
        description=
        ("The opening time of day. Note: If the AllDay flag is set, then this "
         "time is ignored."),
        # if property is element of this resource.
        element_property=True,
    )
    availableStartTime__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_availableStartTime",
        title="Extension field for ``availableStartTime``.",
    )

    daysOfWeek: ListType[fhirtypes.Code] = Field(
        None,
        alias="daysOfWeek",
        title="mon | tue | wed | thu | fri | sat | sun",
        description=
        ("Indicates which days of the week are available between the start and "
         "end Times."),
        # if property is element of this resource.
        element_property=True,
        # note: Enum values can be used in validation,
        # but use in your own responsibilities, read official FHIR documentation.
        enum_values=["mon", "tue", "wed", "thu", "fri", "sat", "sun"],
    )
    daysOfWeek__ext: ListType[
        Union[fhirtypes.FHIRPrimitiveExtensionType,
              None]] = Field(None,
                             alias="_daysOfWeek",
                             title="Extension field for ``daysOfWeek``.")
Example #15
0
class Model(BaseModel):
    data: Optional[WebhookEvent] = Field(None)

    def __str__(self):
        return f"<Webhook Event {self.data.id}>"
Example #16
0
class ImplementationGuideManifest(backboneelement.BackboneElement):
    """Disclaimer: Any field name ends with ``__ext`` does't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Information about an assembled IG.
    Information about an assembled implementation guide, created by the
    publication tooling.
    """

    resource_type = Field("ImplementationGuideManifest", const=True)

    image: ListType[fhirtypes.String] = Field(
        None,
        alias="image",
        title="Image within the IG",
        description=
        "Indicates a relative path to an image that exists within the IG.",
        # if property is element of this resource.
        element_property=True,
    )
    image__ext: ListType[Union[fhirtypes.FHIRPrimitiveExtensionType,
                               None]] = Field(
                                   None,
                                   alias="_image",
                                   title="Extension field for ``image``.")

    other: ListType[fhirtypes.String] = Field(
        None,
        alias="other",
        title="Additional linkable file in IG",
        description=
        ("Indicates the relative path of an additional non-page, non-image file "
         "that is part of the IG - e.g. zip, jar and similar files that could be"
         " the target of a hyperlink in a derived IG."),
        # if property is element of this resource.
        element_property=True,
    )
    other__ext: ListType[Union[fhirtypes.FHIRPrimitiveExtensionType,
                               None]] = Field(
                                   None,
                                   alias="_other",
                                   title="Extension field for ``other``.")

    page: ListType[fhirtypes.ImplementationGuideManifestPageType] = Field(
        None,
        alias="page",
        title="HTML page within the parent IG",
        description="Information about a page within the IG.",
        # if property is element of this resource.
        element_property=True,
    )

    rendering: fhirtypes.Url = Field(
        None,
        alias="rendering",
        title="Location of rendered implementation guide",
        description=(
            "A pointer to official web page, PDF or other rendering of the "
            "implementation guide."),
        # if property is element of this resource.
        element_property=True,
    )
    rendering__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_rendering", title="Extension field for ``rendering``.")

    resource: ListType[fhirtypes.ImplementationGuideManifestResourceType] = Field(
        ...,
        alias="resource",
        title="Resource in the implementation guide",
        description=
        ("A resource that is part of the implementation guide. Conformance "
         "resources (value set, structure definition, capability statements "
         "etc.) are obvious candidates for inclusion, but any kind of resource "
         "can be included as an example resource."),
        # if property is element of this resource.
        element_property=True,
    )
Example #17
0
class ProductData(BaseModel):
    name: str
    price: int
    image: Optional[list] = Field(None)
    description: str
Example #18
0
class Condition(domainresource.DomainResource):
    """Disclaimer: Any field name ends with ``__ext`` doesn't part of
    Resource StructureDefinition, instead used to enable Extensibility feature
    for FHIR Primitive Data Types.

    Detailed information about conditions, problems or diagnoses.
    A clinical condition, problem, diagnosis, or other event, situation, issue,
    or clinical concept that has risen to a level of concern.
    """

    resource_type = Field("Condition", const=True)

    abatementAge: fhirtypes.AgeType = Field(
        None,
        alias="abatementAge",
        title="When in resolution/remission",
        description=(
            "The date or estimated date that the condition resolved or went into "
            'remission. This is called "abatement" because of the many overloaded '
            'connotations associated with "remission" or "resolution" - Some '
            "conditions, such as chronic conditions, are never really resolved, but"
            " they can abate."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e abatement[x]
        one_of_many="abatement",
        one_of_many_required=False,
    )

    abatementDateTime: fhirtypes.DateTime = Field(
        None,
        alias="abatementDateTime",
        title="When in resolution/remission",
        description=(
            "The date or estimated date that the condition resolved or went into "
            'remission. This is called "abatement" because of the many overloaded '
            'connotations associated with "remission" or "resolution" - Some '
            "conditions, such as chronic conditions, are never really resolved, but"
            " they can abate."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e abatement[x]
        one_of_many="abatement",
        one_of_many_required=False,
    )
    abatementDateTime__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None,
        alias="_abatementDateTime",
        title="Extension field for ``abatementDateTime``.",
    )

    abatementPeriod: fhirtypes.PeriodType = Field(
        None,
        alias="abatementPeriod",
        title="When in resolution/remission",
        description=(
            "The date or estimated date that the condition resolved or went into "
            'remission. This is called "abatement" because of the many overloaded '
            'connotations associated with "remission" or "resolution" - Some '
            "conditions, such as chronic conditions, are never really resolved, but"
            " they can abate."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e abatement[x]
        one_of_many="abatement",
        one_of_many_required=False,
    )

    abatementRange: fhirtypes.RangeType = Field(
        None,
        alias="abatementRange",
        title="When in resolution/remission",
        description=(
            "The date or estimated date that the condition resolved or went into "
            'remission. This is called "abatement" because of the many overloaded '
            'connotations associated with "remission" or "resolution" - Some '
            "conditions, such as chronic conditions, are never really resolved, but"
            " they can abate."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e abatement[x]
        one_of_many="abatement",
        one_of_many_required=False,
    )

    abatementString: fhirtypes.String = Field(
        None,
        alias="abatementString",
        title="When in resolution/remission",
        description=(
            "The date or estimated date that the condition resolved or went into "
            'remission. This is called "abatement" because of the many overloaded '
            'connotations associated with "remission" or "resolution" - Some '
            "conditions, such as chronic conditions, are never really resolved, but"
            " they can abate."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e abatement[x]
        one_of_many="abatement",
        one_of_many_required=False,
    )
    abatementString__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_abatementString", title="Extension field for ``abatementString``."
    )

    asserter: fhirtypes.ReferenceType = Field(
        None,
        alias="asserter",
        title="Person or device that asserts this condition",
        description="Individual or device that is making the condition statement.",
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=[
            "Practitioner",
            "PractitionerRole",
            "Patient",
            "RelatedPerson",
            "Device",
        ],
    )

    bodySite: typing.List[fhirtypes.CodeableConceptType] = Field(
        None,
        alias="bodySite",
        title="Anatomical location, if relevant",
        description="The anatomical location where this condition manifests itself.",
        # if property is element of this resource.
        element_property=True,
    )

    category: typing.List[fhirtypes.CodeableConceptType] = Field(
        None,
        alias="category",
        title="problem-list-item | encounter-diagnosis",
        description="A category assigned to the condition.",
        # if property is element of this resource.
        element_property=True,
    )

    clinicalStatus: fhirtypes.CodeableConceptType = Field(
        ...,
        alias="clinicalStatus",
        title="active | recurrence | relapse | inactive | remission | resolved",
        description="The clinical status of the condition.",
        # if property is element of this resource.
        element_property=True,
    )

    code: fhirtypes.CodeableConceptType = Field(
        None,
        alias="code",
        title="Identification of the condition, problem or diagnosis",
        description=None,
        # if property is element of this resource.
        element_property=True,
    )

    encounter: fhirtypes.ReferenceType = Field(
        None,
        alias="encounter",
        title="The Encounter during which this Condition was created",
        description=(
            "The Encounter during which this Condition was created or to which the "
            "creation of this record is tightly associated."
        ),
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Encounter"],
    )

    evidence: typing.List[fhirtypes.ConditionEvidenceType] = Field(
        None,
        alias="evidence",
        title="Supporting evidence for the verification status",
        description=(
            "Supporting evidence / manifestations that are the basis of the "
            "Condition's verification status, such as evidence that confirmed or "
            "refuted the condition."
        ),
        # if property is element of this resource.
        element_property=True,
    )

    identifier: typing.List[fhirtypes.IdentifierType] = Field(
        None,
        alias="identifier",
        title="External Ids for this condition",
        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."
        ),
        # if property is element of this resource.
        element_property=True,
    )

    note: typing.List[fhirtypes.AnnotationType] = Field(
        None,
        alias="note",
        title="Additional information about the Condition",
        description=(
            "Additional information about the Condition. This is a general "
            "notes/comments entry  for description of the Condition, its diagnosis "
            "and prognosis."
        ),
        # if property is element of this resource.
        element_property=True,
    )

    onsetAge: fhirtypes.AgeType = Field(
        None,
        alias="onsetAge",
        title="Estimated or actual date,  date-time, or age",
        description=(
            "Estimated or actual date or date-time  the condition began, in the "
            "opinion of the clinician."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e onset[x]
        one_of_many="onset",
        one_of_many_required=False,
    )

    onsetDateTime: fhirtypes.DateTime = Field(
        None,
        alias="onsetDateTime",
        title="Estimated or actual date,  date-time, or age",
        description=(
            "Estimated or actual date or date-time  the condition began, in the "
            "opinion of the clinician."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e onset[x]
        one_of_many="onset",
        one_of_many_required=False,
    )
    onsetDateTime__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_onsetDateTime", title="Extension field for ``onsetDateTime``."
    )

    onsetPeriod: fhirtypes.PeriodType = Field(
        None,
        alias="onsetPeriod",
        title="Estimated or actual date,  date-time, or age",
        description=(
            "Estimated or actual date or date-time  the condition began, in the "
            "opinion of the clinician."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e onset[x]
        one_of_many="onset",
        one_of_many_required=False,
    )

    onsetRange: fhirtypes.RangeType = Field(
        None,
        alias="onsetRange",
        title="Estimated or actual date,  date-time, or age",
        description=(
            "Estimated or actual date or date-time  the condition began, in the "
            "opinion of the clinician."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e onset[x]
        one_of_many="onset",
        one_of_many_required=False,
    )

    onsetString: fhirtypes.String = Field(
        None,
        alias="onsetString",
        title="Estimated or actual date,  date-time, or age",
        description=(
            "Estimated or actual date or date-time  the condition began, in the "
            "opinion of the clinician."
        ),
        # if property is element of this resource.
        element_property=True,
        # Choice of Data Types. i.e onset[x]
        one_of_many="onset",
        one_of_many_required=False,
    )
    onsetString__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_onsetString", title="Extension field for ``onsetString``."
    )

    recordedDate: fhirtypes.DateTime = Field(
        None,
        alias="recordedDate",
        title="Date record was first recorded",
        description=(
            "The recordedDate represents when this particular Condition record was "
            "created in the system, which is often a system-generated date."
        ),
        # if property is element of this resource.
        element_property=True,
    )
    recordedDate__ext: fhirtypes.FHIRPrimitiveExtensionType = Field(
        None, alias="_recordedDate", title="Extension field for ``recordedDate``."
    )

    recorder: fhirtypes.ReferenceType = Field(
        None,
        alias="recorder",
        title="Who recorded the condition",
        description=(
            "Individual who recorded the record and takes responsibility for its "
            "content."
        ),
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=[
            "Practitioner",
            "PractitionerRole",
            "Patient",
            "RelatedPerson",
        ],
    )

    severity: fhirtypes.CodeableConceptType = Field(
        None,
        alias="severity",
        title="Subjective severity of condition",
        description=(
            "A subjective assessment of the severity of the condition as evaluated "
            "by the clinician."
        ),
        # if property is element of this resource.
        element_property=True,
    )

    stage: typing.List[fhirtypes.ConditionStageType] = Field(
        None,
        alias="stage",
        title="Stage/grade, usually assessed formally",
        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."
        ),
        # if property is element of this resource.
        element_property=True,
    )

    subject: fhirtypes.ReferenceType = Field(
        ...,
        alias="subject",
        title="Who has the condition?",
        description=(
            "Indicates the patient or group who the condition record is associated "
            "with."
        ),
        # if property is element of this resource.
        element_property=True,
        # note: Listed Resource Type(s) should be allowed as Reference.
        enum_reference_types=["Patient", "Group"],
    )

    verificationStatus: fhirtypes.CodeableConceptType = Field(
        None,
        alias="verificationStatus",
        title=(
            "unconfirmed | provisional | differential | confirmed | refuted | "
            "entered-in-error"
        ),
        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."
        ),
        # if property is element of this resource.
        element_property=True,
    )

    @classmethod
    def elements_sequence(cls):
        """returning all elements names from ``Condition`` according specification,
        with preserving original sequence order.
        """
        return [
            "id",
            "meta",
            "implicitRules",
            "language",
            "text",
            "contained",
            "extension",
            "modifierExtension",
            "identifier",
            "clinicalStatus",
            "verificationStatus",
            "category",
            "severity",
            "code",
            "bodySite",
            "subject",
            "encounter",
            "onsetDateTime",
            "onsetAge",
            "onsetPeriod",
            "onsetRange",
            "onsetString",
            "abatementDateTime",
            "abatementAge",
            "abatementPeriod",
            "abatementRange",
            "abatementString",
            "recordedDate",
            "recorder",
            "asserter",
            "stage",
            "evidence",
            "note",
        ]

    @root_validator(pre=True, allow_reuse=True)
    def validate_one_of_many_1112(
        cls, values: typing.Dict[str, typing.Any]
    ) -> typing.Dict[str, typing.Any]:
        """https://www.hl7.org/fhir/formats.html#choice
        A few elements have a choice of more than one data type for their content.
        All such elements have a name that takes the form nnn[x].
        The "nnn" part of the name is constant, and the "[x]" is replaced with
        the title-cased name of the type that is actually used.
        The table view shows each of these names explicitly.

        Elements that have a choice of data type cannot repeat - they must have a
        maximum cardinality of 1. When constructing an instance of an element with a
        choice of types, the authoring system must create a single element with a
        data type chosen from among the list of permitted data types.
        """
        one_of_many_fields = {
            "abatement": [
                "abatementAge",
                "abatementDateTime",
                "abatementPeriod",
                "abatementRange",
                "abatementString",
            ],
            "onset": [
                "onsetAge",
                "onsetDateTime",
                "onsetPeriod",
                "onsetRange",
                "onsetString",
            ],
        }
        for prefix, fields in one_of_many_fields.items():
            assert cls.__fields__[fields[0]].field_info.extra["one_of_many"] == prefix
            required = (
                cls.__fields__[fields[0]].field_info.extra["one_of_many_required"]
                is True
            )
            found = False
            for field in fields:
                if field in values and values[field] is not None:
                    if found is True:
                        raise ValueError(
                            "Any of one field value is expected from "
                            f"this list {fields}, but got multiple!"
                        )
                    else:
                        found = True
            if required is True and found is False:
                raise ValueError(f"Expect any of field value from this list {fields}.")

        return values
Example #19
0
 class Config(BaseConfig):
     not_yet_set: str = Field(..., allow_mutation=False)
Example #20
0
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#


from enum import Enum
from pathlib import Path
from typing import List, Mapping, Optional

from pydantic import BaseModel, Field, validator

config_path: str = Field(default="secrets/config.json", description="Path to a JSON object representing a valid connector configuration")
invalid_config_path: str = Field(description="Path to a JSON object representing an invalid connector configuration")
spec_path: str = Field(
    default="secrets/spec.json", description="Path to a JSON object representing the spec expected to be output by this connector"
)
configured_catalog_path: str = Field(default="integration_tests/configured_catalog.json", description="Path to configured catalog")


class BaseConfig(BaseModel):
    class Config:
        extra = "forbid"


class SpecTestConfig(BaseConfig):
    spec_path: str = spec_path
Example #21
0
kwargs = dict()
for module in ANSIBLE_MODULES:

    # due to performance reasons, for the moment we include only those modules
    # without a collection/namespace
    if "." in module:
        continue

    if module in ['copy']:
        module_sanitized = f"{module}_"
    else:
        module_sanitized = module
    # Optional is used because we only need one of them
    kwargs[module_sanitized] = (
        Optional[Mapping[str, Any]],
        Field(title=".", alias=module),
    )
kwargs['__base__'] = TaskModel  # type: ignore
# kwargs['schema_extra'] = cleanup_schema  # type: ignore

BeremothTaskModel = create_model("BeremothTaskModel", **kwargs)  # type: ignore
BeremothTaskModel.__config__.schema_extra = cleanup_schema  # type: ignore

# all_tasks_models = (TaskModel, BlockModel, *tuple(generated_tasks_models.values()))


class TasksListModel(BaseModel):
    __root__: List[Union[TaskModel, BlockModel,
                         BeremothTaskModel]]  # type: ignore

    class Config:
Example #22
0
class Config(BaseConfig):
    connector_image: str = Field(description="Docker image to test, for example 'airbyte/source-hubspot:dev'")
    base_path: Optional[str] = Field(description="Base path for all relative paths")
    tests: TestConfig = Field(description="List of the tests with their configs")
Example #23
0
class GraphCommitteeAttributesConfig(BaseModel):
    cmte_pty_affiliation: str = Field(None, min_length=3, max_length=3)
    cmte_dsgn: str = Field(None, min_length=1, max_length=1)
    cmte_tp: str = Field(None, min_length=1, max_length=1)
    org_tp: str = Field(None, min_length=1, max_length=1)
Example #24
0
class BasicReadTestConfig(BaseConfig):
    config_path: str = config_path
    configured_catalog_path: Optional[str] = configured_catalog_path
    validate_output_from_all_streams: bool = Field(False, description="Verify that all streams have records")
    expect_records: Optional[ExpectedRecordsConfig] = Field(description="Expected records from the read")
Example #25
0
class GraphTweeterAttributesConfig(BaseModel):
    username: str = Field(None)
    candidate: bool = Field(True)
Example #26
0
class BaseResponseSchema(BaseSchema):
    meta: Optional[MetaModel] = Field(
        "MetaModel",
        alias="_meta",
    )
    links: Optional[LinksModel] = Field("LinksModel", alias="_links")
Example #27
0
class PaginationConfig(BaseModel):
    skip: int = Field(0, ge=0)
    limit: int = Field(30, ge=0, le=1000)
Example #28
0
class ItemBaseResponseSchema(BaseSchema):
    links: Optional[ItemLinksModel] = Field("ItemLinksModel", alias="_links")
Example #29
0
class QueueManagerSettings(AutodocBaseSettings):
    """
    Fractal Queue Manger settings. These are options which control the setup and execution of the Fractal Manager
    itself.
    """

    manager_name: str = Field(
        "unlabeled",
        description="Name of this scheduler to present to the Fractal Server. Descriptive names help the server "
        "identify the manager resource and assists with debugging.",
    )
    queue_tag: Optional[Union[str, List[str]]] = Field(
        None,
        description="Only pull tasks from the Fractal Server with this tag. If not set (None/null), then pull untagged "
        "tasks, which should be the majority of tasks. This option should only be used when you want to "
        "pull very specific tasks which you know have been tagged as such on the server. If the server has "
        "no tasks with this tag, no tasks will be pulled (and no error is raised because this is intended "
        "behavior). If multiple tags are provided, tasks will be pulled (but not necessarily executed) in order of the "
        "tags.",
    )
    log_file_prefix: Optional[str] = Field(
        None,
        description="Full path to save a log file to, including the filename. If not provided, information will still "
        "be reported to terminal, but not saved. When set, logger information is sent both to this file "
        "and the terminal.",
    )
    update_frequency: float = Field(
        30,
        description="Time between heartbeats/update checks between this Manager and the Fractal Server. The lower this "
        "value, the shorter the intervals. If you have an unreliable network connection, consider "
        "increasing this time as repeated, consecutive network failures will cause the Manager to shut "
        "itself down to maintain integrity between it and the Fractal Server. Units of seconds",
        gt=0,
    )
    test: bool = Field(
        False,
        description="Turn on testing mode for this Manager. The Manager will not connect to any Fractal Server, and "
        "instead submits netsts worth trial tasks per quantum chemistry program it finds. These tasks are "
        "generated locally and do not need a running Fractal Server to work. Helpful for ensuring the "
        "Manager is configured correctly and the quantum chemistry codes are operating as expected.",
    )
    ntests: int = Field(
        5,
        description="Number of tests to run if the `test` flag is set to True. Total number of tests will be this "
        "number times the number of found quantum chemistry programs. Does nothing if `test` is False."
        "If set to 0, then this submits no tests, but it will run through the setup and client "
        "initialization.",
        gt=-1,
    )
    max_queued_tasks: Optional[int] = Field(
        None,
        description="Generally should not be set. Number of tasks to pull from the Fractal Server to keep locally at "
        "all times. If `None`, this is automatically computed as "
        "`ceil(common.tasks_per_worker*common.max_workers*2.0) + 1`. As tasks are completed, the "
        "local pool is filled back up to this value. These tasks will all attempt to be run concurrently, "
        "but concurrent tasks are limited by number of cluster jobs and tasks per job. Pulling too many of "
        "these can result in under-utilized managers from other sites and result in less FIFO returns. As "
        "such it is recommended not to touch this setting in general as you will be given enough tasks to "
        "fill your maximum throughput with a buffer (assuming the queue has them).",
        gt=0,
    )
class FaxItem(BaseModel):
    __root__: str = Field(..., min_length=3)