diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 15a6fe0a0..8ccc4b063 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,4 +1,4 @@ [bumpversion] -current_version = 3.2.0 +current_version = 4.0.0 files = fhirclient/client.py diff --git a/.gitignore b/.gitignore index 8ccf67319..417ae8d26 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ session_data # IDE files *.sublime-* +.DS_Store diff --git a/AUTHORS.md b/AUTHORS.md index 33b333fd1..9f8c3abc2 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -13,6 +13,7 @@ The following wonderful people contributed directly or indirectly to this projec - Josh Mandel - Nikolai Schwertner - Pascal Pfiffner +- Raheel Sayeed - Trinadh Baranika Please add yourself here alphabetically when you submit your first pull request. diff --git a/Doxyfile b/Doxyfile index f2f2b6cf3..66c76f666 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "SMART on FHIR Python Client" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.2.0 +PROJECT_NUMBER = 4.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/README.md b/README.md index 949d72ac7..ff67ea4ad 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ The `develop` branch should be on recent freezes, and the `feature/latest-ci` br Version | FHIR |   -----------|---------------|--------- + **4.0.0** | `4.0.0` | (R4) **3.0.0** | `3.0.0` | (STU-3) **x.x** | `1.8.0` | (STU-3 Ballot, Jan 2017) **x.x** | `1.6.0` | (STU-3 Ballot, Sep 2016) diff --git a/fhir-parser b/fhir-parser index 6eb44a963..505e283af 160000 --- a/fhir-parser +++ b/fhir-parser @@ -1 +1 @@ -Subproject commit 6eb44a9639a7fdab9d8f62781b33ecf5d7a9f40e +Subproject commit 505e283afaa047dcb2e8fe0860f0427d54033d70 diff --git a/fhir-parser-resources/settings.py b/fhir-parser-resources/settings.py index 785b045ce..af9f69bc5 100644 --- a/fhir-parser-resources/settings.py +++ b/fhir-parser-resources/settings.py @@ -5,7 +5,7 @@ from Default.settings import * # Base URL for where to load specification data from -specification_url = 'http://hl7.org/fhir/STU3' +specification_url = 'http://hl7.org/fhir/R4' # In which directory to find the templates. See below for settings that start with `tpl_`: these are the template names. tpl_base = '../fhir-parser-resources' diff --git a/fhir-parser-resources/template-unittest.py b/fhir-parser-resources/template-unittest.py index 69740f218..5e552a836 100644 --- a/fhir-parser-resources/template-unittest.py +++ b/fhir-parser-resources/template-unittest.py @@ -36,7 +36,7 @@ def test{{ class.name }}{{ loop.index }}(self): def impl{{ class.name }}{{ loop.index }}(self, inst): {%- for onetest in tcase.tests %} {%- if "str" == onetest.klass.name %} - self.assertEqual(inst.{{ onetest.path }}, "{{ onetest.value|replace('"', '\\"') }}") + self.assertEqual(inst.{{ onetest.path }}, "{{ onetest.value|replace('\\n', '\\\\n')|replace('"', '\\"') }}") {%- else %}{% if "int" == onetest.klass.name or "float" == onetest.klass.name or "NSDecimalNumber" == onetest.klass.name %} self.assertEqual(inst.{{ onetest.path }}, {{ onetest.value }}) {%- else %}{% if "bool" == onetest.klass.name %} diff --git a/fhirclient/client.py b/fhirclient/client.py index 061c0582a..adfebb4c2 100644 --- a/fhirclient/client.py +++ b/fhirclient/client.py @@ -4,7 +4,7 @@ from server import FHIRServer, FHIRUnauthorizedException, FHIRNotFoundException -__version__ = '3.2.0' +__version__ = '4.0.0' __author__ = 'SMART Platforms Team' __license__ = 'APACHE2' __copyright__ = "Copyright 2017 Boston Children's Hospital" diff --git a/fhirclient/fhirreference_tests.py b/fhirclient/fhirreference_tests.py old mode 100644 new mode 100755 index 57b8b1ba2..5e9870ed2 --- a/fhirclient/fhirreference_tests.py +++ b/fhirclient/fhirreference_tests.py @@ -30,24 +30,24 @@ def testContainedResourceDetection(self): self.assertEqual('Observation.subject', group.linkId) question = group.item[0] self.assertEqual('Observation.subject._type', question.linkId) - self.assertIsNotNone(question.options) + self.assertIsNotNone(question.answerOption) with self.assertRaises(Exception): - question.options.resolved() - + question.answerOption[0].valueReference.resolved() + reference = question.answerOption[0].valueReference # 1st resolve, extracting from contained resources - contained = question.options.resolved(medication.Medication) + contained = reference.resolved(medication.Medication) self.assertIsNone(contained, "Must not resolve on resource type mismatch") - contained = question.options.resolved(valueset.ValueSet) + contained = reference.resolved(valueset.ValueSet) self.assertIsNotNone(contained, "Must resolve contained ValueSet") self.assertEqual('ValueSet', contained.resource_type) self.assertEqual('Type options for Observation.subject', contained.name) # 2nd resolve, should pull from cache - contained = question.options.resolved(medication.Medication) + contained = reference.resolved(medication.Medication) self.assertIsNone(contained, "Must not resolve on resource type mismatch") - contained = question.options.resolved(resource.Resource) + contained = reference.resolved(resource.Resource) self.assertIsNotNone(contained, "Must resolve contained ValueSet even if requesting `Resource`") - contained = question.options.resolved(valueset.ValueSet) + contained = reference.resolved(valueset.ValueSet) self.assertIsNotNone(contained, "Must resolve contained ValueSet") self.assertEqual('ValueSet', contained.resource_type) @@ -63,20 +63,21 @@ def testRelativeReference(self): self.assertEqual('Observation.subject', group.linkId) question = group.item[0] self.assertEqual('Observation.subject._type', question.linkId) - self.assertIsNotNone(question.options) + self.assertIsNotNone(question.answerOption) with self.assertRaises(Exception): - question.options.resolved() + question.answerOption[0].valueReference.resolved() + reference = question.answerOption[0].valueReference # resolve relative resource - relative = question.options.resolved(valueset.ValueSet) + relative = reference.resolved(valueset.ValueSet) self.assertIsNotNone(relative, "Must resolve relative ValueSet") self.assertEqual('ValueSet', relative.resource_type) self.assertEqual('Type options for Observation.subject', relative.name) # 2nd resolve, should pull from cache - relative = question.options.resolved(medication.Medication) + relative = reference.resolved(medication.Medication) self.assertIsNone(relative, "Must not resolve on resource type mismatch") - relative = question.options.resolved(resource.Resource) + relative = reference.resolved(resource.Resource) self.assertIsNotNone(relative, "Must resolve relative ValueSet even if requesting `Resource`") def testBundleReferences(self): diff --git a/fhirclient/models/account.py b/fhirclient/models/account.py index 58b00361e..2447ca29f 100644 --- a/fhirclient/models/account.py +++ b/fhirclient/models/account.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Account) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Account) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -25,14 +25,6 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.active = None - """ Time window that transactions may be posted to this account. - Type `Period` (represented as `dict` in JSON). """ - - self.balance = None - """ How much is in account?. - Type `Money` (represented as `dict` in JSON). """ - self.coverage = None """ The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account. @@ -43,7 +35,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.guarantor = None - """ Responsible for the account. + """ The parties ultimately responsible for balancing the Account. List of `AccountGuarantor` items (represented as `dict` in JSON). """ self.identifier = None @@ -55,20 +47,24 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.owner = None - """ Who is responsible?. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Entity managing the Account. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.period = None + self.partOf = None + """ Reference to a parent Account. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.servicePeriod = None """ Transaction window. Type `Period` (represented as `dict` in JSON). """ self.status = None - """ active | inactive | entered-in-error. + """ active | inactive | entered-in-error | on-hold | unknown. Type `str`. """ self.subject = None - """ What is account tied to?. - Type `FHIRReference` referencing `Patient, Device, Practitioner, Location, HealthcareService, Organization` (represented as `dict` in JSON). """ + """ The entity that caused the expenses. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.type = None """ E.g. patient, expense, depreciation. @@ -79,17 +75,16 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(Account, self).elementProperties() js.extend([ - ("active", "active", period.Period, False, None, False), - ("balance", "balance", money.Money, False, None, False), ("coverage", "coverage", AccountCoverage, True, None, False), ("description", "description", str, False, None, False), ("guarantor", "guarantor", AccountGuarantor, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("name", "name", str, False, None, False), ("owner", "owner", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), - ("status", "status", str, False, None, False), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), + ("servicePeriod", "servicePeriod", period.Period, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -113,9 +108,9 @@ def __init__(self, jsondict=None, strict=True): """ self.coverage = None - """ The party(s) that are responsible for covering the payment of this - account. - Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + """ The party(s), such as insurances, that may contribute to the + payment of this account. + Type `FHIRReference` (represented as `dict` in JSON). """ self.priority = None """ The priority of the coverage in the context of this account. @@ -133,9 +128,10 @@ def elementProperties(self): class AccountGuarantor(backboneelement.BackboneElement): - """ Responsible for the account. + """ The parties ultimately responsible for balancing the Account. - Parties financially responsible for the account. + The parties responsible for balancing the account if other payment options + fall short. """ resource_type = "AccountGuarantor" @@ -154,10 +150,10 @@ def __init__(self, jsondict=None, strict=True): self.party = None """ Responsible entity. - Type `FHIRReference` referencing `Patient, RelatedPerson, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None - """ Guarrantee account during. + """ Guarantee account during. Type `Period` (represented as `dict` in JSON). """ super(AccountGuarantor, self).__init__(jsondict=jsondict, strict=strict) @@ -185,10 +181,6 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] -try: - from . import money -except ImportError: - money = sys.modules[__package__ + '.money'] try: from . import period except ImportError: diff --git a/fhirclient/models/account_tests.py b/fhirclient/models/account_tests.py index 6b2fad7e0..b8148e855 100644 --- a/fhirclient/models/account_tests.py +++ b/fhirclient/models/account_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return account.Account(js) def testAccount1(self): - inst = self.instantiate_from("account-example-with-guarantor.json") + inst = self.instantiate_from("account-example.json") self.assertIsNotNone(inst, "Must have instantiated a Account instance") self.implAccount1(inst) @@ -32,38 +32,29 @@ def testAccount1(self): self.implAccount1(inst2) def implAccount1(self, inst): - self.assertEqual(inst.active.end.date, FHIRDate("2016-06-30").date) - self.assertEqual(inst.active.end.as_json(), "2016-06-30") - self.assertEqual(inst.active.start.date, FHIRDate("2016-01-01").date) - self.assertEqual(inst.active.start.as_json(), "2016-01-01") - self.assertEqual(inst.balance.code, "USD") - self.assertEqual(inst.balance.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.balance.unit, "USD") - self.assertEqual(inst.balance.value, -1200) self.assertEqual(inst.coverage[0].priority, 1) - self.assertEqual(inst.coverage[1].priority, 2) self.assertEqual(inst.description, "Hospital charges") - self.assertFalse(inst.guarantor[0].onHold) - self.assertEqual(inst.guarantor[0].period.start.date, FHIRDate("2016-01-01").date) - self.assertEqual(inst.guarantor[0].period.start.as_json(), "2016-01-01") - self.assertEqual(inst.id, "ewg") + self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") self.assertEqual(inst.identifier[0].value, "654321") - self.assertEqual(inst.name, "Inpatient: Peter James Chalmers") - self.assertEqual(inst.period.end.date, FHIRDate("2016-06-30").date) - self.assertEqual(inst.period.end.as_json(), "2016-06-30") - self.assertEqual(inst.period.start.date, FHIRDate("2016-01-01").date) - self.assertEqual(inst.period.start.as_json(), "2016-01-01") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "HACC Funded Billing for Peter James Chalmers") + self.assertEqual(inst.servicePeriod.end.date, FHIRDate("2016-06-30").date) + self.assertEqual(inst.servicePeriod.end.as_json(), "2016-06-30") + self.assertEqual(inst.servicePeriod.start.date, FHIRDate("2016-01-01").date) + self.assertEqual(inst.servicePeriod.start.as_json(), "2016-01-01") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
Inpatient Admission for Peter James Chalmers Account
") + self.assertEqual(inst.text.div, "
HACC Funded Billing for Peter James Chalmers
") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "PBILLACCT") self.assertEqual(inst.type.coding[0].display, "patient billing account") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.type.text, "patient") def testAccount2(self): - inst = self.instantiate_from("account-example.json") + inst = self.instantiate_from("account-example-with-guarantor.json") self.assertIsNotNone(inst, "Must have instantiated a Account instance") self.implAccount2(inst) @@ -73,29 +64,28 @@ def testAccount2(self): self.implAccount2(inst2) def implAccount2(self, inst): - self.assertEqual(inst.active.end.date, FHIRDate("2016-06-30").date) - self.assertEqual(inst.active.end.as_json(), "2016-06-30") - self.assertEqual(inst.active.start.date, FHIRDate("2016-01-01").date) - self.assertEqual(inst.active.start.as_json(), "2016-01-01") - self.assertEqual(inst.balance.code, "USD") - self.assertEqual(inst.balance.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.balance.unit, "USD") - self.assertEqual(inst.balance.value, -1200) self.assertEqual(inst.coverage[0].priority, 1) + self.assertEqual(inst.coverage[1].priority, 2) self.assertEqual(inst.description, "Hospital charges") - self.assertEqual(inst.id, "example") + self.assertFalse(inst.guarantor[0].onHold) + self.assertEqual(inst.guarantor[0].period.start.date, FHIRDate("2016-01-01").date) + self.assertEqual(inst.guarantor[0].period.start.as_json(), "2016-01-01") + self.assertEqual(inst.id, "ewg") self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") self.assertEqual(inst.identifier[0].value, "654321") - self.assertEqual(inst.name, "HACC Funded Billing for Peter James Chalmers") - self.assertEqual(inst.period.end.date, FHIRDate("2016-06-30").date) - self.assertEqual(inst.period.end.as_json(), "2016-06-30") - self.assertEqual(inst.period.start.date, FHIRDate("2016-01-01").date) - self.assertEqual(inst.period.start.as_json(), "2016-01-01") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Inpatient: Peter James Chalmers") + self.assertEqual(inst.servicePeriod.end.date, FHIRDate("2016-06-30").date) + self.assertEqual(inst.servicePeriod.end.as_json(), "2016-06-30") + self.assertEqual(inst.servicePeriod.start.date, FHIRDate("2016-01-01").date) + self.assertEqual(inst.servicePeriod.start.as_json(), "2016-01-01") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
HACC Funded Billing for Peter James Chalmers
") + self.assertEqual(inst.text.div, "
Inpatient Admission for Peter James Chalmers Account
") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "PBILLACCT") self.assertEqual(inst.type.coding[0].display, "patient billing account") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.type.text, "patient") diff --git a/fhirclient/models/activitydefinition.py b/fhirclient/models/activitydefinition.py index 50056bb71..132df79ff 100644 --- a/fhirclient/models/activitydefinition.py +++ b/fhirclient/models/activitydefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ActivityDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ActivityDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -30,6 +30,10 @@ def __init__(self, jsondict=None, strict=True): """ When the activity definition was approved by publisher. Type `FHIRDate` (represented as `str` in JSON). """ + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.bodySite = None """ What part of body to perform on. List of `CodeableConcept` items (represented as `dict` in JSON). """ @@ -42,22 +46,22 @@ def __init__(self, jsondict=None, strict=True): """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ - self.contributor = None - """ A content contributor. - List of `Contributor` items (represented as `dict` in JSON). """ - self.copyright = None """ Use and/or publishing restrictions. Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None """ Natural language description of the activity definition. Type `str`. """ + self.doNotPerform = None + """ True if the activity should not be performed. + Type `bool`. """ + self.dosage = None """ Detailed dosage instructions. List of `Dosage` items (represented as `dict` in JSON). """ @@ -66,10 +70,18 @@ def __init__(self, jsondict=None, strict=True): """ Dynamic aspects of the definition. List of `ActivityDefinitionDynamicValue` items (represented as `dict` in JSON). """ + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.effectivePeriod = None """ When the activity definition is expected to be used. Type `Period` (represented as `dict` in JSON). """ + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.experimental = None """ For testing purposes, not real usage. Type `bool`. """ @@ -78,6 +90,10 @@ def __init__(self, jsondict=None, strict=True): """ Additional identifier for the activity definition. List of `Identifier` items (represented as `dict` in JSON). """ + self.intent = None + """ proposal | plan | order. + Type `str`. """ + self.jurisdiction = None """ Intended jurisdiction for activity definition (if applicable). List of `CodeableConcept` items (represented as `dict` in JSON). """ @@ -91,28 +107,44 @@ def __init__(self, jsondict=None, strict=True): Type `FHIRDate` (represented as `str` in JSON). """ self.library = None - """ Logic used by the asset. - List of `FHIRReference` items referencing `Library` (represented as `dict` in JSON). """ + """ Logic used by the activity definition. + List of `str` items. """ self.location = None """ Where it should happen. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.name = None """ Name for this activity definition (computer friendly). Type `str`. """ + self.observationRequirement = None + """ What observations are required to perform this action. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.observationResultRequirement = None + """ What observations must be produced by this action. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.participant = None """ Who should participate in the action. List of `ActivityDefinitionParticipant` items (represented as `dict` in JSON). """ + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + self.productCodeableConcept = None """ What's administered/supplied. Type `CodeableConcept` (represented as `dict` in JSON). """ self.productReference = None """ What's administered/supplied. - Type `FHIRReference` referencing `Medication, Substance` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.profile = None + """ What profile the resource needs to conform to. + Type `str`. """ self.publisher = None """ Name of the publisher (organization or individual). @@ -127,17 +159,45 @@ def __init__(self, jsondict=None, strict=True): Type `Quantity` (represented as `dict` in JSON). """ self.relatedArtifact = None - """ Additional documentation, citations, etc. + """ Additional documentation, citations, etc.. List of `RelatedArtifact` items (represented as `dict` in JSON). """ + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.specimenRequirement = None + """ What specimens are required to perform this action. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.status = None """ draft | active | retired | unknown. Type `str`. """ + self.subjectCodeableConcept = None + """ Type of individual the activity definition is intended for. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ Type of individual the activity definition is intended for. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate title of the activity definition. + Type `str`. """ + + self.timingAge = None + """ When activity is to occur. + Type `Age` (represented as `dict` in JSON). """ + self.timingDateTime = None """ When activity is to occur. Type `FHIRDate` (represented as `str` in JSON). """ + self.timingDuration = None + """ When activity is to occur. + Type `Duration` (represented as `dict` in JSON). """ + self.timingPeriod = None """ When activity is to occur. Type `Period` (represented as `dict` in JSON). """ @@ -155,23 +215,24 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.topic = None - """ E.g. Education, Treatment, Assessment, etc. + """ E.g. Education, Treatment, Assessment, etc.. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.transform = None """ Transform to apply the template. - Type `FHIRReference` referencing `StructureMap` (represented as `dict` in JSON). """ + Type `str`. """ self.url = None - """ Logical URI to reference this activity definition (globally unique). + """ Canonical identifier for this activity definition, represented as a + URI (globally unique). Type `str`. """ self.usage = None - """ Describes the clinical usage of the asset. + """ Describes the clinical usage of the activity definition. Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -184,39 +245,54 @@ def elementProperties(self): js = super(ActivityDefinition, self).elementProperties() js.extend([ ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("contributor", "contributor", contributor.Contributor, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), + ("doNotPerform", "doNotPerform", bool, False, None, False), ("dosage", "dosage", dosage.Dosage, True, None, False), ("dynamicValue", "dynamicValue", ActivityDefinitionDynamicValue, True, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), ("experimental", "experimental", bool, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("intent", "intent", str, False, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("kind", "kind", str, False, None, False), ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), - ("library", "library", fhirreference.FHIRReference, True, None, False), + ("library", "library", str, True, None, False), ("location", "location", fhirreference.FHIRReference, False, None, False), ("name", "name", str, False, None, False), + ("observationRequirement", "observationRequirement", fhirreference.FHIRReference, True, None, False), + ("observationResultRequirement", "observationResultRequirement", fhirreference.FHIRReference, True, None, False), ("participant", "participant", ActivityDefinitionParticipant, True, None, False), + ("priority", "priority", str, False, None, False), ("productCodeableConcept", "productCodeableConcept", codeableconcept.CodeableConcept, False, "product", False), ("productReference", "productReference", fhirreference.FHIRReference, False, "product", False), + ("profile", "profile", str, False, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), + ("specimenRequirement", "specimenRequirement", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, True), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), + ("subtitle", "subtitle", str, False, None, False), + ("timingAge", "timingAge", age.Age, False, "timing", False), ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), + ("timingDuration", "timingDuration", duration.Duration, False, "timing", False), ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), ("timingRange", "timingRange", range.Range, False, "timing", False), ("timingTiming", "timingTiming", timing.Timing, False, "timing", False), ("title", "title", str, False, None, False), ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), - ("transform", "transform", fhirreference.FHIRReference, False, None, False), + ("transform", "transform", str, False, None, False), ("url", "url", str, False, None, False), ("usage", "usage", str, False, None, False), ("useContext", "useContext", usagecontext.UsageContext, True, None, False), @@ -234,7 +310,7 @@ class ActivityDefinitionDynamicValue(backboneelement.BackboneElement): resulting resource. For example, if the dosage of a medication must be computed based on the patient's weight, a dynamic value would be used to specify an expression that calculated the weight, and the path on the - intent resource that would contain the result. + request resource that would contain the result. """ resource_type = "ActivityDefinitionDynamicValue" @@ -247,17 +323,9 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.description = None - """ Natural language description of the dynamic value. - Type `str`. """ - self.expression = None """ An expression that provides the dynamic value for the customization. - Type `str`. """ - - self.language = None - """ Language of the expression. - Type `str`. """ + Type `Expression` (represented as `dict` in JSON). """ self.path = None """ The path to the element to be set dynamically. @@ -268,10 +336,8 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(ActivityDefinitionDynamicValue, self).elementProperties() js.extend([ - ("description", "description", str, False, None, False), - ("expression", "expression", str, False, None, False), - ("language", "language", str, False, None, False), - ("path", "path", str, False, None, False), + ("expression", "expression", expression.Expression, False, None, True), + ("path", "path", str, False, None, True), ]) return js @@ -293,11 +359,11 @@ def __init__(self, jsondict=None, strict=True): """ self.role = None - """ E.g. Nurse, Surgeon, Parent, etc. + """ E.g. Nurse, Surgeon, Parent, etc.. Type `CodeableConcept` (represented as `dict` in JSON). """ self.type = None - """ patient | practitioner | related-person. + """ patient | practitioner | related-person | device. Type `str`. """ super(ActivityDefinitionParticipant, self).__init__(jsondict=jsondict, strict=strict) @@ -312,6 +378,10 @@ def elementProperties(self): import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] try: from . import codeableconcept except ImportError: @@ -320,14 +390,18 @@ def elementProperties(self): from . import contactdetail except ImportError: contactdetail = sys.modules[__package__ + '.contactdetail'] -try: - from . import contributor -except ImportError: - contributor = sys.modules[__package__ + '.contributor'] try: from . import dosage except ImportError: dosage = sys.modules[__package__ + '.dosage'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/activitydefinition_tests.py b/fhirclient/models/activitydefinition_tests.py index 229718e1d..beab57bbb 100644 --- a/fhirclient/models/activitydefinition_tests.py +++ b/fhirclient/models/activitydefinition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return activitydefinition.ActivityDefinition(js) def testActivityDefinition1(self): - inst = self.instantiate_from("activitydefinition-example.json") + inst = self.instantiate_from("activitydefinition-predecessor-example.json") self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") self.implActivityDefinition1(inst) @@ -32,8 +32,15 @@ def testActivityDefinition1(self): self.implActivityDefinition1(inst2) def implActivityDefinition1(self, inst): - self.assertEqual(inst.approvalDate.date, FHIRDate("2017-03-01").date) - self.assertEqual(inst.approvalDate.as_json(), "2017-03-01") + self.assertEqual(inst.approvalDate.date, FHIRDate("2016-03-12").date) + self.assertEqual(inst.approvalDate.as_json(), "2016-03-12") + self.assertEqual(inst.author[0].name, "Motive Medical Intelligence") + self.assertEqual(inst.author[0].telecom[0].system, "phone") + self.assertEqual(inst.author[0].telecom[0].use, "work") + self.assertEqual(inst.author[0].telecom[0].value, "415-362-4007") + self.assertEqual(inst.author[0].telecom[1].system, "email") + self.assertEqual(inst.author[0].telecom[1].use, "work") + self.assertEqual(inst.author[0].telecom[1].value, "info@motivemi.com") self.assertEqual(inst.code.coding[0].code, "306206005") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.code.text, "Referral to service (procedure)") @@ -43,80 +50,73 @@ def implActivityDefinition1(self, inst): self.assertEqual(inst.contact[0].telecom[1].system, "email") self.assertEqual(inst.contact[0].telecom[1].use, "work") self.assertEqual(inst.contact[0].telecom[1].value, "info@motivemi.com") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].value, "415-362-4007") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].system, "email") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].value, "info@motivemi.com") - self.assertEqual(inst.contributor[0].name, "Motive Medical Intelligence") - self.assertEqual(inst.contributor[0].type, "author") self.assertEqual(inst.copyright, "© Copyright 2016 Motive Medical Intelligence. All rights reserved.") self.assertEqual(inst.date.date, FHIRDate("2017-03-03T14:06:00Z").date) self.assertEqual(inst.date.as_json(), "2017-03-03T14:06:00Z") self.assertEqual(inst.description, "refer to primary care mental-health integrated care program for evaluation and treatment of mental health conditions now") self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2017-12-31").date) self.assertEqual(inst.effectivePeriod.end.as_json(), "2017-12-31") - self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2017-03-01").date) - self.assertEqual(inst.effectivePeriod.start.as_json(), "2017-03-01") + self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2016-01-01").date) + self.assertEqual(inst.effectivePeriod.start.as_json(), "2016-01-01") self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "referralPrimaryCareMentalHealth") + self.assertEqual(inst.id, "referralPrimaryCareMentalHealth-initial") self.assertEqual(inst.identifier[0].system, "http://motivemi.com/artifacts") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "referralPrimaryCareMentalHealth") self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.kind, "ReferralRequest") - self.assertEqual(inst.lastReviewDate.date, FHIRDate("2017-03-01").date) - self.assertEqual(inst.lastReviewDate.as_json(), "2017-03-01") + self.assertEqual(inst.kind, "ServiceRequest") + self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-08-15").date) + self.assertEqual(inst.lastReviewDate.as_json(), "2016-08-15") self.assertEqual(inst.name, "ReferralPrimaryCareMentalHealth") self.assertEqual(inst.participant[0].type, "practitioner") self.assertEqual(inst.publisher, "Motive Medical Intelligence") self.assertEqual(inst.relatedArtifact[0].display, "Practice Guideline for the Treatment of Patients with Major Depressive Disorder") self.assertEqual(inst.relatedArtifact[0].type, "citation") self.assertEqual(inst.relatedArtifact[0].url, "http://psychiatryonline.org/pb/assets/raw/sitewide/practice_guidelines/guidelines/mdd.pdf") - self.assertEqual(inst.relatedArtifact[1].type, "predecessor") - self.assertEqual(inst.status, "active") + self.assertEqual(inst.relatedArtifact[1].resource, "ActivityDefinition/referralPrimaryCareMentalHealth") + self.assertEqual(inst.relatedArtifact[1].type, "successor") + self.assertEqual(inst.status, "retired") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.title, "Referral to Primary Care Mental Health") self.assertEqual(inst.topic[0].text, "Mental Health Referral") self.assertEqual(inst.url, "http://motivemi.com/artifacts/ActivityDefinition/referralPrimaryCareMentalHealth") self.assertEqual(inst.useContext[0].code.code, "age") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "D000328") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Adult") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "https://meshb.nlm.nih.gov") self.assertEqual(inst.useContext[1].code.code, "focus") - self.assertEqual(inst.useContext[1].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[1].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].code, "87512008") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].display, "Mild major depression") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[2].code.code, "focus") - self.assertEqual(inst.useContext[2].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[2].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].code, "40379007") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].display, "Major depression, recurrent, mild") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[3].code.code, "focus") - self.assertEqual(inst.useContext[3].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[3].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].code, "225444004") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].display, "At risk for suicide (finding)") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[4].code.code, "focus") - self.assertEqual(inst.useContext[4].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[4].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].code, "306206005") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].display, "Referral to service (procedure)") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[5].code.code, "user") - self.assertEqual(inst.useContext[5].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[5].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].code, "309343006") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].display, "Physician") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[6].code.code, "venue") - self.assertEqual(inst.useContext[6].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[6].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].code, "440655000") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].display, "Outpatient environment") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.version, "1.1.0") + self.assertEqual(inst.version, "1.0.0") def testActivityDefinition2(self): inst = self.instantiate_from("activitydefinition-medicationorder-example.json") @@ -131,6 +131,13 @@ def testActivityDefinition2(self): def implActivityDefinition2(self, inst): self.assertEqual(inst.approvalDate.date, FHIRDate("2016-03-12").date) self.assertEqual(inst.approvalDate.as_json(), "2016-03-12") + self.assertEqual(inst.author[0].name, "Motive Medical Intelligence") + self.assertEqual(inst.author[0].telecom[0].system, "phone") + self.assertEqual(inst.author[0].telecom[0].use, "work") + self.assertEqual(inst.author[0].telecom[0].value, "415-362-4007") + self.assertEqual(inst.author[0].telecom[1].system, "email") + self.assertEqual(inst.author[0].telecom[1].use, "work") + self.assertEqual(inst.author[0].telecom[1].value, "info@motivemi.com") self.assertEqual(inst.contact[0].telecom[0].system, "phone") self.assertEqual(inst.contact[0].telecom[0].use, "work") self.assertEqual(inst.contact[0].telecom[0].value, "415-362-4007") @@ -139,20 +146,15 @@ def implActivityDefinition2(self, inst): self.assertEqual(inst.contact[0].telecom[1].value, "info@motivemi.com") self.assertEqual(inst.contained[0].id, "citalopramMedication") self.assertEqual(inst.contained[1].id, "citalopramSubstance") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].value, "415-362-4007") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].system, "email") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].value, "info@motivemi.com") - self.assertEqual(inst.contributor[0].name, "Motive Medical Intelligence") - self.assertEqual(inst.contributor[0].type, "author") self.assertEqual(inst.copyright, "© Copyright 2016 Motive Medical Intelligence. All rights reserved.") self.assertEqual(inst.date.date, FHIRDate("2015-08-15").date) self.assertEqual(inst.date.as_json(), "2015-08-15") self.assertEqual(inst.description, "Citalopram 20 mg tablet 1 tablet oral 1 time daily now (30 table; 3 refills") - self.assertEqual(inst.dosage[0].doseQuantity.unit, "{tbl}") - self.assertEqual(inst.dosage[0].doseQuantity.value, 1) + self.assertEqual(inst.dosage[0].doseAndRate[0].doseQuantity.unit, "{tbl}") + self.assertEqual(inst.dosage[0].doseAndRate[0].doseQuantity.value, 1) + self.assertEqual(inst.dosage[0].doseAndRate[0].type.coding[0].code, "ordered") + self.assertEqual(inst.dosage[0].doseAndRate[0].type.coding[0].display, "Ordered") + self.assertEqual(inst.dosage[0].doseAndRate[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/dose-rate-type") self.assertEqual(inst.dosage[0].route.coding[0].code, "26643006") self.assertEqual(inst.dosage[0].route.coding[0].display, "Oral route (qualifier value)") self.assertEqual(inst.dosage[0].route.text, "Oral route (qualifier value)") @@ -160,13 +162,13 @@ def implActivityDefinition2(self, inst): self.assertEqual(inst.dosage[0].timing.repeat.frequency, 1) self.assertEqual(inst.dosage[0].timing.repeat.period, 1) self.assertEqual(inst.dosage[0].timing.repeat.periodUnit, "d") - self.assertEqual(inst.dynamicValue[0].description, "dispenseRequest.numberOfRepeatsAllowed is three (3)") - self.assertEqual(inst.dynamicValue[0].expression, "3") - self.assertEqual(inst.dynamicValue[0].language, "text/cql") + self.assertEqual(inst.dynamicValue[0].expression.description, "dispenseRequest.numberOfRepeatsAllowed is three (3)") + self.assertEqual(inst.dynamicValue[0].expression.expression, "3") + self.assertEqual(inst.dynamicValue[0].expression.language, "text/cql") self.assertEqual(inst.dynamicValue[0].path, "dispenseRequest.numberOfRepeatsAllowed") - self.assertEqual(inst.dynamicValue[1].description, "dispenseRequest.quantity is thirty (30) tablets") - self.assertEqual(inst.dynamicValue[1].expression, "30 '{tbl}'") - self.assertEqual(inst.dynamicValue[1].language, "text/cql") + self.assertEqual(inst.dynamicValue[1].expression.description, "dispenseRequest.quantity is thirty (30) tablets") + self.assertEqual(inst.dynamicValue[1].expression.expression, "30 '{tbl}'") + self.assertEqual(inst.dynamicValue[1].expression.language, "text/cql") self.assertEqual(inst.dynamicValue[1].path, "dispenseRequest.quantity") self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2017-12-31").date) self.assertEqual(inst.effectivePeriod.end.as_json(), "2017-12-31") @@ -188,6 +190,7 @@ def implActivityDefinition2(self, inst): self.assertEqual(inst.relatedArtifact[0].display, "Practice Guideline for the Treatment of Patients with Major Depressive Disorder") self.assertEqual(inst.relatedArtifact[0].type, "citation") self.assertEqual(inst.relatedArtifact[0].url, "http://psychiatryonline.org/pb/assets/raw/sitewide/practice_guidelines/guidelines/mdd.pdf") + self.assertEqual(inst.relatedArtifact[1].resource, "#citalopramMedication") self.assertEqual(inst.relatedArtifact[1].type, "composed-of") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") @@ -196,44 +199,44 @@ def implActivityDefinition2(self, inst): self.assertEqual(inst.url, "http://motivemi.com/artifacts/ActivityDefinition/citalopramPrescription") self.assertEqual(inst.usage, "This activity definition is used as part of various suicide risk order sets") self.assertEqual(inst.useContext[0].code.code, "age") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "D000328") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Adult") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "https://meshb.nlm.nih.gov") self.assertEqual(inst.useContext[1].code.code, "focus") - self.assertEqual(inst.useContext[1].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[1].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].code, "87512008") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].display, "Mild major depression") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[2].code.code, "focus") - self.assertEqual(inst.useContext[2].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[2].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].code, "40379007") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].display, "Major depression, recurrent, mild") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[3].code.code, "focus") - self.assertEqual(inst.useContext[3].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[3].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].code, "225444004") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].display, "At risk for suicide (finding)") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[4].code.code, "focus") - self.assertEqual(inst.useContext[4].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[4].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].code, "306206005") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].display, "Referral to service (procedure)") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[5].code.code, "user") - self.assertEqual(inst.useContext[5].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[5].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].code, "309343006") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].display, "Physician") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[6].code.code, "venue") - self.assertEqual(inst.useContext[6].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[6].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].code, "440655000") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].display, "Outpatient environment") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.version, "1.0.0") def testActivityDefinition3(self): - inst = self.instantiate_from("activitydefinition-predecessor-example.json") + inst = self.instantiate_from("activitydefinition-example.json") self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") self.implActivityDefinition3(inst) @@ -243,8 +246,15 @@ def testActivityDefinition3(self): self.implActivityDefinition3(inst2) def implActivityDefinition3(self, inst): - self.assertEqual(inst.approvalDate.date, FHIRDate("2016-03-12").date) - self.assertEqual(inst.approvalDate.as_json(), "2016-03-12") + self.assertEqual(inst.approvalDate.date, FHIRDate("2017-03-01").date) + self.assertEqual(inst.approvalDate.as_json(), "2017-03-01") + self.assertEqual(inst.author[0].name, "Motive Medical Intelligence") + self.assertEqual(inst.author[0].telecom[0].system, "phone") + self.assertEqual(inst.author[0].telecom[0].use, "work") + self.assertEqual(inst.author[0].telecom[0].value, "415-362-4007") + self.assertEqual(inst.author[0].telecom[1].system, "email") + self.assertEqual(inst.author[0].telecom[1].use, "work") + self.assertEqual(inst.author[0].telecom[1].value, "info@motivemi.com") self.assertEqual(inst.code.coding[0].code, "306206005") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.code.text, "Referral to service (procedure)") @@ -254,83 +264,76 @@ def implActivityDefinition3(self, inst): self.assertEqual(inst.contact[0].telecom[1].system, "email") self.assertEqual(inst.contact[0].telecom[1].use, "work") self.assertEqual(inst.contact[0].telecom[1].value, "info@motivemi.com") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].value, "415-362-4007") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].system, "email") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].value, "info@motivemi.com") - self.assertEqual(inst.contributor[0].name, "Motive Medical Intelligence") - self.assertEqual(inst.contributor[0].type, "author") self.assertEqual(inst.copyright, "© Copyright 2016 Motive Medical Intelligence. All rights reserved.") self.assertEqual(inst.date.date, FHIRDate("2017-03-03T14:06:00Z").date) self.assertEqual(inst.date.as_json(), "2017-03-03T14:06:00Z") self.assertEqual(inst.description, "refer to primary care mental-health integrated care program for evaluation and treatment of mental health conditions now") self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2017-12-31").date) self.assertEqual(inst.effectivePeriod.end.as_json(), "2017-12-31") - self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2016-01-01").date) - self.assertEqual(inst.effectivePeriod.start.as_json(), "2016-01-01") + self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2017-03-01").date) + self.assertEqual(inst.effectivePeriod.start.as_json(), "2017-03-01") self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "referralPrimaryCareMentalHealth-initial") + self.assertEqual(inst.id, "referralPrimaryCareMentalHealth") self.assertEqual(inst.identifier[0].system, "http://motivemi.com/artifacts") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "referralPrimaryCareMentalHealth") self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.kind, "ReferralRequest") - self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-08-15").date) - self.assertEqual(inst.lastReviewDate.as_json(), "2016-08-15") + self.assertEqual(inst.kind, "ServiceRequest") + self.assertEqual(inst.lastReviewDate.date, FHIRDate("2017-03-01").date) + self.assertEqual(inst.lastReviewDate.as_json(), "2017-03-01") self.assertEqual(inst.name, "ReferralPrimaryCareMentalHealth") self.assertEqual(inst.participant[0].type, "practitioner") self.assertEqual(inst.publisher, "Motive Medical Intelligence") self.assertEqual(inst.relatedArtifact[0].display, "Practice Guideline for the Treatment of Patients with Major Depressive Disorder") self.assertEqual(inst.relatedArtifact[0].type, "citation") self.assertEqual(inst.relatedArtifact[0].url, "http://psychiatryonline.org/pb/assets/raw/sitewide/practice_guidelines/guidelines/mdd.pdf") - self.assertEqual(inst.relatedArtifact[1].type, "successor") - self.assertEqual(inst.status, "retired") + self.assertEqual(inst.relatedArtifact[1].resource, "ActivityDefinition/referralPrimaryCareMentalHealth-initial") + self.assertEqual(inst.relatedArtifact[1].type, "predecessor") + self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.title, "Referral to Primary Care Mental Health") self.assertEqual(inst.topic[0].text, "Mental Health Referral") self.assertEqual(inst.url, "http://motivemi.com/artifacts/ActivityDefinition/referralPrimaryCareMentalHealth") self.assertEqual(inst.useContext[0].code.code, "age") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "D000328") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Adult") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "https://meshb.nlm.nih.gov") self.assertEqual(inst.useContext[1].code.code, "focus") - self.assertEqual(inst.useContext[1].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[1].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].code, "87512008") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].display, "Mild major depression") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[2].code.code, "focus") - self.assertEqual(inst.useContext[2].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[2].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].code, "40379007") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].display, "Major depression, recurrent, mild") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[3].code.code, "focus") - self.assertEqual(inst.useContext[3].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[3].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].code, "225444004") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].display, "At risk for suicide (finding)") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[4].code.code, "focus") - self.assertEqual(inst.useContext[4].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[4].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].code, "306206005") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].display, "Referral to service (procedure)") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[5].code.code, "user") - self.assertEqual(inst.useContext[5].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[5].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].code, "309343006") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].display, "Physician") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[6].code.code, "venue") - self.assertEqual(inst.useContext[6].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[6].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].code, "440655000") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].display, "Outpatient environment") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.version, "1.0.0") + self.assertEqual(inst.version, "1.1.0") def testActivityDefinition4(self): - inst = self.instantiate_from("activitydefinition-procedurerequest-example.json") + inst = self.instantiate_from("activitydefinition-servicerequest-example.json") self.assertIsNotNone(inst, "Must have instantiated a ActivityDefinition instance") self.implActivityDefinition4(inst) @@ -348,7 +351,10 @@ def implActivityDefinition4(self, inst): self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.description, "Heart valve replacement") self.assertEqual(inst.id, "heart-valve-replacement") - self.assertEqual(inst.kind, "ProcedureRequest") + self.assertEqual(inst.kind, "ServiceRequest") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.participant[0].role.coding[0].code, "207RI0011X") self.assertEqual(inst.participant[0].role.coding[0].display, "Interventional Cardiology") self.assertEqual(inst.participant[0].role.coding[0].system, "http://nucc.org/provider-taxonomy") @@ -361,12 +367,12 @@ def implActivityDefinition4(self, inst): self.assertEqual(inst.topic[0].coding[0].display, "Heart valve replacement") self.assertEqual(inst.topic[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[0].code.code, "age") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "D000328") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Adult") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "https://meshb.nlm.nih.gov") self.assertEqual(inst.useContext[1].code.code, "user") - self.assertEqual(inst.useContext[1].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[1].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].code, "309343006") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].display, "Physician") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") @@ -387,8 +393,12 @@ def implActivityDefinition5(self, inst): self.assertEqual(inst.description, "10 Blood collect tubes blue cap") self.assertEqual(inst.id, "blood-tubes-supply") self.assertEqual(inst.kind, "SupplyRequest") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.purpose, "Describes a request for 10 Blood collection tubes with blue caps.") self.assertEqual(inst.quantity.value, 10) self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.transform, "StructureMap/supplyrequest-transform") diff --git a/fhirclient/models/address.py b/fhirclient/models/address.py index 5469fda71..ea7c384ac 100644 --- a/fhirclient/models/address.py +++ b/fhirclient/models/address.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Address) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Address) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -65,7 +65,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.use = None - """ home | work | temp | old - purpose of this address. + """ home | work | temp | old | billing - purpose of this address. Type `str`. """ super(Address, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/adverseevent.py b/fhirclient/models/adverseevent.py index ecd2be1ce..d34b8e2ce 100644 --- a/fhirclient/models/adverseevent.py +++ b/fhirclient/models/adverseevent.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/AdverseEvent) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AdverseEvent) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,28 +27,38 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.category = None - """ AE | PAE - An adverse event is an event that caused harm to a patient, an - adverse reaction is a something that is a subject-specific event - that is a result of an exposure to a medication, food, device or - environmental substance, a potential adverse event is something - that occurred and that could have caused harm to a patient but did - not. + self.actuality = None + """ actual | potential. Type `str`. """ + self.category = None + """ product-problem | product-quality | product-use-error | wrong-dose + | incorrect-prescribing-information | wrong-technique | wrong- + route-of-administration | wrong-rate | wrong-duration | wrong-time + | expired-drug | medical-device-use-error | problem-different- + manufacturer | unsafe-physical-environment. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.contributor = None + """ Who was involved in the adverse event or the potential adverse + event. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.date = None """ When the event occurred. Type `FHIRDate` (represented as `str` in JSON). """ - self.description = None - """ Description of the adverse event. - Type `str`. """ + self.detected = None + """ When the event was detected. + Type `FHIRDate` (represented as `str` in JSON). """ - self.eventParticipant = None - """ Who was involved in the adverse event or the potential adverse - event. - Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.event = None + """ Type of the event itself in relation to the subject. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.identifier = None """ Business identifier for the event. @@ -56,70 +66,78 @@ def __init__(self, jsondict=None, strict=True): self.location = None """ Location where adverse event occurred. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.outcome = None """ resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.reaction = None - """ Adverse Reaction Events linked to exposure to substance. - List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + self.recordedDate = None + """ When the event was recorded. + Type `FHIRDate` (represented as `str` in JSON). """ self.recorder = None """ Who recorded the adverse event. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.referenceDocument = None """ AdverseEvent.referenceDocument. - List of `FHIRReference` items referencing `DocumentReference` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.resultingCondition = None + """ Effect on the subject due to this event. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.seriousness = None - """ Mild | Moderate | Severe. + """ Seriousness of the event. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.severity = None + """ mild | moderate | severe. Type `CodeableConcept` (represented as `dict` in JSON). """ self.study = None """ AdverseEvent.study. - List of `FHIRReference` items referencing `ResearchStudy` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.subject = None - """ Subject or group impacted by event. - Type `FHIRReference` referencing `Patient, ResearchSubject, Medication, Device` (represented as `dict` in JSON). """ + """ Subject impacted by event. + Type `FHIRReference` (represented as `dict` in JSON). """ self.subjectMedicalHistory = None """ AdverseEvent.subjectMedicalHistory. - List of `FHIRReference` items referencing `Condition, Observation, AllergyIntolerance, FamilyMemberHistory, Immunization, Procedure` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.suspectEntity = None """ The suspected agent causing the adverse event. List of `AdverseEventSuspectEntity` items (represented as `dict` in JSON). """ - self.type = None - """ actual | potential. - Type `CodeableConcept` (represented as `dict` in JSON). """ - super(AdverseEvent, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(AdverseEvent, self).elementProperties() js.extend([ - ("category", "category", str, False, None, False), + ("actuality", "actuality", str, False, None, True), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("contributor", "contributor", fhirreference.FHIRReference, True, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), - ("description", "description", str, False, None, False), - ("eventParticipant", "eventParticipant", fhirreference.FHIRReference, False, None, False), + ("detected", "detected", fhirdate.FHIRDate, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("event", "event", codeableconcept.CodeableConcept, False, None, False), ("identifier", "identifier", identifier.Identifier, False, None, False), ("location", "location", fhirreference.FHIRReference, False, None, False), ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), - ("reaction", "reaction", fhirreference.FHIRReference, True, None, False), + ("recordedDate", "recordedDate", fhirdate.FHIRDate, False, None, False), ("recorder", "recorder", fhirreference.FHIRReference, False, None, False), ("referenceDocument", "referenceDocument", fhirreference.FHIRReference, True, None, False), + ("resultingCondition", "resultingCondition", fhirreference.FHIRReference, True, None, False), ("seriousness", "seriousness", codeableconcept.CodeableConcept, False, None, False), + ("severity", "severity", codeableconcept.CodeableConcept, False, None, False), ("study", "study", fhirreference.FHIRReference, True, None, False), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), ("subjectMedicalHistory", "subjectMedicalHistory", fhirreference.FHIRReference, True, None, False), ("suspectEntity", "suspectEntity", AdverseEventSuspectEntity, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -143,45 +161,63 @@ def __init__(self, jsondict=None, strict=True): """ self.causality = None - """ causality1 | causality2. - Type `str`. """ + """ Information on the possible cause of the event. + List of `AdverseEventSuspectEntityCausality` items (represented as `dict` in JSON). """ + + self.instance = None + """ Refers to the specific entity that caused the adverse event. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(AdverseEventSuspectEntity, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(AdverseEventSuspectEntity, self).elementProperties() + js.extend([ + ("causality", "causality", AdverseEventSuspectEntityCausality, True, None, False), + ("instance", "instance", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +class AdverseEventSuspectEntityCausality(backboneelement.BackboneElement): + """ Information on the possible cause of the event. + """ + + resource_type = "AdverseEventSuspectEntityCausality" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. - self.causalityAssessment = None - """ assess1 | assess2. + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.assessment = None + """ Assessment of if the entity caused the event. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.causalityAuthor = None + self.author = None """ AdverseEvent.suspectEntity.causalityAuthor. - Type `FHIRReference` referencing `Practitioner, PractitionerRole` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.causalityMethod = None - """ method1 | method2. + self.method = None + """ ProbabilityScale | Bayesian | Checklist. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.causalityProductRelatedness = None + self.productRelatedness = None """ AdverseEvent.suspectEntity.causalityProductRelatedness. Type `str`. """ - self.causalityResult = None - """ result1 | result2. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.instance = None - """ Refers to the specific entity that caused the adverse event. - Type `FHIRReference` referencing `Substance, Medication, MedicationAdministration, MedicationStatement, Device` (represented as `dict` in JSON). """ - - super(AdverseEventSuspectEntity, self).__init__(jsondict=jsondict, strict=strict) + super(AdverseEventSuspectEntityCausality, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(AdverseEventSuspectEntity, self).elementProperties() + js = super(AdverseEventSuspectEntityCausality, self).elementProperties() js.extend([ - ("causality", "causality", str, False, None, False), - ("causalityAssessment", "causalityAssessment", codeableconcept.CodeableConcept, False, None, False), - ("causalityAuthor", "causalityAuthor", fhirreference.FHIRReference, False, None, False), - ("causalityMethod", "causalityMethod", codeableconcept.CodeableConcept, False, None, False), - ("causalityProductRelatedness", "causalityProductRelatedness", str, False, None, False), - ("causalityResult", "causalityResult", codeableconcept.CodeableConcept, False, None, False), - ("instance", "instance", fhirreference.FHIRReference, False, None, True), + ("assessment", "assessment", codeableconcept.CodeableConcept, False, None, False), + ("author", "author", fhirreference.FHIRReference, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("productRelatedness", "productRelatedness", str, False, None, False), ]) return js diff --git a/fhirclient/models/adverseevent_tests.py b/fhirclient/models/adverseevent_tests.py index aaf67d93f..7ac2b20dd 100644 --- a/fhirclient/models/adverseevent_tests.py +++ b/fhirclient/models/adverseevent_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,18 +32,27 @@ def testAdverseEvent1(self): self.implAdverseEvent1(inst2) def implAdverseEvent1(self, inst): - self.assertEqual(inst.category, "AE") + self.assertEqual(inst.actuality, "actual") + self.assertEqual(inst.category[0].coding[0].code, "product-use-error") + self.assertEqual(inst.category[0].coding[0].display, "Product Use Error") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/adverse-event-category") self.assertEqual(inst.date.date, FHIRDate("2017-01-29T12:34:56+00:00").date) self.assertEqual(inst.date.as_json(), "2017-01-29T12:34:56+00:00") - self.assertEqual(inst.description, "This was a mild rash on the left forearm") + self.assertEqual(inst.event.coding[0].code, "304386008") + self.assertEqual(inst.event.coding[0].display, "O/E - itchy rash") + self.assertEqual(inst.event.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.event.text, "This was a mild rash on the left forearm") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier.system, "http://acme.com/ids/patients/risks") self.assertEqual(inst.identifier.value, "49476534") - self.assertEqual(inst.seriousness.coding[0].code, "Mild") - self.assertEqual(inst.seriousness.coding[0].display, "Mild") - self.assertEqual(inst.seriousness.coding[0].system, "http://hl7.org/fhir/adverse-event-seriousness") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.seriousness.coding[0].code, "Non-serious") + self.assertEqual(inst.seriousness.coding[0].display, "Non-serious") + self.assertEqual(inst.seriousness.coding[0].system, "http://terminology.hl7.org/CodeSystem/adverse-event-seriousness") + self.assertEqual(inst.severity.coding[0].code, "mild") + self.assertEqual(inst.severity.coding[0].display, "Mild") + self.assertEqual(inst.severity.coding[0].system, "http://terminology.hl7.org/CodeSystem/adverse-event-severity") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "304386008") - self.assertEqual(inst.type.coding[0].display, "O/E - itchy rash") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") diff --git a/fhirclient/models/age.py b/fhirclient/models/age.py index 7c0f4beaf..20f8e7cce 100644 --- a/fhirclient/models/age.py +++ b/fhirclient/models/age.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Age) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Age) on 2019-05-07. +# 2019, SMART Health IT. from . import quantity diff --git a/fhirclient/models/allergyintolerance.py b/fhirclient/models/allergyintolerance.py index b3f92b254..45a7bcaf9 100644 --- a/fhirclient/models/allergyintolerance.py +++ b/fhirclient/models/allergyintolerance.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -24,13 +24,9 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.assertedDate = None - """ Date record was believed accurate. - Type `FHIRDate` (represented as `str` in JSON). """ - self.asserter = None """ Source of the information about the allergy. - Type `FHIRReference` referencing `Patient, RelatedPerson, Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.category = None """ food | medication | environment | biologic. @@ -38,7 +34,7 @@ def __init__(self, jsondict=None, strict=True): self.clinicalStatus = None """ active | inactive | resolved. - Type `str`. """ + Type `CodeableConcept` (represented as `dict` in JSON). """ self.code = None """ Code that identifies the allergy or intolerance. @@ -48,6 +44,10 @@ def __init__(self, jsondict=None, strict=True): """ low | high | unable-to-assess. Type `str`. """ + self.encounter = None + """ Encounter when the allergy or intolerance was asserted. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.identifier = None """ External ids for this item. List of `Identifier` items (represented as `dict` in JSON). """ @@ -82,15 +82,19 @@ def __init__(self, jsondict=None, strict=True): self.patient = None """ Who the sensitivity is for. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.reaction = None """ Adverse Reaction Events linked to exposure to substance. List of `AllergyIntoleranceReaction` items (represented as `dict` in JSON). """ + self.recordedDate = None + """ Date first version of the resource instance was recorded. + Type `FHIRDate` (represented as `str` in JSON). """ + self.recorder = None """ Who recorded the sensitivity. - Type `FHIRReference` referencing `Practitioner, Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ allergy | intolerance - Underlying mechanism (if known). @@ -98,19 +102,19 @@ def __init__(self, jsondict=None, strict=True): self.verificationStatus = None """ unconfirmed | confirmed | refuted | entered-in-error. - Type `str`. """ + Type `CodeableConcept` (represented as `dict` in JSON). """ super(AllergyIntolerance, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(AllergyIntolerance, self).elementProperties() js.extend([ - ("assertedDate", "assertedDate", fhirdate.FHIRDate, False, None, False), ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), ("category", "category", str, True, None, False), - ("clinicalStatus", "clinicalStatus", str, False, None, False), + ("clinicalStatus", "clinicalStatus", codeableconcept.CodeableConcept, False, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("criticality", "criticality", str, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("lastOccurrence", "lastOccurrence", fhirdate.FHIRDate, False, None, False), ("note", "note", annotation.Annotation, True, None, False), @@ -121,9 +125,10 @@ def elementProperties(self): ("onsetString", "onsetString", str, False, "onset", False), ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("reaction", "reaction", AllergyIntoleranceReaction, True, None, False), + ("recordedDate", "recordedDate", fhirdate.FHIRDate, False, None, False), ("recorder", "recorder", fhirreference.FHIRReference, False, None, False), ("type", "type", str, False, None, False), - ("verificationStatus", "verificationStatus", str, False, None, True), + ("verificationStatus", "verificationStatus", codeableconcept.CodeableConcept, False, None, False), ]) return js diff --git a/fhirclient/models/allergyintolerance_tests.py b/fhirclient/models/allergyintolerance_tests.py index 3cda5c956..49fd70409 100644 --- a/fhirclient/models/allergyintolerance_tests.py +++ b/fhirclient/models/allergyintolerance_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,10 +32,10 @@ def testAllergyIntolerance1(self): self.implAllergyIntolerance1(inst2) def implAllergyIntolerance1(self, inst): - self.assertEqual(inst.assertedDate.date, FHIRDate("2014-10-09T14:58:00+11:00").date) - self.assertEqual(inst.assertedDate.as_json(), "2014-10-09T14:58:00+11:00") self.assertEqual(inst.category[0], "food") - self.assertEqual(inst.clinicalStatus, "active") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].display, "Active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical") self.assertEqual(inst.code.coding[0].code, "227493005") self.assertEqual(inst.code.coding[0].display, "Cashew nuts") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") @@ -45,6 +45,9 @@ def implAllergyIntolerance1(self, inst): self.assertEqual(inst.identifier[0].value, "49476534") self.assertEqual(inst.lastOccurrence.date, FHIRDate("2012-06").date) self.assertEqual(inst.lastOccurrence.as_json(), "2012-06") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract.") self.assertEqual(inst.onsetDateTime.date, FHIRDate("2004").date) self.assertEqual(inst.onsetDateTime.as_json(), "2004") @@ -68,7 +71,11 @@ def implAllergyIntolerance1(self, inst): self.assertEqual(inst.reaction[1].onset.date, FHIRDate("2004").date) self.assertEqual(inst.reaction[1].onset.as_json(), "2004") self.assertEqual(inst.reaction[1].severity, "moderate") + self.assertEqual(inst.recordedDate.date, FHIRDate("2014-10-09T14:58:00+11:00").date) + self.assertEqual(inst.recordedDate.as_json(), "2014-10-09T14:58:00+11:00") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type, "allergy") - self.assertEqual(inst.verificationStatus, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].display, "Confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification") diff --git a/fhirclient/models/annotation.py b/fhirclient/models/annotation.py index a6f1b2ac2..5cf300532 100644 --- a/fhirclient/models/annotation.py +++ b/fhirclient/models/annotation.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Annotation) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -26,14 +26,14 @@ def __init__(self, jsondict=None, strict=True): self.authorReference = None """ Individual responsible for the annotation. - Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.authorString = None """ Individual responsible for the annotation. Type `str`. """ self.text = None - """ The annotation - text content. + """ The annotation - text content (as markdown). Type `str`. """ self.time = None diff --git a/fhirclient/models/appointment.py b/fhirclient/models/appointment.py index d5ca3fcf5..19ccd53c2 100644 --- a/fhirclient/models/appointment.py +++ b/fhirclient/models/appointment.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Appointment) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -28,6 +28,14 @@ def __init__(self, jsondict=None, strict=True): slot (not service type). Type `CodeableConcept` (represented as `dict` in JSON). """ + self.basedOn = None + """ The service request this appointment is allocated to assess. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.cancelationReason = None + """ The coded reason for the appointment being cancelled. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.comment = None """ Additional comments. Type `str`. """ @@ -48,15 +56,6 @@ def __init__(self, jsondict=None, strict=True): """ External Ids for this item. List of `Identifier` items (represented as `dict` in JSON). """ - self.incomingReferral = None - """ The ReferralRequest provided as information to allocate to the - Encounter. - List of `FHIRReference` items referencing `ReferralRequest` (represented as `dict` in JSON). """ - - self.indication = None - """ Reason the appointment is to takes place (resource). - List of `FHIRReference` items referencing `Condition, Procedure` (represented as `dict` in JSON). """ - self.minutesDuration = None """ Can be less than start/end (e.g. estimate). Type `int`. """ @@ -65,23 +64,31 @@ def __init__(self, jsondict=None, strict=True): """ Participants involved in appointment. List of `AppointmentParticipant` items (represented as `dict` in JSON). """ + self.patientInstruction = None + """ Detailed information and instructions for the patient. + Type `str`. """ + self.priority = None """ Used to make informed decisions if needing to re-prioritize. Type `int`. """ - self.reason = None - """ Reason this appointment is scheduled. + self.reasonCode = None + """ Coded reason this appointment is scheduled. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.reasonReference = None + """ Reason the appointment is to take place (resource). + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.requestedPeriod = None """ Potential date/time interval(s) requested to allocate the appointment within. List of `Period` items (represented as `dict` in JSON). """ self.serviceCategory = None - """ A broad categorisation of the service that is to be performed + """ A broad categorization of the service that is to be performed during this appointment. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.serviceType = None """ The specific service that is to be performed during this @@ -90,7 +97,7 @@ def __init__(self, jsondict=None, strict=True): self.slot = None """ The slots that this appointment is filling. - List of `FHIRReference` items referencing `Slot` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.specialty = None """ The specialty of a practitioner that would be required to perform @@ -103,12 +110,12 @@ def __init__(self, jsondict=None, strict=True): self.status = None """ proposed | pending | booked | arrived | fulfilled | cancelled | - noshow | entered-in-error. + noshow | entered-in-error | checked-in | waitlist. Type `str`. """ self.supportingInformation = None """ Additional information to support the appointment. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(Appointment, self).__init__(jsondict=jsondict, strict=strict) @@ -116,19 +123,21 @@ def elementProperties(self): js = super(Appointment, self).elementProperties() js.extend([ ("appointmentType", "appointmentType", codeableconcept.CodeableConcept, False, None, False), + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), + ("cancelationReason", "cancelationReason", codeableconcept.CodeableConcept, False, None, False), ("comment", "comment", str, False, None, False), ("created", "created", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), ("end", "end", fhirdate.FHIRDate, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("incomingReferral", "incomingReferral", fhirreference.FHIRReference, True, None, False), - ("indication", "indication", fhirreference.FHIRReference, True, None, False), ("minutesDuration", "minutesDuration", int, False, None, False), ("participant", "participant", AppointmentParticipant, True, None, True), + ("patientInstruction", "patientInstruction", str, False, None, False), ("priority", "priority", int, False, None, False), - ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("requestedPeriod", "requestedPeriod", period.Period, True, None, False), - ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, False, None, False), + ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, True, None, False), ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), ("slot", "slot", fhirreference.FHIRReference, True, None, False), ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), @@ -159,7 +168,11 @@ def __init__(self, jsondict=None, strict=True): self.actor = None """ Person, Location/HealthcareService or Device. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ Participation period of the actor. + Type `Period` (represented as `dict` in JSON). """ self.required = None """ required | optional | information-only. @@ -179,6 +192,7 @@ def elementProperties(self): js = super(AppointmentParticipant, self).elementProperties() js.extend([ ("actor", "actor", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), ("required", "required", str, False, None, False), ("status", "status", str, False, None, True), ("type", "type", codeableconcept.CodeableConcept, True, None, False), diff --git a/fhirclient/models/appointment_tests.py b/fhirclient/models/appointment_tests.py index c0c0b5df4..cdce75f33 100644 --- a/fhirclient/models/appointment_tests.py +++ b/fhirclient/models/appointment_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return appointment.Appointment(js) def testAppointment1(self): - inst = self.instantiate_from("appointment-example-request.json") + inst = self.instantiate_from("appointment-example.json") self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") self.implAppointment1(inst) @@ -32,45 +32,44 @@ def testAppointment1(self): self.implAppointment1(inst2) def implAppointment1(self, inst): - self.assertEqual(inst.appointmentType.coding[0].code, "wi") - self.assertEqual(inst.appointmentType.coding[0].display, "Walk in") - self.assertEqual(inst.appointmentType.coding[0].system, "http://example.org/appointment-type") + self.assertEqual(inst.appointmentType.coding[0].code, "FOLLOWUP") + self.assertEqual(inst.appointmentType.coding[0].display, "A follow up visit from a previous appointment") + self.assertEqual(inst.appointmentType.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0276") self.assertEqual(inst.comment, "Further expand on the results of the MRI and determine the next actions that may be appropriate.") - self.assertEqual(inst.created.date, FHIRDate("2015-12-02").date) - self.assertEqual(inst.created.as_json(), "2015-12-02") + self.assertEqual(inst.created.date, FHIRDate("2013-10-10").date) + self.assertEqual(inst.created.as_json(), "2013-10-10") self.assertEqual(inst.description, "Discussion on the results of your recent MRI") - self.assertEqual(inst.id, "examplereq") - self.assertEqual(inst.identifier[0].system, "http://example.org/sampleappointment-identifier") - self.assertEqual(inst.identifier[0].value, "123") - self.assertEqual(inst.minutesDuration, 15) + self.assertEqual(inst.end.date, FHIRDate("2013-12-10T11:00:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-10T11:00:00Z") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.participant[0].required, "required") - self.assertEqual(inst.participant[0].status, "needs-action") + self.assertEqual(inst.participant[0].status, "accepted") self.assertEqual(inst.participant[1].required, "required") - self.assertEqual(inst.participant[1].status, "needs-action") + self.assertEqual(inst.participant[1].status, "accepted") self.assertEqual(inst.participant[1].type[0].coding[0].code, "ATND") - self.assertEqual(inst.participant[1].type[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.participant[1].type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.participant[2].required, "required") self.assertEqual(inst.participant[2].status, "accepted") self.assertEqual(inst.priority, 5) - self.assertEqual(inst.reason[0].coding[0].code, "413095006") - self.assertEqual(inst.reason[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].text, "Clinical Review") - self.assertEqual(inst.requestedPeriod[0].end.date, FHIRDate("2016-06-09").date) - self.assertEqual(inst.requestedPeriod[0].end.as_json(), "2016-06-09") - self.assertEqual(inst.requestedPeriod[0].start.date, FHIRDate("2016-06-02").date) - self.assertEqual(inst.requestedPeriod[0].start.as_json(), "2016-06-02") - self.assertEqual(inst.serviceCategory.coding[0].code, "gp") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") - self.assertEqual(inst.serviceCategory.coding[0].system, "http://example.org/service-category") - self.assertEqual(inst.specialty[0].coding[0].code, "gp") - self.assertEqual(inst.specialty[0].coding[0].display, "General Practice") - self.assertEqual(inst.specialty[0].coding[0].system, "http://example.org/specialty") - self.assertEqual(inst.status, "proposed") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "gp") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") + self.assertEqual(inst.serviceCategory[0].coding[0].system, "http://example.org/service-category") + self.assertEqual(inst.serviceType[0].coding[0].code, "52") + self.assertEqual(inst.serviceType[0].coding[0].display, "General Discussion") + self.assertEqual(inst.specialty[0].coding[0].code, "394814009") + self.assertEqual(inst.specialty[0].coding[0].display, "General practice") + self.assertEqual(inst.specialty[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.start.date, FHIRDate("2013-12-10T09:00:00Z").date) + self.assertEqual(inst.start.as_json(), "2013-12-10T09:00:00Z") + self.assertEqual(inst.status, "booked") self.assertEqual(inst.text.div, "
Brian MRI results discussion
") self.assertEqual(inst.text.status, "generated") def testAppointment2(self): - inst = self.instantiate_from("appointment-example.json") + inst = self.instantiate_from("appointment-example-request.json") self.assertIsNotNone(inst, "Must have instantiated a Appointment instance") self.implAppointment2(inst) @@ -80,36 +79,43 @@ def testAppointment2(self): self.implAppointment2(inst2) def implAppointment2(self, inst): - self.assertEqual(inst.appointmentType.coding[0].code, "follow") - self.assertEqual(inst.appointmentType.coding[0].display, "Followup") - self.assertEqual(inst.appointmentType.coding[0].system, "http://example.org/appointment-type") + self.assertEqual(inst.appointmentType.coding[0].code, "WALKIN") + self.assertEqual(inst.appointmentType.coding[0].display, "A previously unscheduled walk-in visit") + self.assertEqual(inst.appointmentType.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0276") self.assertEqual(inst.comment, "Further expand on the results of the MRI and determine the next actions that may be appropriate.") - self.assertEqual(inst.created.date, FHIRDate("2013-10-10").date) - self.assertEqual(inst.created.as_json(), "2013-10-10") + self.assertEqual(inst.created.date, FHIRDate("2015-12-02").date) + self.assertEqual(inst.created.as_json(), "2015-12-02") self.assertEqual(inst.description, "Discussion on the results of your recent MRI") - self.assertEqual(inst.end.date, FHIRDate("2013-12-10T11:00:00Z").date) - self.assertEqual(inst.end.as_json(), "2013-12-10T11:00:00Z") - self.assertEqual(inst.id, "example") + self.assertEqual(inst.id, "examplereq") + self.assertEqual(inst.identifier[0].system, "http://example.org/sampleappointment-identifier") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.minutesDuration, 15) self.assertEqual(inst.participant[0].required, "required") - self.assertEqual(inst.participant[0].status, "accepted") + self.assertEqual(inst.participant[0].status, "needs-action") self.assertEqual(inst.participant[1].required, "required") - self.assertEqual(inst.participant[1].status, "accepted") + self.assertEqual(inst.participant[1].status, "needs-action") self.assertEqual(inst.participant[1].type[0].coding[0].code, "ATND") - self.assertEqual(inst.participant[1].type[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.participant[1].type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.participant[2].required, "required") self.assertEqual(inst.participant[2].status, "accepted") self.assertEqual(inst.priority, 5) - self.assertEqual(inst.serviceCategory.coding[0].code, "gp") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") - self.assertEqual(inst.serviceCategory.coding[0].system, "http://example.org/service-category") - self.assertEqual(inst.serviceType[0].coding[0].code, "52") - self.assertEqual(inst.serviceType[0].coding[0].display, "General Discussion") - self.assertEqual(inst.specialty[0].coding[0].code, "gp") - self.assertEqual(inst.specialty[0].coding[0].display, "General Practice") - self.assertEqual(inst.specialty[0].coding[0].system, "http://example.org/specialty") - self.assertEqual(inst.start.date, FHIRDate("2013-12-10T09:00:00Z").date) - self.assertEqual(inst.start.as_json(), "2013-12-10T09:00:00Z") - self.assertEqual(inst.status, "booked") + self.assertEqual(inst.reasonCode[0].coding[0].code, "413095006") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reasonCode[0].text, "Clinical Review") + self.assertEqual(inst.requestedPeriod[0].end.date, FHIRDate("2016-06-09").date) + self.assertEqual(inst.requestedPeriod[0].end.as_json(), "2016-06-09") + self.assertEqual(inst.requestedPeriod[0].start.date, FHIRDate("2016-06-02").date) + self.assertEqual(inst.requestedPeriod[0].start.as_json(), "2016-06-02") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "gp") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") + self.assertEqual(inst.serviceCategory[0].coding[0].system, "http://example.org/service-category") + self.assertEqual(inst.specialty[0].coding[0].code, "394814009") + self.assertEqual(inst.specialty[0].coding[0].display, "General practice") + self.assertEqual(inst.specialty[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "proposed") self.assertEqual(inst.text.div, "
Brian MRI results discussion
") self.assertEqual(inst.text.status, "generated") @@ -124,14 +130,17 @@ def testAppointment3(self): self.implAppointment3(inst2) def implAppointment3(self, inst): - self.assertEqual(inst.appointmentType.coding[0].code, "wi") - self.assertEqual(inst.appointmentType.coding[0].display, "Walk in") - self.assertEqual(inst.appointmentType.coding[0].system, "http://example.org/appointment-type") + self.assertEqual(inst.appointmentType.coding[0].code, "WALKIN") + self.assertEqual(inst.appointmentType.coding[0].display, "A previously unscheduled walk-in visit") + self.assertEqual(inst.appointmentType.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0276") self.assertEqual(inst.comment, "Clarify the results of the MRI to ensure context of test was correct") self.assertEqual(inst.description, "Discussion about Peter Chalmers MRI results") self.assertEqual(inst.end.date, FHIRDate("2013-12-09T11:00:00Z").date) self.assertEqual(inst.end.as_json(), "2013-12-09T11:00:00Z") self.assertEqual(inst.id, "2docs") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.participant[0].required, "information-only") self.assertEqual(inst.participant[0].status, "accepted") self.assertEqual(inst.participant[1].required, "required") @@ -141,14 +150,14 @@ def implAppointment3(self, inst): self.assertEqual(inst.participant[3].required, "information-only") self.assertEqual(inst.participant[3].status, "accepted") self.assertEqual(inst.priority, 5) - self.assertEqual(inst.serviceCategory.coding[0].code, "gp") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") - self.assertEqual(inst.serviceCategory.coding[0].system, "http://example.org/service-category") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "gp") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") + self.assertEqual(inst.serviceCategory[0].coding[0].system, "http://example.org/service-category") self.assertEqual(inst.serviceType[0].coding[0].code, "52") self.assertEqual(inst.serviceType[0].coding[0].display, "General Discussion") - self.assertEqual(inst.specialty[0].coding[0].code, "gp") - self.assertEqual(inst.specialty[0].coding[0].display, "General Practice") - self.assertEqual(inst.specialty[0].coding[0].system, "http://example.org/specialty") + self.assertEqual(inst.specialty[0].coding[0].code, "394814009") + self.assertEqual(inst.specialty[0].coding[0].display, "General practice") + self.assertEqual(inst.specialty[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.start.date, FHIRDate("2013-12-09T09:00:00Z").date) self.assertEqual(inst.start.as_json(), "2013-12-09T09:00:00Z") self.assertEqual(inst.status, "booked") diff --git a/fhirclient/models/appointmentresponse.py b/fhirclient/models/appointmentresponse.py index 3a9d36fc4..332d26c48 100644 --- a/fhirclient/models/appointmentresponse.py +++ b/fhirclient/models/appointmentresponse.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -23,12 +23,12 @@ def __init__(self, jsondict=None, strict=True): """ self.actor = None - """ Person, Location/HealthcareService or Device. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + """ Person, Location, HealthcareService, or Device. + Type `FHIRReference` (represented as `dict` in JSON). """ self.appointment = None """ Appointment this response relates to. - Type `FHIRReference` referencing `Appointment` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.comment = None """ Additional comments. diff --git a/fhirclient/models/appointmentresponse_tests.py b/fhirclient/models/appointmentresponse_tests.py index 72bbf6684..63e4eb807 100644 --- a/fhirclient/models/appointmentresponse_tests.py +++ b/fhirclient/models/appointmentresponse_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -38,9 +38,12 @@ def implAppointmentResponse1(self, inst): self.assertEqual(inst.id, "exampleresp") self.assertEqual(inst.identifier[0].system, "http://example.org/sampleappointmentresponse-identifier") self.assertEqual(inst.identifier[0].value, "response123") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.participantStatus, "tentative") self.assertEqual(inst.participantType[0].coding[0].code, "ATND") - self.assertEqual(inst.participantType[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.participantType[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.start.date, FHIRDate("2013-12-25T13:15:00Z").date) self.assertEqual(inst.start.as_json(), "2013-12-25T13:15:00Z") self.assertEqual(inst.text.div, "
Accept Brian MRI results discussion
") @@ -58,6 +61,9 @@ def testAppointmentResponse2(self): def implAppointmentResponse2(self, inst): self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.participantStatus, "accepted") self.assertEqual(inst.text.div, "
Accept Brian MRI results discussion
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/attachment.py b/fhirclient/models/attachment.py index f013f04fb..d58385a16 100644 --- a/fhirclient/models/attachment.py +++ b/fhirclient/models/attachment.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Attachment) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/auditevent.py b/fhirclient/models/auditevent.py index 1c26ac3c0..690d61e66 100644 --- a/fhirclient/models/auditevent.py +++ b/fhirclient/models/auditevent.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -45,12 +45,16 @@ def __init__(self, jsondict=None, strict=True): """ Description of the event outcome. Type `str`. """ + self.period = None + """ When the activity occurred. + Type `Period` (represented as `dict` in JSON). """ + self.purposeOfEvent = None """ The purposeOfUse of the event. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.recorded = None - """ Time when the event occurred on source. + """ Time when the event was recorded. Type `FHIRDate` (represented as `str` in JSON). """ self.source = None @@ -75,6 +79,7 @@ def elementProperties(self): ("entity", "entity", AuditEventEntity, True, None, False), ("outcome", "outcome", str, False, None, False), ("outcomeDesc", "outcomeDesc", str, False, None, False), + ("period", "period", period.Period, False, None, False), ("purposeOfEvent", "purposeOfEvent", codeableconcept.CodeableConcept, True, None, False), ("recorded", "recorded", fhirdate.FHIRDate, False, None, True), ("source", "source", AuditEventSource, False, None, True), @@ -103,19 +108,19 @@ def __init__(self, jsondict=None, strict=True): """ self.altId = None - """ Alternative User id e.g. authentication. + """ Alternative User identity. Type `str`. """ self.location = None """ Where. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.media = None """ Type of media. Type `Coding` (represented as `dict` in JSON). """ self.name = None - """ Human-meaningful name for the agent. + """ Human friendly name for the agent. Type `str`. """ self.network = None @@ -130,10 +135,6 @@ def __init__(self, jsondict=None, strict=True): """ Reason given for this user. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.reference = None - """ Direct reference to resource. - Type `FHIRReference` referencing `Practitioner, Organization, Device, Patient, RelatedPerson` (represented as `dict` in JSON). """ - self.requestor = None """ Whether user is initiator. Type `bool`. """ @@ -142,9 +143,13 @@ def __init__(self, jsondict=None, strict=True): """ Agent role in the event. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.userId = None - """ Unique identifier for the user. - Type `Identifier` (represented as `dict` in JSON). """ + self.type = None + """ How agent participated. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.who = None + """ Identifier of who. + Type `FHIRReference` (represented as `dict` in JSON). """ super(AuditEventAgent, self).__init__(jsondict=jsondict, strict=strict) @@ -158,10 +163,10 @@ def elementProperties(self): ("network", "network", AuditEventAgentNetwork, False, None, False), ("policy", "policy", str, True, None, False), ("purposeOfUse", "purposeOfUse", codeableconcept.CodeableConcept, True, None, False), - ("reference", "reference", fhirreference.FHIRReference, False, None, False), ("requestor", "requestor", bool, False, None, True), ("role", "role", codeableconcept.CodeableConcept, True, None, False), - ("userId", "userId", identifier.Identifier, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("who", "who", fhirreference.FHIRReference, False, None, False), ]) return js @@ -226,10 +231,6 @@ def __init__(self, jsondict=None, strict=True): """ Additional Information about the entity. List of `AuditEventEntityDetail` items (represented as `dict` in JSON). """ - self.identifier = None - """ Specific instance of object. - Type `Identifier` (represented as `dict` in JSON). """ - self.lifecycle = None """ Life-cycle stage for the entity. Type `Coding` (represented as `dict` in JSON). """ @@ -242,10 +243,6 @@ def __init__(self, jsondict=None, strict=True): """ Query parameters. Type `str`. """ - self.reference = None - """ Specific instance of resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - self.role = None """ What role the entity played. Type `Coding` (represented as `dict` in JSON). """ @@ -258,6 +255,10 @@ def __init__(self, jsondict=None, strict=True): """ Type of entity involved. Type `Coding` (represented as `dict` in JSON). """ + self.what = None + """ Specific instance of resource. + Type `FHIRReference` (represented as `dict` in JSON). """ + super(AuditEventEntity, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -265,14 +266,13 @@ def elementProperties(self): js.extend([ ("description", "description", str, False, None, False), ("detail", "detail", AuditEventEntityDetail, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), ("lifecycle", "lifecycle", coding.Coding, False, None, False), ("name", "name", str, False, None, False), ("query", "query", str, False, None, False), - ("reference", "reference", fhirreference.FHIRReference, False, None, False), ("role", "role", coding.Coding, False, None, False), ("securityLabel", "securityLabel", coding.Coding, True, None, False), ("type", "type", coding.Coding, False, None, False), + ("what", "what", fhirreference.FHIRReference, False, None, False), ]) return js @@ -297,7 +297,11 @@ def __init__(self, jsondict=None, strict=True): """ Name of the property. Type `str`. """ - self.value = None + self.valueBase64Binary = None + """ Property value. + Type `str`. """ + + self.valueString = None """ Property value. Type `str`. """ @@ -307,7 +311,8 @@ def elementProperties(self): js = super(AuditEventEntityDetail, self).elementProperties() js.extend([ ("type", "type", str, False, None, True), - ("value", "value", str, False, None, True), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), + ("valueString", "valueString", str, False, "value", True), ]) return js @@ -328,9 +333,9 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.identifier = None + self.observer = None """ The identity of source detecting the event. - Type `Identifier` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.site = None """ Logical source location within the enterprise. @@ -345,7 +350,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(AuditEventSource, self).elementProperties() js.extend([ - ("identifier", "identifier", identifier.Identifier, False, None, True), + ("observer", "observer", fhirreference.FHIRReference, False, None, True), ("site", "site", str, False, None, False), ("type", "type", coding.Coding, True, None, False), ]) @@ -370,6 +375,6 @@ def elementProperties(self): except ImportError: fhirreference = sys.modules[__package__ + '.fhirreference'] try: - from . import identifier + from . import period except ImportError: - identifier = sys.modules[__package__ + '.identifier'] + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/auditevent_tests.py b/fhirclient/models/auditevent_tests.py index 6a55e11b3..e5f9f1a97 100644 --- a/fhirclient/models/auditevent_tests.py +++ b/fhirclient/models/auditevent_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return auditevent.AuditEvent(js) def testAuditEvent1(self): - inst = self.instantiate_from("audit-event-example-login.json") + inst = self.instantiate_from("audit-event-example-search.json") self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") self.implAuditEvent1(inst) @@ -35,34 +35,42 @@ def implAuditEvent1(self, inst): self.assertEqual(inst.action, "E") self.assertEqual(inst.agent[0].altId, "601847123") self.assertEqual(inst.agent[0].name, "Grahame Grieve") - self.assertEqual(inst.agent[0].network.address, "127.0.0.1") - self.assertEqual(inst.agent[0].network.type, "2") self.assertTrue(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].userId.value, "95") + self.assertEqual(inst.agent[0].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[0].type.coding[0].display, "human user") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") self.assertEqual(inst.agent[1].altId, "6580") self.assertEqual(inst.agent[1].network.address, "Workstation1.ehr.familyclinic.com") self.assertEqual(inst.agent[1].network.type, "1") self.assertFalse(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[1].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[1].userId.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") - self.assertEqual(inst.id, "example-login") + self.assertEqual(inst.agent[1].type.coding[0].code, "110153") + self.assertEqual(inst.agent[1].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.entity[0].query, "aHR0cDovL2ZoaXItZGV2LmhlYWx0aGludGVyc2VjdGlvbnMuY29tLmF1L29wZW4vRW5jb3VudGVyP3BhcnRpY2lwYW50PTEz") + self.assertEqual(inst.entity[0].role.code, "24") + self.assertEqual(inst.entity[0].role.display, "Query") + self.assertEqual(inst.entity[0].role.system, "http://terminology.hl7.org/CodeSystem/object-role") + self.assertEqual(inst.entity[0].type.code, "2") + self.assertEqual(inst.entity[0].type.display, "System Object") + self.assertEqual(inst.entity[0].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") + self.assertEqual(inst.id, "example-search") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.outcome, "0") - self.assertEqual(inst.recorded.date, FHIRDate("2013-06-20T23:41:23Z").date) - self.assertEqual(inst.recorded.as_json(), "2013-06-20T23:41:23Z") - self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") + self.assertEqual(inst.recorded.date, FHIRDate("2015-08-22T23:42:24Z").date) + self.assertEqual(inst.recorded.as_json(), "2015-08-22T23:42:24Z") self.assertEqual(inst.source.site, "Cloud") self.assertEqual(inst.source.type[0].code, "3") self.assertEqual(inst.source.type[0].display, "Web Server") - self.assertEqual(inst.source.type[0].system, "http://hl7.org/fhir/security-source-type") - self.assertEqual(inst.subtype[0].code, "110122") - self.assertEqual(inst.subtype[0].display, "Login") - self.assertEqual(inst.subtype[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.source.type[0].system, "http://terminology.hl7.org/CodeSystem/security-source-type") + self.assertEqual(inst.subtype[0].code, "search") + self.assertEqual(inst.subtype[0].display, "search") + self.assertEqual(inst.subtype[0].system, "http://hl7.org/fhir/restful-interaction") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.code, "110114") - self.assertEqual(inst.type.display, "User Authentication") - self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.type.code, "rest") + self.assertEqual(inst.type.display, "Restful Operation") + self.assertEqual(inst.type.system, "http://terminology.hl7.org/CodeSystem/audit-event-type") def testAuditEvent2(self): inst = self.instantiate_from("audit-event-example-logout.json") @@ -81,24 +89,27 @@ def implAuditEvent2(self, inst): self.assertEqual(inst.agent[0].network.address, "127.0.0.1") self.assertEqual(inst.agent[0].network.type, "2") self.assertTrue(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].userId.value, "95") + self.assertEqual(inst.agent[0].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[0].type.coding[0].display, "human user") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") self.assertEqual(inst.agent[1].altId, "6580") self.assertEqual(inst.agent[1].network.address, "Workstation1.ehr.familyclinic.com") self.assertEqual(inst.agent[1].network.type, "1") self.assertFalse(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[1].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[1].userId.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") + self.assertEqual(inst.agent[1].type.coding[0].code, "110153") + self.assertEqual(inst.agent[1].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.id, "example-logout") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.outcome, "0") self.assertEqual(inst.recorded.date, FHIRDate("2013-06-20T23:46:41Z").date) self.assertEqual(inst.recorded.as_json(), "2013-06-20T23:46:41Z") - self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") self.assertEqual(inst.source.site, "Cloud") self.assertEqual(inst.source.type[0].code, "3") self.assertEqual(inst.source.type[0].display, "Web Server") - self.assertEqual(inst.source.type[0].system, "http://hl7.org/fhir/security-source-type") + self.assertEqual(inst.source.type[0].system, "http://terminology.hl7.org/CodeSystem/security-source-type") self.assertEqual(inst.subtype[0].code, "110123") self.assertEqual(inst.subtype[0].display, "Logout") self.assertEqual(inst.subtype[0].system, "http://dicom.nema.org/resources/ontology/DCM") @@ -108,7 +119,7 @@ def implAuditEvent2(self, inst): self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") def testAuditEvent3(self): - inst = self.instantiate_from("audit-event-example-media.json") + inst = self.instantiate_from("audit-event-example-vread.json") self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") self.implAuditEvent3(inst) @@ -118,46 +129,97 @@ def testAuditEvent3(self): self.implAuditEvent3(inst2) def implAuditEvent3(self, inst): + self.assertEqual(inst.action, "R") + self.assertEqual(inst.agent[0].altId, "601847123") + self.assertEqual(inst.agent[0].name, "Grahame Grieve") + self.assertTrue(inst.agent[0].requestor) + self.assertEqual(inst.agent[0].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[0].type.coding[0].display, "human user") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") + self.assertEqual(inst.agent[1].altId, "6580") + self.assertEqual(inst.agent[1].network.address, "Workstation1.ehr.familyclinic.com") + self.assertEqual(inst.agent[1].network.type, "1") + self.assertFalse(inst.agent[1].requestor) + self.assertEqual(inst.agent[1].type.coding[0].code, "110153") + self.assertEqual(inst.agent[1].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.entity[0].lifecycle.code, "6") + self.assertEqual(inst.entity[0].lifecycle.display, "Access / Use") + self.assertEqual(inst.entity[0].lifecycle.system, "http://terminology.hl7.org/CodeSystem/dicom-audit-lifecycle") + self.assertEqual(inst.entity[0].type.code, "2") + self.assertEqual(inst.entity[0].type.display, "System Object") + self.assertEqual(inst.entity[0].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") + self.assertEqual(inst.id, "example-rest") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "0") + self.assertEqual(inst.recorded.date, FHIRDate("2013-06-20T23:42:24Z").date) + self.assertEqual(inst.recorded.as_json(), "2013-06-20T23:42:24Z") + self.assertEqual(inst.source.site, "Cloud") + self.assertEqual(inst.source.type[0].code, "3") + self.assertEqual(inst.source.type[0].display, "Web Server") + self.assertEqual(inst.source.type[0].system, "http://terminology.hl7.org/CodeSystem/security-source-type") + self.assertEqual(inst.subtype[0].code, "vread") + self.assertEqual(inst.subtype[0].display, "vread") + self.assertEqual(inst.subtype[0].system, "http://hl7.org/fhir/restful-interaction") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "rest") + self.assertEqual(inst.type.display, "Restful Operation") + self.assertEqual(inst.type.system, "http://terminology.hl7.org/CodeSystem/audit-event-type") + + def testAuditEvent4(self): + inst = self.instantiate_from("audit-event-example-media.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent4(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent4(inst2) + + def implAuditEvent4(self, inst): self.assertEqual(inst.action, "R") self.assertFalse(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[0].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[0].userId.value, "ExportToMedia.app") + self.assertEqual(inst.agent[0].type.coding[0].code, "110153") + self.assertEqual(inst.agent[0].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.agent[1].altId, "601847123") self.assertEqual(inst.agent[1].name, "Grahame Grieve") self.assertTrue(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].userId.value, "95") + self.assertEqual(inst.agent[1].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[1].type.coding[0].display, "human user") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") self.assertEqual(inst.agent[2].media.code, "110033") self.assertEqual(inst.agent[2].media.display, "DVD") self.assertEqual(inst.agent[2].media.system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.agent[2].name, "Media title: Hello World") self.assertFalse(inst.agent[2].requestor) - self.assertEqual(inst.entity[0].identifier.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + self.assertEqual(inst.agent[2].type.coding[0].code, "110154") + self.assertEqual(inst.agent[2].type.coding[0].display, "Destination Media") + self.assertEqual(inst.agent[2].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.entity[0].role.code, "1") self.assertEqual(inst.entity[0].role.display, "Patient") - self.assertEqual(inst.entity[0].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.entity[0].role.system, "http://terminology.hl7.org/CodeSystem/object-role") self.assertEqual(inst.entity[0].type.code, "1") self.assertEqual(inst.entity[0].type.display, "Person") - self.assertEqual(inst.entity[0].type.system, "http://hl7.org/fhir/object-type") - self.assertEqual(inst.entity[1].identifier.type.coding[0].code, "IHE XDS Metadata") - self.assertEqual(inst.entity[1].identifier.type.coding[0].display, "submission set classificationNode") - self.assertEqual(inst.entity[1].identifier.type.coding[0].system, "urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd") - self.assertEqual(inst.entity[1].identifier.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + self.assertEqual(inst.entity[0].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") self.assertEqual(inst.entity[1].role.code, "20") self.assertEqual(inst.entity[1].role.display, "Job") - self.assertEqual(inst.entity[1].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.entity[1].role.system, "http://terminology.hl7.org/CodeSystem/object-role") self.assertEqual(inst.entity[1].type.code, "2") self.assertEqual(inst.entity[1].type.display, "System Object") - self.assertEqual(inst.entity[1].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.entity[1].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") self.assertEqual(inst.entity[2].type.code, "2") self.assertEqual(inst.entity[2].type.display, "System Object") - self.assertEqual(inst.entity[2].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.entity[2].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") self.assertEqual(inst.id, "example-media") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.outcome, "0") self.assertEqual(inst.recorded.date, FHIRDate("2015-08-27T23:42:24Z").date) self.assertEqual(inst.recorded.as_json(), "2015-08-27T23:42:24Z") - self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") self.assertEqual(inst.subtype[0].code, "ITI-32") self.assertEqual(inst.subtype[0].display, "Distribute Document Set on Media") self.assertEqual(inst.subtype[0].system, "urn:oid:1.3.6.1.4.1.19376.1.2") @@ -166,50 +228,98 @@ def implAuditEvent3(self, inst): self.assertEqual(inst.type.display, "Export") self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - def testAuditEvent4(self): + def testAuditEvent5(self): + inst = self.instantiate_from("audit-event-example-login.json") + self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") + self.implAuditEvent5(inst) + + js = inst.as_json() + self.assertEqual("AuditEvent", js["resourceType"]) + inst2 = auditevent.AuditEvent(js) + self.implAuditEvent5(inst2) + + def implAuditEvent5(self, inst): + self.assertEqual(inst.action, "E") + self.assertEqual(inst.agent[0].altId, "601847123") + self.assertEqual(inst.agent[0].name, "Grahame Grieve") + self.assertEqual(inst.agent[0].network.address, "127.0.0.1") + self.assertEqual(inst.agent[0].network.type, "2") + self.assertTrue(inst.agent[0].requestor) + self.assertEqual(inst.agent[0].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[0].type.coding[0].display, "human user") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") + self.assertEqual(inst.agent[1].altId, "6580") + self.assertEqual(inst.agent[1].network.address, "Workstation1.ehr.familyclinic.com") + self.assertEqual(inst.agent[1].network.type, "1") + self.assertFalse(inst.agent[1].requestor) + self.assertEqual(inst.agent[1].type.coding[0].code, "110153") + self.assertEqual(inst.agent[1].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.id, "example-login") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "0") + self.assertEqual(inst.recorded.date, FHIRDate("2013-06-20T23:41:23Z").date) + self.assertEqual(inst.recorded.as_json(), "2013-06-20T23:41:23Z") + self.assertEqual(inst.source.site, "Cloud") + self.assertEqual(inst.source.type[0].code, "3") + self.assertEqual(inst.source.type[0].display, "Web Server") + self.assertEqual(inst.source.type[0].system, "http://terminology.hl7.org/CodeSystem/security-source-type") + self.assertEqual(inst.subtype[0].code, "110122") + self.assertEqual(inst.subtype[0].display, "Login") + self.assertEqual(inst.subtype[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.code, "110114") + self.assertEqual(inst.type.display, "User Authentication") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + + def testAuditEvent6(self): inst = self.instantiate_from("audit-event-example-pixQuery.json") self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent4(inst) + self.implAuditEvent6(inst) js = inst.as_json() self.assertEqual("AuditEvent", js["resourceType"]) inst2 = auditevent.AuditEvent(js) - self.implAuditEvent4(inst2) + self.implAuditEvent6(inst2) - def implAuditEvent4(self, inst): + def implAuditEvent6(self, inst): self.assertEqual(inst.action, "E") self.assertEqual(inst.agent[0].altId, "6580") self.assertEqual(inst.agent[0].network.address, "Workstation1.ehr.familyclinic.com") self.assertEqual(inst.agent[0].network.type, "1") self.assertFalse(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[0].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[0].userId.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") + self.assertEqual(inst.agent[0].type.coding[0].code, "110153") + self.assertEqual(inst.agent[0].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.agent[1].altId, "601847123") self.assertEqual(inst.agent[1].name, "Grahame Grieve") self.assertTrue(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].userId.value, "95") - self.assertEqual(inst.entity[0].identifier.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + self.assertEqual(inst.agent[1].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[1].type.coding[0].display, "human user") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") self.assertEqual(inst.entity[0].role.code, "1") self.assertEqual(inst.entity[0].role.display, "Patient") - self.assertEqual(inst.entity[0].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.entity[0].role.system, "http://terminology.hl7.org/CodeSystem/object-role") self.assertEqual(inst.entity[0].type.code, "1") self.assertEqual(inst.entity[0].type.display, "Person") - self.assertEqual(inst.entity[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.entity[0].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") self.assertEqual(inst.entity[1].detail[0].type, "MSH-10") - self.assertEqual(inst.entity[1].detail[0].value, "MS4yLjg0MC4xMTQzNTAuMS4xMy4wLjEuNy4xLjE=") + self.assertEqual(inst.entity[1].detail[0].valueBase64Binary, "MS4yLjg0MC4xMTQzNTAuMS4xMy4wLjEuNy4xLjE=") self.assertEqual(inst.entity[1].role.code, "24") self.assertEqual(inst.entity[1].role.display, "Query") - self.assertEqual(inst.entity[1].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.entity[1].role.system, "http://terminology.hl7.org/CodeSystem/object-role") self.assertEqual(inst.entity[1].type.code, "2") self.assertEqual(inst.entity[1].type.display, "System Object") - self.assertEqual(inst.entity[1].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.entity[1].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") self.assertEqual(inst.id, "example-pixQuery") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.outcome, "0") self.assertEqual(inst.recorded.date, FHIRDate("2015-08-26T23:42:24Z").date) self.assertEqual(inst.recorded.as_json(), "2015-08-26T23:42:24Z") - self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") self.assertEqual(inst.subtype[0].code, "ITI-9") self.assertEqual(inst.subtype[0].display, "PIX Query") self.assertEqual(inst.subtype[0].system, "urn:oid:1.3.6.1.4.1.19376.1.2") @@ -218,112 +328,73 @@ def implAuditEvent4(self, inst): self.assertEqual(inst.type.display, "Query") self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - def testAuditEvent5(self): - inst = self.instantiate_from("audit-event-example-search.json") + def testAuditEvent7(self): + inst = self.instantiate_from("auditevent-example.json") self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent5(inst) + self.implAuditEvent7(inst) js = inst.as_json() self.assertEqual("AuditEvent", js["resourceType"]) inst2 = auditevent.AuditEvent(js) - self.implAuditEvent5(inst2) + self.implAuditEvent7(inst2) - def implAuditEvent5(self, inst): + def implAuditEvent7(self, inst): self.assertEqual(inst.action, "E") - self.assertEqual(inst.agent[0].altId, "601847123") - self.assertEqual(inst.agent[0].name, "Grahame Grieve") - self.assertTrue(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].userId.value, "95") - self.assertEqual(inst.agent[1].altId, "6580") - self.assertEqual(inst.agent[1].network.address, "Workstation1.ehr.familyclinic.com") - self.assertEqual(inst.agent[1].network.type, "1") - self.assertFalse(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[1].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[1].userId.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") - self.assertEqual(inst.entity[0].query, "aHR0cDovL2ZoaXItZGV2LmhlYWx0aGludGVyc2VjdGlvbnMuY29tLmF1L29wZW4vRW5jb3VudGVyP3BhcnRpY2lwYW50PTEz") - self.assertEqual(inst.entity[0].role.code, "24") - self.assertEqual(inst.entity[0].role.display, "Query") - self.assertEqual(inst.entity[0].role.system, "http://hl7.org/fhir/object-role") - self.assertEqual(inst.entity[0].type.code, "2") - self.assertEqual(inst.entity[0].type.display, "System Object") - self.assertEqual(inst.entity[0].type.system, "http://hl7.org/fhir/object-type") - self.assertEqual(inst.id, "example-search") - self.assertEqual(inst.outcome, "0") - self.assertEqual(inst.recorded.date, FHIRDate("2015-08-22T23:42:24Z").date) - self.assertEqual(inst.recorded.as_json(), "2015-08-22T23:42:24Z") - self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") - self.assertEqual(inst.source.site, "Cloud") - self.assertEqual(inst.source.type[0].code, "3") - self.assertEqual(inst.source.type[0].display, "Web Server") - self.assertEqual(inst.source.type[0].system, "http://hl7.org/fhir/security-source-type") - self.assertEqual(inst.subtype[0].code, "search") - self.assertEqual(inst.subtype[0].display, "search") - self.assertEqual(inst.subtype[0].system, "http://hl7.org/fhir/restful-interaction") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.code, "rest") - self.assertEqual(inst.type.display, "Restful Operation") - self.assertEqual(inst.type.system, "http://hl7.org/fhir/audit-event-type") - - def testAuditEvent6(self): - inst = self.instantiate_from("audit-event-example-vread.json") - self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent6(inst) - - js = inst.as_json() - self.assertEqual("AuditEvent", js["resourceType"]) - inst2 = auditevent.AuditEvent(js) - self.implAuditEvent6(inst2) - - def implAuditEvent6(self, inst): - self.assertEqual(inst.action, "R") - self.assertEqual(inst.agent[0].altId, "601847123") - self.assertEqual(inst.agent[0].name, "Grahame Grieve") - self.assertTrue(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].userId.value, "95") + self.assertEqual(inst.agent[0].network.address, "127.0.0.1") + self.assertEqual(inst.agent[0].network.type, "2") + self.assertFalse(inst.agent[0].requestor) + self.assertEqual(inst.agent[0].role[0].text, "Service User (Logon)") + self.assertEqual(inst.agent[0].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[0].type.coding[0].display, "human user") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") self.assertEqual(inst.agent[1].altId, "6580") self.assertEqual(inst.agent[1].network.address, "Workstation1.ehr.familyclinic.com") self.assertEqual(inst.agent[1].network.type, "1") self.assertFalse(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[1].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[1].userId.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") + self.assertEqual(inst.agent[1].type.coding[0].code, "110153") + self.assertEqual(inst.agent[1].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.entity[0].lifecycle.code, "6") self.assertEqual(inst.entity[0].lifecycle.display, "Access / Use") - self.assertEqual(inst.entity[0].lifecycle.system, "http://hl7.org/fhir/dicom-audit-lifecycle") - self.assertEqual(inst.entity[0].type.code, "2") - self.assertEqual(inst.entity[0].type.display, "System Object") - self.assertEqual(inst.entity[0].type.system, "http://hl7.org/fhir/object-type") - self.assertEqual(inst.id, "example-rest") + self.assertEqual(inst.entity[0].lifecycle.system, "http://terminology.hl7.org/CodeSystem/dicom-audit-lifecycle") + self.assertEqual(inst.entity[0].name, "Grahame's Laptop") + self.assertEqual(inst.entity[0].role.code, "4") + self.assertEqual(inst.entity[0].role.display, "Domain Resource") + self.assertEqual(inst.entity[0].role.system, "http://terminology.hl7.org/CodeSystem/object-role") + self.assertEqual(inst.entity[0].type.code, "4") + self.assertEqual(inst.entity[0].type.display, "Other") + self.assertEqual(inst.entity[0].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.outcome, "0") - self.assertEqual(inst.recorded.date, FHIRDate("2013-06-20T23:42:24Z").date) - self.assertEqual(inst.recorded.as_json(), "2013-06-20T23:42:24Z") - self.assertEqual(inst.source.identifier.value, "hl7connect.healthintersections.com.au") - self.assertEqual(inst.source.site, "Cloud") - self.assertEqual(inst.source.type[0].code, "3") - self.assertEqual(inst.source.type[0].display, "Web Server") - self.assertEqual(inst.source.type[0].system, "http://hl7.org/fhir/security-source-type") - self.assertEqual(inst.subtype[0].code, "vread") - self.assertEqual(inst.subtype[0].display, "vread") - self.assertEqual(inst.subtype[0].system, "http://hl7.org/fhir/restful-interaction") + self.assertEqual(inst.recorded.date, FHIRDate("2012-10-25T22:04:27+11:00").date) + self.assertEqual(inst.recorded.as_json(), "2012-10-25T22:04:27+11:00") + self.assertEqual(inst.source.site, "Development") + self.assertEqual(inst.source.type[0].code, "110122") + self.assertEqual(inst.source.type[0].display, "Login") + self.assertEqual(inst.source.type[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.subtype[0].code, "110120") + self.assertEqual(inst.subtype[0].display, "Application Start") + self.assertEqual(inst.subtype[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.text.div, "
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.code, "rest") - self.assertEqual(inst.type.display, "Restful Operation") - self.assertEqual(inst.type.system, "http://hl7.org/fhir/audit-event-type") + self.assertEqual(inst.type.code, "110100") + self.assertEqual(inst.type.display, "Application Activity") + self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - def testAuditEvent7(self): + def testAuditEvent8(self): inst = self.instantiate_from("auditevent-example-disclosure.json") self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent7(inst) + self.implAuditEvent8(inst) js = inst.as_json() self.assertEqual("AuditEvent", js["resourceType"]) inst2 = auditevent.AuditEvent(js) - self.implAuditEvent7(inst2) + self.implAuditEvent8(inst2) - def implAuditEvent7(self, inst): + def implAuditEvent8(self, inst): self.assertEqual(inst.action, "R") self.assertEqual(inst.agent[0].altId, "notMe") self.assertEqual(inst.agent[0].name, "That guy everyone wishes would be caught") @@ -331,60 +402,59 @@ def implAuditEvent7(self, inst): self.assertEqual(inst.agent[0].network.type, "1") self.assertEqual(inst.agent[0].policy[0], "http://consent.com/yes") self.assertTrue(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[0].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[0].userId.value, "SomeIdiot@nowhere.com") + self.assertEqual(inst.agent[0].type.coding[0].code, "110153") + self.assertEqual(inst.agent[0].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.agent[1].network.address, "marketing.land") self.assertEqual(inst.agent[1].network.type, "1") self.assertEqual(inst.agent[1].purposeOfUse[0].coding[0].code, "HMARKT") self.assertEqual(inst.agent[1].purposeOfUse[0].coding[0].display, "healthcare marketing") - self.assertEqual(inst.agent[1].purposeOfUse[0].coding[0].system, "http://hl7.org/fhir/v3/ActReason") + self.assertEqual(inst.agent[1].purposeOfUse[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertFalse(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].role[0].coding[0].code, "110152") - self.assertEqual(inst.agent[1].role[0].coding[0].display, "Destination Role ID") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[1].userId.value, "Where") + self.assertEqual(inst.agent[1].type.coding[0].code, "110152") + self.assertEqual(inst.agent[1].type.coding[0].display, "Destination Role ID") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.entity[0].role.code, "1") self.assertEqual(inst.entity[0].role.display, "Patient") - self.assertEqual(inst.entity[0].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.entity[0].role.system, "http://terminology.hl7.org/CodeSystem/object-role") self.assertEqual(inst.entity[0].type.code, "1") self.assertEqual(inst.entity[0].type.display, "Person") - self.assertEqual(inst.entity[0].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.entity[0].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") self.assertEqual(inst.entity[1].description, "data about Everthing important") - self.assertEqual(inst.entity[1].identifier.value, "What.id") self.assertEqual(inst.entity[1].lifecycle.code, "11") self.assertEqual(inst.entity[1].lifecycle.display, "Disclosure") - self.assertEqual(inst.entity[1].lifecycle.system, "http://hl7.org/fhir/dicom-audit-lifecycle") + self.assertEqual(inst.entity[1].lifecycle.system, "http://terminology.hl7.org/CodeSystem/dicom-audit-lifecycle") self.assertEqual(inst.entity[1].name, "Namne of What") self.assertEqual(inst.entity[1].role.code, "4") self.assertEqual(inst.entity[1].role.display, "Domain Resource") - self.assertEqual(inst.entity[1].role.system, "http://hl7.org/fhir/object-role") + self.assertEqual(inst.entity[1].role.system, "http://terminology.hl7.org/CodeSystem/object-role") self.assertEqual(inst.entity[1].securityLabel[0].code, "V") self.assertEqual(inst.entity[1].securityLabel[0].display, "very restricted") - self.assertEqual(inst.entity[1].securityLabel[0].system, "http://hl7.org/fhir/v3/Confidentiality") + self.assertEqual(inst.entity[1].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-Confidentiality") self.assertEqual(inst.entity[1].securityLabel[1].code, "STD") self.assertEqual(inst.entity[1].securityLabel[1].display, "sexually transmitted disease information sensitivity") - self.assertEqual(inst.entity[1].securityLabel[1].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.entity[1].securityLabel[1].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.entity[1].securityLabel[2].code, "DELAU") self.assertEqual(inst.entity[1].securityLabel[2].display, "delete after use") - self.assertEqual(inst.entity[1].securityLabel[2].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.entity[1].securityLabel[2].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.entity[1].type.code, "2") self.assertEqual(inst.entity[1].type.display, "System Object") - self.assertEqual(inst.entity[1].type.system, "http://hl7.org/fhir/object-type") + self.assertEqual(inst.entity[1].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") self.assertEqual(inst.id, "example-disclosure") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.outcome, "0") self.assertEqual(inst.outcomeDesc, "Successful Disclosure") self.assertEqual(inst.purposeOfEvent[0].coding[0].code, "HMARKT") self.assertEqual(inst.purposeOfEvent[0].coding[0].display, "healthcare marketing") - self.assertEqual(inst.purposeOfEvent[0].coding[0].system, "http://hl7.org/fhir/v3/ActReason") + self.assertEqual(inst.purposeOfEvent[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.recorded.date, FHIRDate("2013-09-22T00:08:00Z").date) self.assertEqual(inst.recorded.as_json(), "2013-09-22T00:08:00Z") - self.assertEqual(inst.source.identifier.value, "Watchers Accounting of Disclosures Application") self.assertEqual(inst.source.site, "Watcher") self.assertEqual(inst.source.type[0].code, "4") self.assertEqual(inst.source.type[0].display, "Application Server") - self.assertEqual(inst.source.type[0].system, "http://hl7.org/fhir/security-source-type") + self.assertEqual(inst.source.type[0].system, "http://terminology.hl7.org/CodeSystem/security-source-type") self.assertEqual(inst.subtype[0].code, "Disclosure") self.assertEqual(inst.subtype[0].display, "HIPAA disclosure") self.assertEqual(inst.text.div, "
Disclosure by some idiot, for marketing reasons, to places unknown, of a Poor Sap, data about Everthing important.
") @@ -393,60 +463,58 @@ def implAuditEvent7(self, inst): self.assertEqual(inst.type.display, "Export") self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") - def testAuditEvent8(self): - inst = self.instantiate_from("auditevent-example.json") + def testAuditEvent9(self): + inst = self.instantiate_from("auditevent-example-error.json") self.assertIsNotNone(inst, "Must have instantiated a AuditEvent instance") - self.implAuditEvent8(inst) + self.implAuditEvent9(inst) js = inst.as_json() self.assertEqual("AuditEvent", js["resourceType"]) inst2 = auditevent.AuditEvent(js) - self.implAuditEvent8(inst2) + self.implAuditEvent9(inst2) - def implAuditEvent8(self, inst): - self.assertEqual(inst.action, "E") - self.assertEqual(inst.agent[0].network.address, "127.0.0.1") - self.assertEqual(inst.agent[0].network.type, "2") - self.assertFalse(inst.agent[0].requestor) - self.assertEqual(inst.agent[0].role[0].text, "Service User (Logon)") - self.assertEqual(inst.agent[0].userId.value, "Grahame") + def implAuditEvent9(self, inst): + self.assertEqual(inst.action, "C") + self.assertEqual(inst.agent[0].altId, "601847123") + self.assertEqual(inst.agent[0].name, "Grahame Grieve") + self.assertTrue(inst.agent[0].requestor) + self.assertEqual(inst.agent[0].type.coding[0].code, "humanuser") + self.assertEqual(inst.agent[0].type.coding[0].display, "human user") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/extra-security-role-type") self.assertEqual(inst.agent[1].altId, "6580") self.assertEqual(inst.agent[1].network.address, "Workstation1.ehr.familyclinic.com") self.assertEqual(inst.agent[1].network.type, "1") self.assertFalse(inst.agent[1].requestor) - self.assertEqual(inst.agent[1].role[0].coding[0].code, "110153") - self.assertEqual(inst.agent[1].role[0].coding[0].display, "Source Role ID") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.agent[1].userId.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") - self.assertEqual(inst.entity[0].identifier.type.coding[0].code, "SNO") - self.assertEqual(inst.entity[0].identifier.type.coding[0].system, "http://hl7.org/fhir/identifier-type") - self.assertEqual(inst.entity[0].identifier.type.text, "Dell Serial Number") - self.assertEqual(inst.entity[0].identifier.value, "ABCDEF") - self.assertEqual(inst.entity[0].lifecycle.code, "6") - self.assertEqual(inst.entity[0].lifecycle.display, "Access / Use") - self.assertEqual(inst.entity[0].lifecycle.system, "http://hl7.org/fhir/dicom-audit-lifecycle") - self.assertEqual(inst.entity[0].name, "Grahame's Laptop") - self.assertEqual(inst.entity[0].role.code, "4") - self.assertEqual(inst.entity[0].role.display, "Domain Resource") - self.assertEqual(inst.entity[0].role.system, "http://hl7.org/fhir/object-role") - self.assertEqual(inst.entity[0].type.code, "4") - self.assertEqual(inst.entity[0].type.display, "Other") - self.assertEqual(inst.entity[0].type.system, "http://hl7.org/fhir/object-type") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.outcome, "0") - self.assertEqual(inst.recorded.date, FHIRDate("2012-10-25T22:04:27+11:00").date) - self.assertEqual(inst.recorded.as_json(), "2012-10-25T22:04:27+11:00") - self.assertEqual(inst.source.identifier.value, "Grahame's Laptop") - self.assertEqual(inst.source.site, "Development") - self.assertEqual(inst.source.type[0].code, "110122") - self.assertEqual(inst.source.type[0].display, "Login") - self.assertEqual(inst.source.type[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.subtype[0].code, "110120") - self.assertEqual(inst.subtype[0].display, "Application Start") - self.assertEqual(inst.subtype[0].system, "http://dicom.nema.org/resources/ontology/DCM") - self.assertEqual(inst.text.div, "
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
") + self.assertEqual(inst.agent[1].type.coding[0].code, "110153") + self.assertEqual(inst.agent[1].type.coding[0].display, "Source Role ID") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.contained[0].id, "o1") + self.assertEqual(inst.entity[0].detail[0].type, "requested transaction") + self.assertEqual(inst.entity[0].detail[0].valueString, "http POST ..... ") + self.assertEqual(inst.entity[0].type.code, "2") + self.assertEqual(inst.entity[0].type.display, "System Object") + self.assertEqual(inst.entity[0].type.system, "http://terminology.hl7.org/CodeSystem/audit-entity-type") + self.assertEqual(inst.entity[1].description, "transaction failed") + self.assertEqual(inst.entity[1].type.code, "OperationOutcome") + self.assertEqual(inst.entity[1].type.display, "OperationOutcome") + self.assertEqual(inst.entity[1].type.system, "http://hl7.org/fhir/resource-types") + self.assertEqual(inst.id, "example-error") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "8") + self.assertEqual(inst.outcomeDesc, "Invalid request to create an Operation resource on the Patient endpoint.") + self.assertEqual(inst.recorded.date, FHIRDate("2017-09-07T23:42:24Z").date) + self.assertEqual(inst.recorded.as_json(), "2017-09-07T23:42:24Z") + self.assertEqual(inst.source.site, "Cloud") + self.assertEqual(inst.source.type[0].code, "3") + self.assertEqual(inst.source.type[0].display, "Web Server") + self.assertEqual(inst.source.type[0].system, "http://terminology.hl7.org/CodeSystem/security-source-type") + self.assertEqual(inst.subtype[0].code, "create") + self.assertEqual(inst.subtype[0].display, "create") + self.assertEqual(inst.subtype[0].system, "http://hl7.org/fhir/restful-interaction") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.code, "110100") - self.assertEqual(inst.type.display, "Application Activity") - self.assertEqual(inst.type.system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.type.code, "rest") + self.assertEqual(inst.type.display, "Restful Operation") + self.assertEqual(inst.type.system, "http://terminology.hl7.org/CodeSystem/audit-event-type") diff --git a/fhirclient/models/backboneelement.py b/fhirclient/models/backboneelement.py index 120739289..84a55649e 100644 --- a/fhirclient/models/backboneelement.py +++ b/fhirclient/models/backboneelement.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -25,7 +25,7 @@ def __init__(self, jsondict=None, strict=True): """ self.modifierExtension = None - """ Extensions that cannot be ignored. + """ Extensions that cannot be ignored even if unrecognized. List of `Extension` items (represented as `dict` in JSON). """ super(BackboneElement, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/basic.py b/fhirclient/models/basic.py index 5b745f8e9..39ebf97ba 100644 --- a/fhirclient/models/basic.py +++ b/fhirclient/models/basic.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Basic) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Basic) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,7 +27,7 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ Who created. - Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.code = None """ Kind of Resource. @@ -43,7 +43,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Identifies the focus of this resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(Basic, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/basic_tests.py b/fhirclient/models/basic_tests.py index 70ca2cafc..8b9075f87 100644 --- a/fhirclient/models/basic_tests.py +++ b/fhirclient/models/basic_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return basic.Basic(js) def testBasic1(self): - inst = self.instantiate_from("basic-example-narrative.json") + inst = self.instantiate_from("basic-example2.json") self.assertIsNotNone(inst, "Must have instantiated a Basic instance") self.implBasic1(inst) @@ -32,12 +32,33 @@ def testBasic1(self): self.implBasic1(inst2) def implBasic1(self, inst): - self.assertEqual(inst.code.text, "Example Narrative Tester") - self.assertEqual(inst.id, "basic-example-narrative") - self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.code.coding[0].code, "UMLCLASSMODEL") + self.assertEqual(inst.code.coding[0].system, "http://example.org/do-not-use/fhir-codes#resourceTypes") + self.assertEqual(inst.extension[0].extension[0].url, "name") + self.assertEqual(inst.extension[0].extension[0].valueString, "Class1") + self.assertEqual(inst.extension[0].extension[1].extension[0].url, "name") + self.assertEqual(inst.extension[0].extension[1].extension[0].valueString, "attribute1") + self.assertEqual(inst.extension[0].extension[1].extension[1].url, "minOccurs") + self.assertEqual(inst.extension[0].extension[1].extension[1].valueInteger, 1) + self.assertEqual(inst.extension[0].extension[1].extension[2].url, "maxOccurs") + self.assertEqual(inst.extension[0].extension[1].extension[2].valueCode, "*") + self.assertEqual(inst.extension[0].extension[1].url, "attribute") + self.assertEqual(inst.extension[0].extension[2].extension[0].url, "name") + self.assertEqual(inst.extension[0].extension[2].extension[0].valueString, "attribute2") + self.assertEqual(inst.extension[0].extension[2].extension[1].url, "minOccurs") + self.assertEqual(inst.extension[0].extension[2].extension[1].valueInteger, 0) + self.assertEqual(inst.extension[0].extension[2].extension[2].url, "maxOccurs") + self.assertEqual(inst.extension[0].extension[2].extension[2].valueInteger, 1) + self.assertEqual(inst.extension[0].extension[2].url, "attribute") + self.assertEqual(inst.extension[0].url, "http://example.org/do-not-use/fhir-extensions/UMLclass") + self.assertEqual(inst.id, "classModel") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") def testBasic2(self): - inst = self.instantiate_from("basic-example.json") + inst = self.instantiate_from("basic-example-narrative.json") self.assertIsNotNone(inst, "Must have instantiated a Basic instance") self.implBasic2(inst) @@ -47,8 +68,26 @@ def testBasic2(self): self.implBasic2(inst2) def implBasic2(self, inst): + self.assertEqual(inst.code.text, "Example Narrative Tester") + self.assertEqual(inst.id, "basic-example-narrative") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "additional") + + def testBasic3(self): + inst = self.instantiate_from("basic-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Basic instance") + self.implBasic3(inst) + + js = inst.as_json() + self.assertEqual("Basic", js["resourceType"]) + inst2 = basic.Basic(js) + self.implBasic3(inst2) + + def implBasic3(self, inst): self.assertEqual(inst.code.coding[0].code, "referral") - self.assertEqual(inst.code.coding[0].system, "http://hl7.org/fhir/basic-resource-type") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/basic-resource-type") self.assertEqual(inst.created.date, FHIRDate("2013-05-14").date) self.assertEqual(inst.created.as_json(), "2013-05-14") self.assertEqual(inst.extension[0].url, "http://example.org/do-not-use/fhir-extensions/referral#requestingPractitioner") @@ -58,6 +97,9 @@ def implBasic2(self, inst): self.assertEqual(inst.id, "referral") self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/basic/identifiers") self.assertEqual(inst.identifier[0].value, "19283746") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.modifierExtension[0].url, "http://example.org/do-not-use/fhir-extensions/referral#referredForService") self.assertEqual(inst.modifierExtension[0].valueCodeableConcept.coding[0].code, "11429006") self.assertEqual(inst.modifierExtension[0].valueCodeableConcept.coding[0].display, "Consultation") @@ -70,37 +112,4 @@ def implBasic2(self, inst): self.assertEqual(inst.modifierExtension[2].url, "http://example.org/do-not-use/fhir-extensions/referral#status") self.assertEqual(inst.modifierExtension[2].valueCode, "complete") self.assertEqual(inst.text.status, "generated") - - def testBasic3(self): - inst = self.instantiate_from("basic-example2.json") - self.assertIsNotNone(inst, "Must have instantiated a Basic instance") - self.implBasic3(inst) - - js = inst.as_json() - self.assertEqual("Basic", js["resourceType"]) - inst2 = basic.Basic(js) - self.implBasic3(inst2) - - def implBasic3(self, inst): - self.assertEqual(inst.code.coding[0].code, "UMLCLASSMODEL") - self.assertEqual(inst.code.coding[0].system, "http://example.org/do-not-use/fhir-codes#resourceTypes") - self.assertEqual(inst.extension[0].extension[0].url, "name") - self.assertEqual(inst.extension[0].extension[0].valueString, "Class1") - self.assertEqual(inst.extension[0].extension[1].extension[0].url, "name") - self.assertEqual(inst.extension[0].extension[1].extension[0].valueString, "attribute1") - self.assertEqual(inst.extension[0].extension[1].extension[1].url, "minOccurs") - self.assertEqual(inst.extension[0].extension[1].extension[1].valueInteger, 1) - self.assertEqual(inst.extension[0].extension[1].extension[2].url, "maxOccurs") - self.assertEqual(inst.extension[0].extension[1].extension[2].valueCode, "*") - self.assertEqual(inst.extension[0].extension[1].url, "attribute") - self.assertEqual(inst.extension[0].extension[2].extension[0].url, "name") - self.assertEqual(inst.extension[0].extension[2].extension[0].valueString, "attribute2") - self.assertEqual(inst.extension[0].extension[2].extension[1].url, "minOccurs") - self.assertEqual(inst.extension[0].extension[2].extension[1].valueInteger, 0) - self.assertEqual(inst.extension[0].extension[2].extension[2].url, "maxOccurs") - self.assertEqual(inst.extension[0].extension[2].extension[2].valueInteger, 1) - self.assertEqual(inst.extension[0].extension[2].url, "attribute") - self.assertEqual(inst.extension[0].url, "http://example.org/do-not-use/fhir-extensions/UMLclass") - self.assertEqual(inst.id, "classModel") - self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/binary.py b/fhirclient/models/binary.py index 4ed0d76df..b91f8b6f0 100644 --- a/fhirclient/models/binary.py +++ b/fhirclient/models/binary.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Binary) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Binary) on 2019-05-07. +# 2019, SMART Health IT. from . import resource @@ -10,8 +10,9 @@ class Binary(resource.Resource): """ Pure binary content defined by a format other than FHIR. - A binary resource can contain any content, whether text, image, pdf, zip - archive, etc. + A resource that represents the data of a single raw artifact as digital + content accessible in its native format. A Binary resource can contain any + content, whether text, image, pdf, zip archive, etc. """ resource_type = "Binary" @@ -24,25 +25,26 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.content = None - """ The actual content. - Type `str`. """ - self.contentType = None """ MimeType of the binary content. Type `str`. """ + self.data = None + """ The actual content. + Type `str`. """ + self.securityContext = None - """ Access Control Management. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + """ Identifies another resource to use as proxy when enforcing access + control. + Type `FHIRReference` (represented as `dict` in JSON). """ super(Binary, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Binary, self).elementProperties() js.extend([ - ("content", "content", str, False, None, True), ("contentType", "contentType", str, False, None, True), + ("data", "data", str, False, None, False), ("securityContext", "securityContext", fhirreference.FHIRReference, False, None, False), ]) return js diff --git a/fhirclient/models/binary_tests.py b/fhirclient/models/binary_tests.py index 6334f547d..19feed45a 100644 --- a/fhirclient/models/binary_tests.py +++ b/fhirclient/models/binary_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -34,4 +34,7 @@ def testBinary1(self): def implBinary1(self, inst): self.assertEqual(inst.contentType, "application/pdf") self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") diff --git a/fhirclient/models/biologicallyderivedproduct.py b/fhirclient/models/biologicallyderivedproduct.py new file mode 100644 index 000000000..eb1197294 --- /dev/null +++ b/fhirclient/models/biologicallyderivedproduct.py @@ -0,0 +1,294 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class BiologicallyDerivedProduct(domainresource.DomainResource): + """ A material substance originating from a biological entity. + + A material substance originating from a biological entity intended to be + transplanted or infused + into another (possibly the same) biological entity. + """ + + resource_type = "BiologicallyDerivedProduct" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.collection = None + """ How this product was collected. + Type `BiologicallyDerivedProductCollection` (represented as `dict` in JSON). """ + + self.identifier = None + """ External ids for this item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.manipulation = None + """ Any manipulation of product post-collection. + Type `BiologicallyDerivedProductManipulation` (represented as `dict` in JSON). """ + + self.parent = None + """ BiologicallyDerivedProduct parent. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.processing = None + """ Any processing of the product during collection. + List of `BiologicallyDerivedProductProcessing` items (represented as `dict` in JSON). """ + + self.productCategory = None + """ organ | tissue | fluid | cells | biologicalAgent. + Type `str`. """ + + self.productCode = None + """ What this biologically derived product is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.quantity = None + """ The amount of this biologically derived product. + Type `int`. """ + + self.request = None + """ Procedure request. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ available | unavailable. + Type `str`. """ + + self.storage = None + """ Product storage. + List of `BiologicallyDerivedProductStorage` items (represented as `dict` in JSON). """ + + super(BiologicallyDerivedProduct, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BiologicallyDerivedProduct, self).elementProperties() + js.extend([ + ("collection", "collection", BiologicallyDerivedProductCollection, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("manipulation", "manipulation", BiologicallyDerivedProductManipulation, False, None, False), + ("parent", "parent", fhirreference.FHIRReference, True, None, False), + ("processing", "processing", BiologicallyDerivedProductProcessing, True, None, False), + ("productCategory", "productCategory", str, False, None, False), + ("productCode", "productCode", codeableconcept.CodeableConcept, False, None, False), + ("quantity", "quantity", int, False, None, False), + ("request", "request", fhirreference.FHIRReference, True, None, False), + ("status", "status", str, False, None, False), + ("storage", "storage", BiologicallyDerivedProductStorage, True, None, False), + ]) + return js + + +from . import backboneelement + +class BiologicallyDerivedProductCollection(backboneelement.BackboneElement): + """ How this product was collected. + """ + + resource_type = "BiologicallyDerivedProductCollection" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.collectedDateTime = None + """ Time of product collection. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.collectedPeriod = None + """ Time of product collection. + Type `Period` (represented as `dict` in JSON). """ + + self.collector = None + """ Individual performing collection. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.source = None + """ Who is product from. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(BiologicallyDerivedProductCollection, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BiologicallyDerivedProductCollection, self).elementProperties() + js.extend([ + ("collectedDateTime", "collectedDateTime", fhirdate.FHIRDate, False, "collected", False), + ("collectedPeriod", "collectedPeriod", period.Period, False, "collected", False), + ("collector", "collector", fhirreference.FHIRReference, False, None, False), + ("source", "source", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class BiologicallyDerivedProductManipulation(backboneelement.BackboneElement): + """ Any manipulation of product post-collection. + + Any manipulation of product post-collection that is intended to alter the + product. For example a buffy-coat enrichment or CD8 reduction of + Peripheral Blood Stem Cells to make it more suitable for infusion. + """ + + resource_type = "BiologicallyDerivedProductManipulation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Description of manipulation. + Type `str`. """ + + self.timeDateTime = None + """ Time of manipulation. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timePeriod = None + """ Time of manipulation. + Type `Period` (represented as `dict` in JSON). """ + + super(BiologicallyDerivedProductManipulation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BiologicallyDerivedProductManipulation, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("timeDateTime", "timeDateTime", fhirdate.FHIRDate, False, "time", False), + ("timePeriod", "timePeriod", period.Period, False, "time", False), + ]) + return js + + +class BiologicallyDerivedProductProcessing(backboneelement.BackboneElement): + """ Any processing of the product during collection. + + Any processing of the product during collection that does not change the + fundamental nature of the product. For example adding anti-coagulants + during the collection of Peripheral Blood Stem Cells. + """ + + resource_type = "BiologicallyDerivedProductProcessing" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additive = None + """ Substance added during processing. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.description = None + """ Description of of processing. + Type `str`. """ + + self.procedure = None + """ Procesing code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.timeDateTime = None + """ Time of processing. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timePeriod = None + """ Time of processing. + Type `Period` (represented as `dict` in JSON). """ + + super(BiologicallyDerivedProductProcessing, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BiologicallyDerivedProductProcessing, self).elementProperties() + js.extend([ + ("additive", "additive", fhirreference.FHIRReference, False, None, False), + ("description", "description", str, False, None, False), + ("procedure", "procedure", codeableconcept.CodeableConcept, False, None, False), + ("timeDateTime", "timeDateTime", fhirdate.FHIRDate, False, "time", False), + ("timePeriod", "timePeriod", period.Period, False, "time", False), + ]) + return js + + +class BiologicallyDerivedProductStorage(backboneelement.BackboneElement): + """ Product storage. + """ + + resource_type = "BiologicallyDerivedProductStorage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Description of storage. + Type `str`. """ + + self.duration = None + """ Storage timeperiod. + Type `Period` (represented as `dict` in JSON). """ + + self.scale = None + """ farenheit | celsius | kelvin. + Type `str`. """ + + self.temperature = None + """ Storage temperature. + Type `float`. """ + + super(BiologicallyDerivedProductStorage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(BiologicallyDerivedProductStorage, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("duration", "duration", period.Period, False, None, False), + ("scale", "scale", str, False, None, False), + ("temperature", "temperature", float, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/biologicallyderivedproduct_tests.py b/fhirclient/models/biologicallyderivedproduct_tests.py new file mode 100644 index 000000000..40d478ac1 --- /dev/null +++ b/fhirclient/models/biologicallyderivedproduct_tests.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import biologicallyderivedproduct +from .fhirdate import FHIRDate + + +class BiologicallyDerivedProductTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("BiologicallyDerivedProduct", js["resourceType"]) + return biologicallyderivedproduct.BiologicallyDerivedProduct(js) + + def testBiologicallyDerivedProduct1(self): + inst = self.instantiate_from("biologicallyderivedproduct-example.json") + self.assertIsNotNone(inst, "Must have instantiated a BiologicallyDerivedProduct instance") + self.implBiologicallyDerivedProduct1(inst) + + js = inst.as_json() + self.assertEqual("BiologicallyDerivedProduct", js["resourceType"]) + inst2 = biologicallyderivedproduct.BiologicallyDerivedProduct(js) + self.implBiologicallyDerivedProduct1(inst2) + + def implBiologicallyDerivedProduct1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/bodysite_tests.py b/fhirclient/models/bodysite_tests.py deleted file mode 100644 index 10e2e4f81..000000000 --- a/fhirclient/models/bodysite_tests.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import bodysite -from .fhirdate import FHIRDate - - -class BodySiteTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("BodySite", js["resourceType"]) - return bodysite.BodySite(js) - - def testBodySite1(self): - inst = self.instantiate_from("bodysite-example-fetus.json") - self.assertIsNotNone(inst, "Must have instantiated a BodySite instance") - self.implBodySite1(inst) - - js = inst.as_json() - self.assertEqual("BodySite", js["resourceType"]) - inst2 = bodysite.BodySite(js) - self.implBodySite1(inst2) - - def implBodySite1(self, inst): - self.assertEqual(inst.code.coding[0].code, "83418008") - self.assertEqual(inst.code.coding[0].display, "Entire fetus (body structure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Fetus") - self.assertEqual(inst.description, "EDD 1/1/2017 confirmation by LMP") - self.assertEqual(inst.id, "fetus") - self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/bodysite/identifiers") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertEqual(inst.text.status, "generated") - - def testBodySite2(self): - inst = self.instantiate_from("bodysite-example-skin-patch.json") - self.assertIsNotNone(inst, "Must have instantiated a BodySite instance") - self.implBodySite2(inst) - - js = inst.as_json() - self.assertEqual("BodySite", js["resourceType"]) - inst2 = bodysite.BodySite(js) - self.implBodySite2(inst2) - - def implBodySite2(self, inst): - self.assertFalse(inst.active) - self.assertEqual(inst.code.coding[0].code, "39937001") - self.assertEqual(inst.code.coding[0].display, "Skin structure (body structure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Skin patch") - self.assertEqual(inst.description, "inner surface (volar) of the left forearm") - self.assertEqual(inst.id, "skin-patch") - self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/bodysite/identifiers") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertEqual(inst.text.status, "generated") - - def testBodySite3(self): - inst = self.instantiate_from("bodysite-example-tumor.json") - self.assertIsNotNone(inst, "Must have instantiated a BodySite instance") - self.implBodySite3(inst) - - js = inst.as_json() - self.assertEqual("BodySite", js["resourceType"]) - inst2 = bodysite.BodySite(js) - self.implBodySite3(inst2) - - def implBodySite3(self, inst): - self.assertEqual(inst.code.coding[0].code, "4147007") - self.assertEqual(inst.code.coding[0].display, "Mass (morphologic abnormality)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Splenic mass") - self.assertEqual(inst.description, "7 cm maximum diameter") - self.assertEqual(inst.id, "tumor") - self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/bodysite/identifiers") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertEqual(inst.image[0].contentType, "application/dicom") - self.assertEqual(inst.image[0].url, "http://imaging.acme.com/wado/server?requestType=WADO&wado_details") - self.assertEqual(inst.qualifier[0].coding[0].code, "78961009") - self.assertEqual(inst.qualifier[0].coding[0].display, "Splenic structure (body structure)") - self.assertEqual(inst.qualifier[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.qualifier[0].text, "Splenic mass") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/bodysite.py b/fhirclient/models/bodystructure.py similarity index 60% rename from fhirclient/models/bodysite.py rename to fhirclient/models/bodystructure.py index 4444d85ba..5c258c5a7 100644 --- a/fhirclient/models/bodysite.py +++ b/fhirclient/models/bodystructure.py @@ -1,21 +1,21 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/BodySite) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/BodyStructure) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource -class BodySite(domainresource.DomainResource): - """ Specific and identified anatomical location. +class BodyStructure(domainresource.DomainResource): + """ Specific and identified anatomical structure. - Record details about the anatomical location of a specimen or body part. - This resource may be used when a coded concept does not provide the - necessary detail needed for the use case. + Record details about an anatomical structure. This resource may be used + when a coded concept does not provide the necessary detail needed for the + use case. """ - resource_type = "BodySite" + resource_type = "BodyStructure" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -26,45 +26,50 @@ def __init__(self, jsondict=None, strict=True): """ self.active = None - """ Whether this body site record is in active use. + """ Whether this record is in active use. Type `bool`. """ - self.code = None - """ Named anatomical location. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.description = None - """ Anatomical location description. + """ Text description. Type `str`. """ self.identifier = None - """ Bodysite identifier. + """ Bodystructure identifier. List of `Identifier` items (represented as `dict` in JSON). """ self.image = None """ Attached images. List of `Attachment` items (represented as `dict` in JSON). """ - self.patient = None - """ Who this is about. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + self.location = None + """ Body site. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.qualifier = None - """ Modification to location code. + self.locationQualifier = None + """ Body site modifier. List of `CodeableConcept` items (represented as `dict` in JSON). """ - super(BodySite, self).__init__(jsondict=jsondict, strict=strict) + self.morphology = None + """ Kind of Structure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.patient = None + """ Who this is about. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(BodyStructure, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(BodySite, self).elementProperties() + js = super(BodyStructure, self).elementProperties() js.extend([ ("active", "active", bool, False, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("description", "description", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("image", "image", attachment.Attachment, True, None, False), + ("location", "location", codeableconcept.CodeableConcept, False, None, False), + ("locationQualifier", "locationQualifier", codeableconcept.CodeableConcept, True, None, False), + ("morphology", "morphology", codeableconcept.CodeableConcept, False, None, False), ("patient", "patient", fhirreference.FHIRReference, False, None, True), - ("qualifier", "qualifier", codeableconcept.CodeableConcept, True, None, False), ]) return js diff --git a/fhirclient/models/bodystructure_tests.py b/fhirclient/models/bodystructure_tests.py new file mode 100644 index 000000000..9966e4ea6 --- /dev/null +++ b/fhirclient/models/bodystructure_tests.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import bodystructure +from .fhirdate import FHIRDate + + +class BodyStructureTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("BodyStructure", js["resourceType"]) + return bodystructure.BodyStructure(js) + + def testBodyStructure1(self): + inst = self.instantiate_from("bodystructure-example-fetus.json") + self.assertIsNotNone(inst, "Must have instantiated a BodyStructure instance") + self.implBodyStructure1(inst) + + js = inst.as_json() + self.assertEqual("BodyStructure", js["resourceType"]) + inst2 = bodystructure.BodyStructure(js) + self.implBodyStructure1(inst2) + + def implBodyStructure1(self, inst): + self.assertEqual(inst.description, "EDD 1/1/2017 confirmation by LMP") + self.assertEqual(inst.id, "fetus") + self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/bodystructure/identifiers") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.location.coding[0].code, "83418008") + self.assertEqual(inst.location.coding[0].display, "Entire fetus (body structure)") + self.assertEqual(inst.location.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.location.text, "Fetus") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") + + def testBodyStructure2(self): + inst = self.instantiate_from("bodystructure-example-tumor.json") + self.assertIsNotNone(inst, "Must have instantiated a BodyStructure instance") + self.implBodyStructure2(inst) + + js = inst.as_json() + self.assertEqual("BodyStructure", js["resourceType"]) + inst2 = bodystructure.BodyStructure(js) + self.implBodyStructure2(inst2) + + def implBodyStructure2(self, inst): + self.assertEqual(inst.description, "7 cm maximum diameter") + self.assertEqual(inst.id, "tumor") + self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/bodystructure/identifiers") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.image[0].contentType, "application/dicom") + self.assertEqual(inst.image[0].url, "http://imaging.acme.com/wado/server?requestType=WADO&wado_details") + self.assertEqual(inst.location.coding[0].code, "78961009") + self.assertEqual(inst.location.coding[0].display, "Splenic structure (body structure)") + self.assertEqual(inst.location.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.location.text, "Spleen") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.morphology.coding[0].code, "4147007") + self.assertEqual(inst.morphology.coding[0].display, "Mass (morphologic abnormality)") + self.assertEqual(inst.morphology.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.morphology.text, "Splenic mass") + self.assertEqual(inst.text.status, "generated") + + def testBodyStructure3(self): + inst = self.instantiate_from("bodystructure-example-skin-patch.json") + self.assertIsNotNone(inst, "Must have instantiated a BodyStructure instance") + self.implBodyStructure3(inst) + + js = inst.as_json() + self.assertEqual("BodyStructure", js["resourceType"]) + inst2 = bodystructure.BodyStructure(js) + self.implBodyStructure3(inst2) + + def implBodyStructure3(self, inst): + self.assertFalse(inst.active) + self.assertEqual(inst.description, "inner surface (volar) of the left forearm") + self.assertEqual(inst.id, "skin-patch") + self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/bodystructure/identifiers") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.location.coding[0].code, "14975008") + self.assertEqual(inst.location.coding[0].display, "Forearm") + self.assertEqual(inst.location.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.location.text, "Forearm") + self.assertEqual(inst.locationQualifier[0].coding[0].code, "419161000") + self.assertEqual(inst.locationQualifier[0].coding[0].display, "Unilateral left") + self.assertEqual(inst.locationQualifier[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.locationQualifier[0].text, "Left") + self.assertEqual(inst.locationQualifier[1].coding[0].code, "263929005") + self.assertEqual(inst.locationQualifier[1].coding[0].display, "Volar") + self.assertEqual(inst.locationQualifier[1].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.locationQualifier[1].text, "Volar") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.morphology.text, "Skin patch") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/bundle.py b/fhirclient/models/bundle.py index ce8948131..8cddee0c9 100644 --- a/fhirclient/models/bundle.py +++ b/fhirclient/models/bundle.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Bundle) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Bundle) on 2019-05-07. +# 2019, SMART Health IT. from . import resource @@ -24,7 +24,7 @@ def __init__(self, jsondict=None, strict=True): """ self.entry = None - """ Entry in the bundle - will have a resource, or information. + """ Entry in the bundle - will have a resource or information. List of `BundleEntry` items (represented as `dict` in JSON). """ self.identifier = None @@ -39,6 +39,10 @@ def __init__(self, jsondict=None, strict=True): """ Digital Signature. Type `Signature` (represented as `dict` in JSON). """ + self.timestamp = None + """ When the bundle was assembled. + Type `FHIRDate` (represented as `str` in JSON). """ + self.total = None """ If search, the total number of matches. Type `int`. """ @@ -57,6 +61,7 @@ def elementProperties(self): ("identifier", "identifier", identifier.Identifier, False, None, False), ("link", "link", BundleLink, True, None, False), ("signature", "signature", signature.Signature, False, None, False), + ("timestamp", "timestamp", fhirdate.FHIRDate, False, None, False), ("total", "total", int, False, None, False), ("type", "type", str, False, None, True), ]) @@ -66,9 +71,9 @@ def elementProperties(self): from . import backboneelement class BundleEntry(backboneelement.BackboneElement): - """ Entry in the bundle - will have a resource, or information. + """ Entry in the bundle - will have a resource or information. - An entry in a bundle resource - will either contain a resource, or + An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only). """ @@ -83,7 +88,7 @@ def __init__(self, jsondict=None, strict=True): """ self.fullUrl = None - """ Absolute URL for resource (server address, or UUID/OID). + """ URI for resource (Absolute URL server address or URI for UUID/OID). Type `str`. """ self.link = None @@ -91,7 +96,7 @@ def __init__(self, jsondict=None, strict=True): List of `BundleLink` items (represented as `dict` in JSON). """ self.request = None - """ Transaction Related Information. + """ Additional execution information (transaction/batch/history). Type `BundleEntryRequest` (represented as `dict` in JSON). """ self.resource = None @@ -99,7 +104,7 @@ def __init__(self, jsondict=None, strict=True): Type `Resource` (represented as `dict` in JSON). """ self.response = None - """ Transaction Related Information. + """ Results of execution (transaction/batch/history). Type `BundleEntryResponse` (represented as `dict` in JSON). """ self.search = None @@ -122,10 +127,11 @@ def elementProperties(self): class BundleEntryRequest(backboneelement.BackboneElement): - """ Transaction Related Information. + """ Additional execution information (transaction/batch/history). Additional information about how this entry should be processed as part of - a transaction. + a transaction or batch. For history, it shows how the entry was processed + to create the version contained in the entry. """ resource_type = "BundleEntryRequest" @@ -143,7 +149,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.ifModifiedSince = None - """ For managing update contention. + """ For managing cache currency. Type `FHIRDate` (represented as `str` in JSON). """ self.ifNoneExist = None @@ -155,7 +161,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.method = None - """ GET | POST | PUT | DELETE. + """ GET | HEAD | POST | PUT | DELETE | PATCH. Type `str`. """ self.url = None @@ -178,10 +184,11 @@ def elementProperties(self): class BundleEntryResponse(backboneelement.BackboneElement): - """ Transaction Related Information. + """ Results of execution (transaction/batch/history). - Additional information about how this entry should be processed as part of - a transaction. + Indicates the results of processing the corresponding 'request' entry in + the batch or transaction being responded to or what the results of an + operation where when returning history. """ resource_type = "BundleEntryResponse" @@ -195,7 +202,7 @@ def __init__(self, jsondict=None, strict=True): """ self.etag = None - """ The etag for the resource (if relevant). + """ The Etag for the resource (if relevant). Type `str`. """ self.lastModified = None @@ -203,7 +210,7 @@ def __init__(self, jsondict=None, strict=True): Type `FHIRDate` (represented as `str` in JSON). """ self.location = None - """ The location, if the operation returns a location. + """ The location (if the operation returns a location). Type `str`. """ self.outcome = None diff --git a/fhirclient/models/bundle_tests.py b/fhirclient/models/bundle_tests.py index a3ee457ce..2f262effb 100644 --- a/fhirclient/models/bundle_tests.py +++ b/fhirclient/models/bundle_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return bundle.Bundle(js) def testBundle1(self): - inst = self.instantiate_from("bundle-example.json") + inst = self.instantiate_from("diagnosticreport-example-f202-bloodculture.json") self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") self.implBundle1(inst) @@ -32,25 +32,18 @@ def testBundle1(self): self.implBundle1(inst2) def implBundle1(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "https://example.com/base/MedicationRequest/3123") - self.assertEqual(inst.entry[0].resource.id, "3123") - self.assertEqual(inst.entry[0].search.mode, "match") - self.assertEqual(inst.entry[0].search.score, 1) - self.assertEqual(inst.entry[1].fullUrl, "https://example.com/base/Medication/example") - self.assertEqual(inst.entry[1].resource.id, "example") - self.assertEqual(inst.entry[1].search.mode, "include") - self.assertEqual(inst.id, "bundle-example") - self.assertEqual(inst.link[0].relation, "self") - self.assertEqual(inst.link[0].url, "https://example.com/base/MedicationRequest?patient=347&_include=MedicationRequest.medication") - self.assertEqual(inst.link[1].relation, "next") - self.assertEqual(inst.link[1].url, "https://example.com/base/MedicationRequest?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2014-08-18T01:43:30Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2014-08-18T01:43:30Z") - self.assertEqual(inst.total, 3) - self.assertEqual(inst.type, "searchset") + self.assertEqual(inst.entry[0].fullUrl, "https://example.com/base/DiagnosticReport/f202") + self.assertEqual(inst.entry[0].resource.id, "f202") + self.assertEqual(inst.entry[1].fullUrl, "https://example.com/base/ServiceRequest/req") + self.assertEqual(inst.entry[1].resource.id, "req") + self.assertEqual(inst.id, "f202") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.type, "collection") def testBundle2(self): - inst = self.instantiate_from("diagnosticreport-examples-general.json") + inst = self.instantiate_from("xds-example.json") self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") self.implBundle2(inst) @@ -60,320 +53,94 @@ def testBundle2(self): self.implBundle2(inst2) def implBundle2(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/DiagnosticReport/3") - self.assertEqual(inst.entry[0].resource.id, "3") - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/DiagnosticReport/4") - self.assertEqual(inst.entry[1].resource.id, "4") - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/DiagnosticReport/5") - self.assertEqual(inst.entry[2].resource.id, "5") - self.assertEqual(inst.entry[2].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[2].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/DiagnosticReport/6") - self.assertEqual(inst.entry[3].resource.id, "6") - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/DiagnosticReport/7") - self.assertEqual(inst.entry[4].resource.id, "7") - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/DiagnosticReport/8") - self.assertEqual(inst.entry[5].resource.id, "8") - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/DiagnosticReport/9") - self.assertEqual(inst.entry[6].resource.id, "9") - self.assertEqual(inst.entry[6].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[6].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/DiagnosticReport/15") - self.assertEqual(inst.entry[7].resource.id, "15") - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/DiagnosticReport/16") - self.assertEqual(inst.entry[8].resource.id, "16") - self.assertEqual(inst.entry[8].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[8].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.entry[9].fullUrl, "http://hl7.org/fhir/DiagnosticReport/17") - self.assertEqual(inst.entry[9].resource.id, "17") - self.assertEqual(inst.entry[9].resource.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.entry[9].resource.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.id, "72ac8493-52ac-41bd-8d5d-7258c289b5ea") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2012-04-14T10:35:23Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2012-04-14T10:35:23Z") - self.assertEqual(inst.type, "collection") - - def testBundle3(self): - inst = self.instantiate_from("diagnosticreport-hla-genetics-results-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle3(inst) - - js = inst.as_json() - self.assertEqual("Bundle", js["resourceType"]) - inst2 = bundle.Bundle(js) - self.implBundle3(inst2) - - def implBundle3(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "urn:uuid:b0a4b18e-94e7-4b1b-8031-c7ae4bdd8db9") + self.assertEqual(inst.entry[0].fullUrl, "urn:uuid:3fdc72f4-a11d-4a9d-9260-a9f745779e1d") self.assertEqual(inst.entry[0].request.method, "POST") - self.assertEqual(inst.entry[0].request.url, "DiagnosticReport") - self.assertEqual(inst.entry[1].fullUrl, "urn:uuid:8200dab6-18a2-4550-b913-a7db480c0804") + self.assertEqual(inst.entry[0].request.url, "DocumentReference") + self.assertEqual(inst.entry[0].resource.meta.lastUpdated.date, FHIRDate("2013-07-01T13:11:33Z").date) + self.assertEqual(inst.entry[0].resource.meta.lastUpdated.as_json(), "2013-07-01T13:11:33Z") + self.assertEqual(inst.entry[1].fullUrl, "http://localhost:9556/svc/fhir/Patient/a2") + self.assertEqual(inst.entry[1].request.ifNoneExist, "Patient?identifier=http://acme.org/xds/patients!89765a87b") self.assertEqual(inst.entry[1].request.method, "POST") - self.assertEqual(inst.entry[1].request.url, "Sequence") - self.assertEqual(inst.entry[2].fullUrl, "urn:uuid:7c393185-f15c-45bc-a714-c0fdbea32675") + self.assertEqual(inst.entry[1].request.url, "Patient") + self.assertEqual(inst.entry[1].resource.id, "a2") + self.assertEqual(inst.entry[1].resource.meta.lastUpdated.date, FHIRDate("2013-07-01T13:11:33Z").date) + self.assertEqual(inst.entry[1].resource.meta.lastUpdated.as_json(), "2013-07-01T13:11:33Z") + self.assertEqual(inst.entry[2].fullUrl, "http://localhost:9556/svc/fhir/Practitioner/a3") self.assertEqual(inst.entry[2].request.method, "POST") - self.assertEqual(inst.entry[2].request.url, "Sequence") - self.assertEqual(inst.entry[3].fullUrl, "urn:uuid:65c85f14-c3a0-4b72-818f-820e04fcc621") + self.assertEqual(inst.entry[2].request.url, "Practitioner") + self.assertEqual(inst.entry[2].resource.id, "a3") + self.assertEqual(inst.entry[2].resource.meta.lastUpdated.date, FHIRDate("2013-07-01T13:11:33Z").date) + self.assertEqual(inst.entry[2].resource.meta.lastUpdated.as_json(), "2013-07-01T13:11:33Z") + self.assertEqual(inst.entry[3].fullUrl, "http://localhost:9556/svc/fhir/Practitioner/a4") self.assertEqual(inst.entry[3].request.method, "POST") - self.assertEqual(inst.entry[3].request.url, "Sequence") - self.assertEqual(inst.entry[4].fullUrl, "urn:uuid:fbba9fe7-0ece-4ec1-9233-a437a8d242a0") + self.assertEqual(inst.entry[3].request.url, "Practitioner") + self.assertEqual(inst.entry[3].resource.id, "a4") + self.assertEqual(inst.entry[3].resource.meta.lastUpdated.date, FHIRDate("2013-07-01T13:11:33Z").date) + self.assertEqual(inst.entry[3].resource.meta.lastUpdated.as_json(), "2013-07-01T13:11:33Z") + self.assertEqual(inst.entry[4].fullUrl, "http://localhost:9556/svc/fhir/Binary/1e404af3-077f-4bee-b7a6-a9be97e1ce32") self.assertEqual(inst.entry[4].request.method, "POST") - self.assertEqual(inst.entry[4].request.url, "Sequence") - self.assertEqual(inst.entry[5].fullUrl, "urn:uuid:cbabf93e-1b4b-46f2-ba1e-d84862670670") - self.assertEqual(inst.entry[5].request.method, "POST") - self.assertEqual(inst.entry[5].request.url, "Sequence") - self.assertEqual(inst.entry[6].fullUrl, "urn:uuid:c233ad3d-1572-48d6-93da-0a583535e138") - self.assertEqual(inst.entry[6].request.method, "POST") - self.assertEqual(inst.entry[6].request.url, "Sequence") - self.assertEqual(inst.entry[7].fullUrl, "urn:uuid:05fa52d7-5c67-460a-8722-d3460b24d6fe") - self.assertEqual(inst.entry[7].request.method, "POST") - self.assertEqual(inst.entry[7].request.url, "Sequence") - self.assertEqual(inst.entry[8].fullUrl, "urn:uuid:db69e549-6267-4777-b4b9-8813f3329309") - self.assertEqual(inst.entry[8].request.method, "POST") - self.assertEqual(inst.entry[8].request.url, "Sequence") - self.assertEqual(inst.entry[9].fullUrl, "urn:uuid:bb55c2bc-5ad2-4bc1-8ff3-c407d06b12d0") - self.assertEqual(inst.entry[9].request.method, "POST") - self.assertEqual(inst.entry[9].request.url, "Sequence") - self.assertEqual(inst.id, "hla-1") + self.assertEqual(inst.entry[4].request.url, "Binary") + self.assertEqual(inst.entry[4].resource.id, "1e404af3-077f-4bee-b7a6-a9be97e1ce32") + self.assertEqual(inst.entry[4].resource.meta.lastUpdated.date, FHIRDate("2013-07-01T13:11:33Z").date) + self.assertEqual(inst.entry[4].resource.meta.lastUpdated.as_json(), "2013-07-01T13:11:33Z") + self.assertEqual(inst.id, "xds") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2013-07-01T13:11:33Z").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2013-07-01T13:11:33Z") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.type, "transaction") - def testBundle4(self): - inst = self.instantiate_from("document-example-dischargesummary.json") - self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle4(inst) - - js = inst.as_json() - self.assertEqual("Bundle", js["resourceType"]) - inst2 = bundle.Bundle(js) - self.implBundle4(inst2) - - def implBundle4(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "http://fhir.healthintersections.com.au/open/Composition/180f219f-97a8-486d-99d9-ed631fe4fc57") - self.assertEqual(inst.entry[0].resource.id, "180f219f-97a8-486d-99d9-ed631fe4fc57") - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.date, FHIRDate("2013-05-28T22:12:21Z").date) - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.as_json(), "2013-05-28T22:12:21Z") - self.assertEqual(inst.entry[1].fullUrl, "http://fhir.healthintersections.com.au/open/Practitioner/example") - self.assertEqual(inst.entry[1].resource.id, "example") - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") - self.assertEqual(inst.entry[2].fullUrl, "http://fhir.healthintersections.com.au/open/Patient/d1") - self.assertEqual(inst.entry[2].resource.id, "d1") - self.assertEqual(inst.entry[3].fullUrl, "http://fhir.healthintersections.com.au/open/Encounter/doc-example") - self.assertEqual(inst.entry[3].resource.id, "doc-example") - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") - self.assertEqual(inst.entry[4].fullUrl, "urn:uuid:541a72a8-df75-4484-ac89-ac4923f03b81") - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") - self.assertEqual(inst.entry[5].fullUrl, "urn:uuid:124a6916-5d84-4b8c-b250-10cefb8e6e86") - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") - self.assertEqual(inst.entry[6].fullUrl, "urn:uuid:673f8db5-0ffd-4395-9657-6da00420bbc1") - self.assertEqual(inst.entry[7].fullUrl, "urn:uuid:47600e0f-b6b5-4308-84b5-5dec157f7637") - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") - self.assertEqual(inst.id, "father") - self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier.value, "urn:uuid:0c3151bd-1cbf-4d64-b04d-cd9187a4c6e0") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2013-05-28T22:12:21Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2013-05-28T22:12:21Z") - self.assertEqual(inst.signature.contentType, "image/jpg") - self.assertEqual(inst.signature.type[0].code, "1.2.840.10065.1.12.1.1") - self.assertEqual(inst.signature.type[0].display, "Author's Signature") - self.assertEqual(inst.signature.type[0].system, "urn:iso-astm:E1762-95:2013") - self.assertEqual(inst.signature.when.date, FHIRDate("2015-08-31T07:42:33+10:00").date) - self.assertEqual(inst.signature.when.as_json(), "2015-08-31T07:42:33+10:00") - self.assertEqual(inst.type, "document") - - def testBundle5(self): - inst = self.instantiate_from("endpoint-examples-general-template.json") - self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle5(inst) - - js = inst.as_json() - self.assertEqual("Bundle", js["resourceType"]) - inst2 = bundle.Bundle(js) - self.implBundle5(inst2) - - def implBundle5(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/Endpoint/71") - self.assertEqual(inst.entry[0].resource.id, "71") - self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/Endpoint/72") - self.assertEqual(inst.entry[1].resource.id, "72") - self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/Endpoint/73") - self.assertEqual(inst.entry[2].resource.id, "73") - self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/Endpoint/74") - self.assertEqual(inst.entry[3].resource.id, "74") - self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/Endpoint/75") - self.assertEqual(inst.entry[4].resource.id, "75") - self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/Endpoint/76") - self.assertEqual(inst.entry[5].resource.id, "76") - self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/Endpoint/77") - self.assertEqual(inst.entry[6].resource.id, "77") - self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/Endpoint/78") - self.assertEqual(inst.entry[7].resource.id, "78") - self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/Endpoint/79") - self.assertEqual(inst.entry[8].resource.id, "79") - self.assertEqual(inst.entry[9].fullUrl, "http://hl7.org/fhir/Endpoint/80") - self.assertEqual(inst.entry[9].resource.id, "80") - self.assertEqual(inst.id, "b0a5e4277-83c4-4adb-87e2-e3efe3369b6f") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.type, "collection") - - def testBundle6(self): - inst = self.instantiate_from("location-examples-general.json") - self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle6(inst) - - js = inst.as_json() - self.assertEqual("Bundle", js["resourceType"]) - inst2 = bundle.Bundle(js) - self.implBundle6(inst2) - - def implBundle6(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/Location/2") - self.assertEqual(inst.entry[0].resource.id, "2") - self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/Location/3") - self.assertEqual(inst.entry[1].resource.id, "3") - self.assertEqual(inst.id, "3ad0687e-f477-468c-afd5-fcc2bf897819") - self.assertEqual(inst.type, "collection") - - def testBundle7(self): - inst = self.instantiate_from("patient-examples-cypress-template.json") - self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle7(inst) - - js = inst.as_json() - self.assertEqual("Bundle", js["resourceType"]) - inst2 = bundle.Bundle(js) - self.implBundle7(inst2) - - def implBundle7(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/Patient/71") - self.assertEqual(inst.entry[0].resource.id, "71") - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/Patient/72") - self.assertEqual(inst.entry[1].resource.id, "72") - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/Patient/73") - self.assertEqual(inst.entry[2].resource.id, "73") - self.assertEqual(inst.entry[2].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[2].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/Patient/74") - self.assertEqual(inst.entry[3].resource.id, "74") - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/Patient/75") - self.assertEqual(inst.entry[4].resource.id, "75") - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/Patient/76") - self.assertEqual(inst.entry[5].resource.id, "76") - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/Patient/77") - self.assertEqual(inst.entry[6].resource.id, "77") - self.assertEqual(inst.entry[6].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[6].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/Patient/78") - self.assertEqual(inst.entry[7].resource.id, "78") - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/Patient/79") - self.assertEqual(inst.entry[8].resource.id, "79") - self.assertEqual(inst.entry[8].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[8].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.entry[9].fullUrl, "http://hl7.org/fhir/Patient/80") - self.assertEqual(inst.entry[9].resource.id, "80") - self.assertEqual(inst.entry[9].resource.meta.lastUpdated.date, FHIRDate("2012-06-03T23:45:32Z").date) - self.assertEqual(inst.entry[9].resource.meta.lastUpdated.as_json(), "2012-06-03T23:45:32Z") - self.assertEqual(inst.id, "b0a5e4277-83c4-4adb-87e2-e3efe3369b6f") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.type, "collection") - - def testBundle8(self): - inst = self.instantiate_from("patient-examples-general.json") + def testBundle3(self): + inst = self.instantiate_from("diagnosticreport-example-ghp.json") self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle8(inst) + self.implBundle3(inst) js = inst.as_json() self.assertEqual("Bundle", js["resourceType"]) inst2 = bundle.Bundle(js) - self.implBundle8(inst2) + self.implBundle3(inst2) - def implBundle8(self, inst): - self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/Patient/1") - self.assertEqual(inst.entry[0].resource.id, "1") - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[0].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/Patient/2") - self.assertEqual(inst.entry[1].resource.id, "2") - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[1].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[2].fullUrl, "http://hl7.org/fhir/Patient/3") - self.assertEqual(inst.entry[2].resource.id, "3") - self.assertEqual(inst.entry[2].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[2].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[3].fullUrl, "http://hl7.org/fhir/Patient/4") - self.assertEqual(inst.entry[3].resource.id, "4") - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[3].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[4].fullUrl, "http://hl7.org/fhir/Patient/5") - self.assertEqual(inst.entry[4].resource.id, "5") - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[4].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[5].fullUrl, "http://hl7.org/fhir/Patient/6") - self.assertEqual(inst.entry[5].resource.id, "6") - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[5].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[6].fullUrl, "http://hl7.org/fhir/Patient/7") - self.assertEqual(inst.entry[6].resource.id, "7") - self.assertEqual(inst.entry[6].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[6].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[7].fullUrl, "http://hl7.org/fhir/Patient/8") - self.assertEqual(inst.entry[7].resource.id, "8") - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[7].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[8].fullUrl, "http://hl7.org/fhir/Patient/9") - self.assertEqual(inst.entry[8].resource.id, "9") - self.assertEqual(inst.entry[8].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[8].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.entry[9].fullUrl, "http://hl7.org/fhir/Patient/10") - self.assertEqual(inst.entry[9].resource.id, "10") - self.assertEqual(inst.entry[9].resource.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.entry[9].resource.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") - self.assertEqual(inst.id, "b248b1b2-1686-4b94-9936-37d7a5f94b51") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") + def implBundle3(self, inst): + self.assertEqual(inst.entry[0].fullUrl, "https://example.com/base/DiagnosticReport/ghp") + self.assertEqual(inst.entry[0].resource.id, "ghp") + self.assertEqual(inst.entry[0].resource.meta.lastUpdated.date, FHIRDate("2015-08-16T10:35:23Z").date) + self.assertEqual(inst.entry[0].resource.meta.lastUpdated.as_json(), "2015-08-16T10:35:23Z") + self.assertEqual(inst.entry[1].fullUrl, "https://example.com/base/Specimen/rtt") + self.assertEqual(inst.entry[1].resource.id, "rtt") + self.assertEqual(inst.entry[2].fullUrl, "https://example.com/base/Specimen/ltt") + self.assertEqual(inst.entry[2].resource.id, "ltt") + self.assertEqual(inst.entry[3].fullUrl, "https://example.com/base/Specimen/urine") + self.assertEqual(inst.entry[3].resource.id, "urine") + self.assertEqual(inst.entry[4].fullUrl, "https://example.com/base/Observation/p2") + self.assertEqual(inst.entry[4].resource.id, "p2") + self.assertEqual(inst.entry[5].fullUrl, "https://example.com/base/Observation/r1") + self.assertEqual(inst.entry[5].resource.id, "r1") + self.assertEqual(inst.entry[6].fullUrl, "https://example.com/base/Observation/r2") + self.assertEqual(inst.entry[6].resource.id, "r2") + self.assertEqual(inst.entry[7].fullUrl, "https://example.com/base/Observation/r3") + self.assertEqual(inst.entry[7].resource.id, "r3") + self.assertEqual(inst.entry[8].fullUrl, "https://example.com/base/Observation/r4") + self.assertEqual(inst.entry[8].resource.id, "r4") + self.assertEqual(inst.entry[9].fullUrl, "https://example.com/base/Observation/r5") + self.assertEqual(inst.entry[9].resource.id, "r5") + self.assertEqual(inst.id, "ghp") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.type, "collection") - def testBundle9(self): + def testBundle4(self): inst = self.instantiate_from("practitioner-examples-general.json") self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle9(inst) + self.implBundle4(inst) js = inst.as_json() self.assertEqual("Bundle", js["resourceType"]) inst2 = bundle.Bundle(js) - self.implBundle9(inst2) + self.implBundle4(inst2) - def implBundle9(self, inst): + def implBundle4(self, inst): self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/Practitioner/1") self.assertEqual(inst.entry[0].resource.id, "1") self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/Practitioner/13") @@ -415,19 +182,96 @@ def implBundle9(self, inst): self.assertEqual(inst.id, "3ad0687e-f477-468c-afd5-fcc2bf897809") self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) self.assertEqual(inst.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.type, "collection") - def testBundle10(self): + def testBundle5(self): + inst = self.instantiate_from("diagnosticreport-example-lipids.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle5(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle5(inst2) + + def implBundle5(self, inst): + self.assertEqual(inst.entry[0].fullUrl, "https://example.com/base/DiagnosticReport/lipids") + self.assertEqual(inst.entry[0].resource.id, "lipids") + self.assertEqual(inst.entry[1].fullUrl, "https://example.com/base/Observation/cholesterol") + self.assertEqual(inst.entry[1].resource.id, "cholesterol") + self.assertEqual(inst.entry[2].fullUrl, "https://example.com/base/Observation/triglyceride") + self.assertEqual(inst.entry[2].resource.id, "triglyceride") + self.assertEqual(inst.entry[3].fullUrl, "https://example.com/base/Observation/hdlcholesterol") + self.assertEqual(inst.entry[3].resource.id, "hdlcholesterol") + self.assertEqual(inst.entry[4].fullUrl, "https://example.com/base/Observation/ldlcholesterol") + self.assertEqual(inst.entry[4].resource.id, "ldlcholesterol") + self.assertEqual(inst.id, "lipids") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.type, "collection") + + def testBundle6(self): + inst = self.instantiate_from("diagnosticreport-hla-genetics-results-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle6(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle6(inst2) + + def implBundle6(self, inst): + self.assertEqual(inst.entry[0].fullUrl, "urn:uuid:b0a4b18e-94e7-4b1b-8031-c7ae4bdd8db9") + self.assertEqual(inst.entry[0].request.method, "POST") + self.assertEqual(inst.entry[0].request.url, "DiagnosticReport") + self.assertEqual(inst.entry[1].fullUrl, "urn:uuid:8200dab6-18a2-4550-b913-a7db480c0804") + self.assertEqual(inst.entry[1].request.method, "POST") + self.assertEqual(inst.entry[1].request.url, "MolecularSequence") + self.assertEqual(inst.entry[2].fullUrl, "urn:uuid:7c393185-f15c-45bc-a714-c0fdbea32675") + self.assertEqual(inst.entry[2].request.method, "POST") + self.assertEqual(inst.entry[2].request.url, "MolecularSequence") + self.assertEqual(inst.entry[3].fullUrl, "urn:uuid:65c85f14-c3a0-4b72-818f-820e04fcc621") + self.assertEqual(inst.entry[3].request.method, "POST") + self.assertEqual(inst.entry[3].request.url, "MolecularSequence") + self.assertEqual(inst.entry[4].fullUrl, "urn:uuid:fbba9fe7-0ece-4ec1-9233-a437a8d242a0") + self.assertEqual(inst.entry[4].request.method, "POST") + self.assertEqual(inst.entry[4].request.url, "MolecularSequence") + self.assertEqual(inst.entry[5].fullUrl, "urn:uuid:cbabf93e-1b4b-46f2-ba1e-d84862670670") + self.assertEqual(inst.entry[5].request.method, "POST") + self.assertEqual(inst.entry[5].request.url, "MolecularSequence") + self.assertEqual(inst.entry[6].fullUrl, "urn:uuid:c233ad3d-1572-48d6-93da-0a583535e138") + self.assertEqual(inst.entry[6].request.method, "POST") + self.assertEqual(inst.entry[6].request.url, "MolecularSequence") + self.assertEqual(inst.entry[7].fullUrl, "urn:uuid:05fa52d7-5c67-460a-8722-d3460b24d6fe") + self.assertEqual(inst.entry[7].request.method, "POST") + self.assertEqual(inst.entry[7].request.url, "MolecularSequence") + self.assertEqual(inst.entry[8].fullUrl, "urn:uuid:db69e549-6267-4777-b4b9-8813f3329309") + self.assertEqual(inst.entry[8].request.method, "POST") + self.assertEqual(inst.entry[8].request.url, "MolecularSequence") + self.assertEqual(inst.entry[9].fullUrl, "urn:uuid:bb55c2bc-5ad2-4bc1-8ff3-c407d06b12d0") + self.assertEqual(inst.entry[9].request.method, "POST") + self.assertEqual(inst.entry[9].request.url, "MolecularSequence") + self.assertEqual(inst.id, "hla-1") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.type, "transaction") + + def testBundle7(self): inst = self.instantiate_from("practitionerrole-examples-general.json") self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") - self.implBundle10(inst) + self.implBundle7(inst) js = inst.as_json() self.assertEqual("Bundle", js["resourceType"]) inst2 = bundle.Bundle(js) - self.implBundle10(inst2) + self.implBundle7(inst2) - def implBundle10(self, inst): + def implBundle7(self, inst): self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/PractitionerRole/f003-0") self.assertEqual(inst.entry[0].resource.id, "f003-0") self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/PractitionerRole/example-0") @@ -449,5 +293,101 @@ def implBundle10(self, inst): self.assertEqual(inst.entry[9].fullUrl, "http://hl7.org/fhir/PractitionerRole/f203-0") self.assertEqual(inst.entry[9].resource.id, "f203-0") self.assertEqual(inst.id, "3ad0687e-f477-468c-afd5-fcc2bf897808") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.type, "collection") + + def testBundle8(self): + inst = self.instantiate_from("diagnosticreport-example-f001-bloodexam.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle8(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle8(inst2) + + def implBundle8(self, inst): + self.assertEqual(inst.entry[0].fullUrl, "https://example.com/base/DiagnosticReport/f001") + self.assertEqual(inst.entry[0].resource.id, "f001") + self.assertEqual(inst.entry[1].fullUrl, "https://example.com/base/ServiceRequest/req") + self.assertEqual(inst.entry[1].resource.id, "req") + self.assertEqual(inst.id, "f001") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.type, "collection") + + def testBundle9(self): + inst = self.instantiate_from("document-example-dischargesummary.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle9(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle9(inst2) + + def implBundle9(self, inst): + self.assertEqual(inst.entry[0].fullUrl, "http://fhir.healthintersections.com.au/open/Composition/180f219f-97a8-486d-99d9-ed631fe4fc57") + self.assertEqual(inst.entry[0].resource.id, "180f219f-97a8-486d-99d9-ed631fe4fc57") + self.assertEqual(inst.entry[0].resource.meta.lastUpdated.date, FHIRDate("2013-05-28T22:12:21Z").date) + self.assertEqual(inst.entry[0].resource.meta.lastUpdated.as_json(), "2013-05-28T22:12:21Z") + self.assertEqual(inst.entry[1].fullUrl, "http://fhir.healthintersections.com.au/open/Practitioner/example") + self.assertEqual(inst.entry[1].resource.id, "example") + self.assertEqual(inst.entry[1].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) + self.assertEqual(inst.entry[1].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") + self.assertEqual(inst.entry[2].fullUrl, "http://fhir.healthintersections.com.au/open/Patient/d1") + self.assertEqual(inst.entry[2].resource.id, "d1") + self.assertEqual(inst.entry[3].fullUrl, "http://fhir.healthintersections.com.au/open/Encounter/doc-example") + self.assertEqual(inst.entry[3].resource.id, "doc-example") + self.assertEqual(inst.entry[3].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) + self.assertEqual(inst.entry[3].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") + self.assertEqual(inst.entry[4].fullUrl, "urn:uuid:541a72a8-df75-4484-ac89-ac4923f03b81") + self.assertEqual(inst.entry[4].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) + self.assertEqual(inst.entry[4].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") + self.assertEqual(inst.entry[5].fullUrl, "urn:uuid:124a6916-5d84-4b8c-b250-10cefb8e6e86") + self.assertEqual(inst.entry[5].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) + self.assertEqual(inst.entry[5].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") + self.assertEqual(inst.entry[6].fullUrl, "urn:uuid:673f8db5-0ffd-4395-9657-6da00420bbc1") + self.assertEqual(inst.entry[7].fullUrl, "urn:uuid:47600e0f-b6b5-4308-84b5-5dec157f7637") + self.assertEqual(inst.entry[7].resource.meta.lastUpdated.date, FHIRDate("2013-05-05T16:13:03Z").date) + self.assertEqual(inst.entry[7].resource.meta.lastUpdated.as_json(), "2013-05-05T16:13:03Z") + self.assertEqual(inst.id, "father") + self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier.value, "urn:uuid:0c3151bd-1cbf-4d64-b04d-cd9187a4c6e0") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2013-05-28T22:12:21Z").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2013-05-28T22:12:21Z") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.signature.sigFormat, "image/jpg") + self.assertEqual(inst.signature.type[0].code, "1.2.840.10065.1.12.1.1") + self.assertEqual(inst.signature.type[0].display, "Author's Signature") + self.assertEqual(inst.signature.type[0].system, "urn:iso-astm:E1762-95:2013") + self.assertEqual(inst.signature.when.date, FHIRDate("2015-08-31T07:42:33+10:00").date) + self.assertEqual(inst.signature.when.as_json(), "2015-08-31T07:42:33+10:00") + self.assertEqual(inst.type, "document") + + def testBundle10(self): + inst = self.instantiate_from("location-examples-general.json") + self.assertIsNotNone(inst, "Must have instantiated a Bundle instance") + self.implBundle10(inst) + + js = inst.as_json() + self.assertEqual("Bundle", js["resourceType"]) + inst2 = bundle.Bundle(js) + self.implBundle10(inst2) + + def implBundle10(self, inst): + self.assertEqual(inst.entry[0].fullUrl, "http://hl7.org/fhir/Location/2") + self.assertEqual(inst.entry[0].resource.id, "2") + self.assertEqual(inst.entry[1].fullUrl, "http://hl7.org/fhir/Location/3") + self.assertEqual(inst.entry[1].resource.id, "3") + self.assertEqual(inst.id, "3ad0687e-f477-468c-afd5-fcc2bf897819") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.type, "collection") diff --git a/fhirclient/models/capabilitystatement.py b/fhirclient/models/capabilitystatement.py index 8d3873ffd..8d73c5496 100644 --- a/fhirclient/models/capabilitystatement.py +++ b/fhirclient/models/capabilitystatement.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/CapabilityStatement) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CapabilityStatement) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,8 +11,9 @@ class CapabilityStatement(domainresource.DomainResource): """ A statement of system capabilities. A Capability Statement documents a set of capabilities (behaviors) of a - FHIR Server that may be used as a statement of actual server functionality - or a statement of required or desired server implementation. + FHIR Server for a particular version of FHIR that may be used as a + statement of actual server functionality or a statement of required or + desired server implementation. """ resource_type = "CapabilityStatement" @@ -25,10 +26,6 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.acceptUnknown = None - """ no | extensions | elements | both. - Type `str`. """ - self.contact = None """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ @@ -38,7 +35,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -54,7 +51,7 @@ def __init__(self, jsondict=None, strict=True): Type `bool`. """ self.fhirVersion = None - """ FHIR Version the system uses. + """ FHIR Version the system supports. Type `str`. """ self.format = None @@ -69,6 +66,10 @@ def __init__(self, jsondict=None, strict=True): """ Implementation guides supported. List of `str` items. """ + self.imports = None + """ Canonical URL of another capability statement this adds to. + List of `str` items. """ + self.instantiates = None """ Canonical URL of another capability statement this implements. List of `str` items. """ @@ -93,10 +94,6 @@ def __init__(self, jsondict=None, strict=True): """ Patch formats supported. List of `str` items. """ - self.profile = None - """ Profiles for use cases supported. - List of `FHIRReference` items referencing `StructureDefinition` (represented as `dict` in JSON). """ - self.publisher = None """ Name of the publisher (organization or individual). Type `str`. """ @@ -122,12 +119,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this capability statement (globally - unique). + """ Canonical identifier for this capability statement, represented as + a URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -139,7 +136,6 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(CapabilityStatement, self).elementProperties() js.extend([ - ("acceptUnknown", "acceptUnknown", str, False, None, True), ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, True), @@ -150,13 +146,13 @@ def elementProperties(self): ("format", "format", str, True, None, True), ("implementation", "implementation", CapabilityStatementImplementation, False, None, False), ("implementationGuide", "implementationGuide", str, True, None, False), + ("imports", "imports", str, True, None, False), ("instantiates", "instantiates", str, True, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("kind", "kind", str, False, None, True), ("messaging", "messaging", CapabilityStatementMessaging, True, None, False), ("name", "name", str, False, None, False), ("patchFormat", "patchFormat", str, True, None, False), - ("profile", "profile", fhirreference.FHIRReference, True, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("rest", "rest", CapabilityStatementRest, True, None, False), @@ -197,8 +193,8 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.profile = None - """ Constraint on a resource used in the document. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + """ Constraint on the resources used in the document. + Type `str`. """ super(CapabilityStatementDocument, self).__init__(jsondict=jsondict, strict=strict) @@ -207,7 +203,7 @@ def elementProperties(self): js.extend([ ("documentation", "documentation", str, False, None, False), ("mode", "mode", str, False, None, True), - ("profile", "profile", fhirreference.FHIRReference, False, None, True), + ("profile", "profile", str, False, None, True), ]) return js @@ -230,6 +226,10 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.custodian = None + """ Organization that manages the data. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.description = None """ Describes this specific instance. Type `str`. """ @@ -243,6 +243,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(CapabilityStatementImplementation, self).elementProperties() js.extend([ + ("custodian", "custodian", fhirreference.FHIRReference, False, None, False), ("description", "description", str, False, None, True), ("url", "url", str, False, None, False), ]) @@ -273,10 +274,6 @@ def __init__(self, jsondict=None, strict=True): """ Where messages should be sent. List of `CapabilityStatementMessagingEndpoint` items (represented as `dict` in JSON). """ - self.event = None - """ Declare support for this event. - List of `CapabilityStatementMessagingEvent` items (represented as `dict` in JSON). """ - self.reliableCache = None """ Reliable Message Cache Length (min). Type `int`. """ @@ -292,7 +289,6 @@ def elementProperties(self): js.extend([ ("documentation", "documentation", str, False, None, False), ("endpoint", "endpoint", CapabilityStatementMessagingEndpoint, True, None, False), - ("event", "event", CapabilityStatementMessagingEvent, True, None, False), ("reliableCache", "reliableCache", int, False, None, False), ("supportedMessage", "supportedMessage", CapabilityStatementMessagingSupportedMessage, True, None, False), ]) @@ -335,66 +331,6 @@ def elementProperties(self): return js -class CapabilityStatementMessagingEvent(backboneelement.BackboneElement): - """ Declare support for this event. - - A description of the solution's support for an event at this end-point. - """ - - resource_type = "CapabilityStatementMessagingEvent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.category = None - """ Consequence | Currency | Notification. - Type `str`. """ - - self.code = None - """ Event type. - Type `Coding` (represented as `dict` in JSON). """ - - self.documentation = None - """ Endpoint-specific event documentation. - Type `str`. """ - - self.focus = None - """ Resource that's focus of message. - Type `str`. """ - - self.mode = None - """ sender | receiver. - Type `str`. """ - - self.request = None - """ Profile that describes the request. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ - - self.response = None - """ Profile that describes the response. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ - - super(CapabilityStatementMessagingEvent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementMessagingEvent, self).elementProperties() - js.extend([ - ("category", "category", str, False, None, False), - ("code", "code", coding.Coding, False, None, True), - ("documentation", "documentation", str, False, None, False), - ("focus", "focus", str, False, None, True), - ("mode", "mode", str, False, None, True), - ("request", "request", fhirreference.FHIRReference, False, None, True), - ("response", "response", fhirreference.FHIRReference, False, None, True), - ]) - return js - - class CapabilityStatementMessagingSupportedMessage(backboneelement.BackboneElement): """ Messages supported by this system. @@ -414,7 +350,7 @@ def __init__(self, jsondict=None, strict=True): self.definition = None """ Message supported by this system. - Type `FHIRReference` referencing `MessageDefinition` (represented as `dict` in JSON). """ + Type `str`. """ self.mode = None """ sender | receiver. @@ -425,7 +361,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(CapabilityStatementMessagingSupportedMessage, self).elementProperties() js.extend([ - ("definition", "definition", fhirreference.FHIRReference, False, None, True), + ("definition", "definition", str, False, None, True), ("mode", "mode", str, False, None, True), ]) return js @@ -464,8 +400,8 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.operation = None - """ Definition of an operation or a custom query. - List of `CapabilityStatementRestOperation` items (represented as `dict` in JSON). """ + """ Definition of a system level operation. + List of `CapabilityStatementRestResourceOperation` items (represented as `dict` in JSON). """ self.resource = None """ Resource served on the REST interface. @@ -488,7 +424,7 @@ def elementProperties(self): ("documentation", "documentation", str, False, None, False), ("interaction", "interaction", CapabilityStatementRestInteraction, True, None, False), ("mode", "mode", str, False, None, True), - ("operation", "operation", CapabilityStatementRestOperation, True, None, False), + ("operation", "operation", CapabilityStatementRestResourceOperation, True, None, False), ("resource", "resource", CapabilityStatementRestResource, True, None, False), ("searchParam", "searchParam", CapabilityStatementRestResourceSearchParam, True, None, False), ("security", "security", CapabilityStatementRestSecurity, False, None, False), @@ -531,42 +467,6 @@ def elementProperties(self): return js -class CapabilityStatementRestOperation(backboneelement.BackboneElement): - """ Definition of an operation or a custom query. - - Definition of an operation or a named query together with its parameters - and their meaning and type. - """ - - resource_type = "CapabilityStatementRestOperation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.definition = None - """ The defined operation/query. - Type `FHIRReference` referencing `OperationDefinition` (represented as `dict` in JSON). """ - - self.name = None - """ Name by which the operation/query is invoked. - Type `str`. """ - - super(CapabilityStatementRestOperation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRestOperation, self).elementProperties() - js.extend([ - ("definition", "definition", fhirreference.FHIRReference, False, None, True), - ("name", "name", str, False, None, True), - ]) - return js - - class CapabilityStatementRestResource(backboneelement.BackboneElement): """ Resource served on the REST interface. @@ -609,9 +509,13 @@ def __init__(self, jsondict=None, strict=True): """ What operations are supported?. List of `CapabilityStatementRestResourceInteraction` items (represented as `dict` in JSON). """ + self.operation = None + """ Definition of a resource operation. + List of `CapabilityStatementRestResourceOperation` items (represented as `dict` in JSON). """ + self.profile = None """ Base System profile for all uses of resource. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + Type `str`. """ self.readHistory = None """ Whether vRead can return past versions. @@ -633,6 +537,10 @@ def __init__(self, jsondict=None, strict=True): """ _revinclude values supported by the server. List of `str` items. """ + self.supportedProfile = None + """ Profiles for use cases supported. + List of `str` items. """ + self.type = None """ A resource type that is supported. Type `str`. """ @@ -655,13 +563,15 @@ def elementProperties(self): ("conditionalRead", "conditionalRead", str, False, None, False), ("conditionalUpdate", "conditionalUpdate", bool, False, None, False), ("documentation", "documentation", str, False, None, False), - ("interaction", "interaction", CapabilityStatementRestResourceInteraction, True, None, True), - ("profile", "profile", fhirreference.FHIRReference, False, None, False), + ("interaction", "interaction", CapabilityStatementRestResourceInteraction, True, None, False), + ("operation", "operation", CapabilityStatementRestResourceOperation, True, None, False), + ("profile", "profile", str, False, None, False), ("readHistory", "readHistory", bool, False, None, False), ("referencePolicy", "referencePolicy", str, True, None, False), ("searchInclude", "searchInclude", str, True, None, False), ("searchParam", "searchParam", CapabilityStatementRestResourceSearchParam, True, None, False), ("searchRevInclude", "searchRevInclude", str, True, None, False), + ("supportedProfile", "supportedProfile", str, True, None, False), ("type", "type", str, False, None, True), ("updateCreate", "updateCreate", bool, False, None, False), ("versioning", "versioning", str, False, None, False), @@ -705,6 +615,48 @@ def elementProperties(self): return js +class CapabilityStatementRestResourceOperation(backboneelement.BackboneElement): + """ Definition of a resource operation. + + Definition of an operation or a named query together with its parameters + and their meaning and type. Consult the definition of the operation for + details about how to invoke the operation, and the parameters. + """ + + resource_type = "CapabilityStatementRestResourceOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.definition = None + """ The defined operation/query. + Type `str`. """ + + self.documentation = None + """ Specific details about operation behavior. + Type `str`. """ + + self.name = None + """ Name by which the operation/query is invoked. + Type `str`. """ + + super(CapabilityStatementRestResourceOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CapabilityStatementRestResourceOperation, self).elementProperties() + js.extend([ + ("definition", "definition", str, False, None, True), + ("documentation", "documentation", str, False, None, False), + ("name", "name", str, False, None, True), + ]) + return js + + class CapabilityStatementRestResourceSearchParam(backboneelement.BackboneElement): """ Search parameters supported by implementation. @@ -737,7 +689,7 @@ def __init__(self, jsondict=None, strict=True): self.type = None """ number | date | string | token | reference | composite | quantity | - uri. + uri | special. Type `str`. """ super(CapabilityStatementRestResourceSearchParam, self).__init__(jsondict=jsondict, strict=strict) @@ -770,10 +722,6 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.certificate = None - """ Certificates associated with security profiles. - List of `CapabilityStatementRestSecurityCertificate` items (represented as `dict` in JSON). """ - self.cors = None """ Adds CORS Headers (http://enable-cors.org/). Type `bool`. """ @@ -791,7 +739,6 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(CapabilityStatementRestSecurity, self).elementProperties() js.extend([ - ("certificate", "certificate", CapabilityStatementRestSecurityCertificate, True, None, False), ("cors", "cors", bool, False, None, False), ("description", "description", str, False, None, False), ("service", "service", codeableconcept.CodeableConcept, True, None, False), @@ -799,39 +746,6 @@ def elementProperties(self): return js -class CapabilityStatementRestSecurityCertificate(backboneelement.BackboneElement): - """ Certificates associated with security profiles. - """ - - resource_type = "CapabilityStatementRestSecurityCertificate" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.blob = None - """ Actual certificate. - Type `str`. """ - - self.type = None - """ Mime type for certificates. - Type `str`. """ - - super(CapabilityStatementRestSecurityCertificate, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CapabilityStatementRestSecurityCertificate, self).elementProperties() - js.extend([ - ("blob", "blob", str, False, None, False), - ("type", "type", str, False, None, False), - ]) - return js - - class CapabilityStatementSoftware(backboneelement.BackboneElement): """ Software that is covered by this capability statement. @@ -855,7 +769,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.releaseDate = None - """ Date this version released. + """ Date this version was released. Type `FHIRDate` (represented as `str` in JSON). """ self.version = None diff --git a/fhirclient/models/capabilitystatement_tests.py b/fhirclient/models/capabilitystatement_tests.py index 7e92b47dc..4cfc329c0 100644 --- a/fhirclient/models/capabilitystatement_tests.py +++ b/fhirclient/models/capabilitystatement_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,7 +32,6 @@ def testCapabilityStatement1(self): self.implCapabilityStatement1(inst2) def implCapabilityStatement1(self, inst): - self.assertEqual(inst.acceptUnknown, "both") self.assertEqual(inst.contact[0].name, "System Administrator") self.assertEqual(inst.contact[0].telecom[0].system, "email") self.assertEqual(inst.contact[0].telecom[0].value, "wile@acme.org") @@ -42,8 +41,9 @@ def implCapabilityStatement1(self, inst): self.assertEqual(inst.description, "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface") self.assertEqual(inst.document[0].documentation, "Basic rules for all documents in the EHR system") self.assertEqual(inst.document[0].mode, "consumer") + self.assertEqual(inst.document[0].profile, "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796") self.assertTrue(inst.experimental) - self.assertEqual(inst.fhirVersion, "1.0.0") + self.assertEqual(inst.fhirVersion, "4.0.0") self.assertEqual(inst.format[0], "xml") self.assertEqual(inst.format[1], "json") self.assertEqual(inst.id, "example") @@ -58,14 +58,10 @@ def implCapabilityStatement1(self, inst): self.assertEqual(inst.messaging[0].documentation, "ADT A08 equivalent for external system notifications") self.assertEqual(inst.messaging[0].endpoint[0].address, "mllp:10.1.1.10:9234") self.assertEqual(inst.messaging[0].endpoint[0].protocol.code, "mllp") - self.assertEqual(inst.messaging[0].endpoint[0].protocol.system, "http://hl7.org/fhir/message-transport") - self.assertEqual(inst.messaging[0].event[0].category, "Consequence") - self.assertEqual(inst.messaging[0].event[0].code.code, "admin-notify") - self.assertEqual(inst.messaging[0].event[0].code.system, "http://hl7.org/fhir/message-events") - self.assertEqual(inst.messaging[0].event[0].documentation, "Notification of an update to a patient resource. changing the links is not supported") - self.assertEqual(inst.messaging[0].event[0].focus, "Patient") - self.assertEqual(inst.messaging[0].event[0].mode, "receiver") + self.assertEqual(inst.messaging[0].endpoint[0].protocol.system, "http://terminology.hl7.org/CodeSystem/message-transport") self.assertEqual(inst.messaging[0].reliableCache, 30) + self.assertEqual(inst.messaging[0].supportedMessage[0].definition, "MessageDefinition/example") + self.assertEqual(inst.messaging[0].supportedMessage[0].mode, "receiver") self.assertEqual(inst.name, "ACME-EHR") self.assertEqual(inst.patchFormat[0], "application/xml-patch+xml") self.assertEqual(inst.patchFormat[1], "application/json-patch+json") @@ -88,6 +84,7 @@ def implCapabilityStatement1(self, inst): self.assertEqual(inst.rest[0].resource[0].interaction[3].code, "history-instance") self.assertEqual(inst.rest[0].resource[0].interaction[4].code, "create") self.assertEqual(inst.rest[0].resource[0].interaction[5].code, "history-type") + self.assertEqual(inst.rest[0].resource[0].profile, "http://registry.fhir.org/r4/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416") self.assertTrue(inst.rest[0].resource[0].readHistory) self.assertEqual(inst.rest[0].resource[0].searchInclude[0], "Organization") self.assertEqual(inst.rest[0].resource[0].searchParam[0].definition, "http://hl7.org/fhir/SearchParameter/Patient-identifier") @@ -98,15 +95,14 @@ def implCapabilityStatement1(self, inst): self.assertEqual(inst.rest[0].resource[0].searchParam[1].name, "general-practitioner") self.assertEqual(inst.rest[0].resource[0].searchParam[1].type, "reference") self.assertEqual(inst.rest[0].resource[0].searchRevInclude[0], "Person") + self.assertEqual(inst.rest[0].resource[0].supportedProfile[0], "http://registry.fhir.org/r4/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347") self.assertEqual(inst.rest[0].resource[0].type, "Patient") self.assertFalse(inst.rest[0].resource[0].updateCreate) self.assertEqual(inst.rest[0].resource[0].versioning, "versioned-update") - self.assertEqual(inst.rest[0].security.certificate[0].blob, "IHRoaXMgYmxvYiBpcyBub3QgdmFsaWQ=") - self.assertEqual(inst.rest[0].security.certificate[0].type, "application/jwt") self.assertTrue(inst.rest[0].security.cors) self.assertEqual(inst.rest[0].security.description, "See Smart on FHIR documentation") self.assertEqual(inst.rest[0].security.service[0].coding[0].code, "SMART-on-FHIR") - self.assertEqual(inst.rest[0].security.service[0].coding[0].system, "http://hl7.org/fhir/restful-security-service") + self.assertEqual(inst.rest[0].security.service[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/restful-security-service") self.assertEqual(inst.software.name, "EHR") self.assertEqual(inst.software.releaseDate.date, FHIRDate("2012-01-04").date) self.assertEqual(inst.software.releaseDate.as_json(), "2012-01-04") @@ -116,9 +112,9 @@ def implCapabilityStatement1(self, inst): self.assertEqual(inst.title, "ACME EHR capability statement") self.assertEqual(inst.url, "urn:uuid:68D043B5-9ECF-4559-A57A-396E0D452311") self.assertEqual(inst.useContext[0].code.code, "focus") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "positive") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/variant-state") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://terminology.hl7.org/CodeSystem/variant-state") self.assertEqual(inst.version, "20130510") def testCapabilityStatement2(self): @@ -132,17 +128,19 @@ def testCapabilityStatement2(self): self.implCapabilityStatement2(inst2) def implCapabilityStatement2(self, inst): - self.assertEqual(inst.acceptUnknown, "no") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") self.assertEqual(inst.date.date, FHIRDate("2013-06-18").date) self.assertEqual(inst.date.as_json(), "2013-06-18") self.assertEqual(inst.description, "Prototype Capability Statement for September 2013 Connectathon") - self.assertEqual(inst.fhirVersion, "1.0.0") + self.assertEqual(inst.fhirVersion, "4.0.0") self.assertEqual(inst.format[0], "json") self.assertEqual(inst.format[1], "xml") self.assertEqual(inst.id, "phr") self.assertEqual(inst.kind, "capability") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "PHR Template") self.assertEqual(inst.publisher, "FHIR Project") self.assertEqual(inst.rest[0].documentation, "Protoype server Capability Statement for September 2013 Connectathon") diff --git a/fhirclient/models/careplan.py b/fhirclient/models/careplan.py index d9da33a87..a240d801d 100644 --- a/fhirclient/models/careplan.py +++ b/fhirclient/models/careplan.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -31,44 +31,56 @@ def __init__(self, jsondict=None, strict=True): self.addresses = None """ Health issues this plan addresses. - List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.author = None - """ Who is responsible for contents of the plan. - List of `FHIRReference` items referencing `Patient, Practitioner, RelatedPerson, Organization, CareTeam` (represented as `dict` in JSON). """ + """ Who is the designated responsible party. + Type `FHIRReference` (represented as `dict` in JSON). """ self.basedOn = None - """ Fulfills care plan. - List of `FHIRReference` items referencing `CarePlan` (represented as `dict` in JSON). """ + """ Fulfills CarePlan. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.careTeam = None """ Who's involved in plan?. - List of `FHIRReference` items referencing `CareTeam` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ Type of plan. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.context = None - """ Created in context of. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.contributor = None + """ Who provided the content of the care plan. + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.definition = None - """ Protocol or definition. - List of `FHIRReference` items referencing `PlanDefinition, Questionnaire` (represented as `dict` in JSON). """ + self.created = None + """ Date record was first recorded. + Type `FHIRDate` (represented as `str` in JSON). """ self.description = None """ Summary of nature of plan. Type `str`. """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.goal = None """ Desired outcome of plan. - List of `FHIRReference` items referencing `Goal` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None """ External Ids for this plan. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + self.intent = None """ proposal | plan | order | option. Type `str`. """ @@ -79,7 +91,7 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Part of referenced CarePlan. - List of `FHIRReference` items referencing `CarePlan` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.period = None """ Time period plan covers. @@ -87,7 +99,7 @@ def __init__(self, jsondict=None, strict=True): self.replaces = None """ CarePlan replaced by this CarePlan. - List of `FHIRReference` items referencing `CarePlan` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ draft | active | suspended | completed | entered-in-error | @@ -95,15 +107,15 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.subject = None - """ Who care plan is for. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + """ Who the care plan is for. + Type `FHIRReference` (represented as `dict` in JSON). """ self.supportingInfo = None """ Information considered as part of plan. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.title = None - """ Human-friendly name for the CarePlan. + """ Human-friendly name for the care plan. Type `str`. """ super(CarePlan, self).__init__(jsondict=jsondict, strict=strict) @@ -113,15 +125,18 @@ def elementProperties(self): js.extend([ ("activity", "activity", CarePlanActivity, True, None, False), ("addresses", "addresses", fhirreference.FHIRReference, True, None, False), - ("author", "author", fhirreference.FHIRReference, True, None, False), + ("author", "author", fhirreference.FHIRReference, False, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("careTeam", "careTeam", fhirreference.FHIRReference, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), + ("contributor", "contributor", fhirreference.FHIRReference, True, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("goal", "goal", fhirreference.FHIRReference, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), ("intent", "intent", str, False, None, True), ("note", "note", annotation.Annotation, True, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), @@ -165,7 +180,7 @@ def __init__(self, jsondict=None, strict=True): self.outcomeReference = None """ Appointment, Encounter, Procedure, etc.. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.progress = None """ Comments about the activity status/progress. @@ -173,7 +188,7 @@ def __init__(self, jsondict=None, strict=True): self.reference = None """ Activity details defined in specific resource. - Type `FHIRReference` referencing `Appointment, CommunicationRequest, DeviceRequest, MedicationRequest, NutritionOrder, Task, ProcedureRequest, ReferralRequest, VisionPrescription, RequestGroup` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(CarePlanActivity, self).__init__(jsondict=jsondict, strict=strict) @@ -207,10 +222,6 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.category = None - """ diet | drug | encounter | observation | procedure | supply | other. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.code = None """ Detail type of activity. Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -219,25 +230,37 @@ def __init__(self, jsondict=None, strict=True): """ How to consume/day?. Type `Quantity` (represented as `dict` in JSON). """ - self.definition = None - """ Protocol or definition. - Type `FHIRReference` referencing `PlanDefinition, ActivityDefinition, Questionnaire` (represented as `dict` in JSON). """ - self.description = None """ Extra info describing activity to perform. Type `str`. """ + self.doNotPerform = None + """ If true, activity is prohibiting action. + Type `bool`. """ + self.goal = None """ Goals this activity relates to. - List of `FHIRReference` items referencing `Goal` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + + self.kind = None + """ Kind of resource. + Type `str`. """ self.location = None """ Where it should happen. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.performer = None """ Who will be responsible?. - List of `FHIRReference` items referencing `Practitioner, Organization, RelatedPerson, Patient, CareTeam` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.productCodeableConcept = None """ What is to be administered/supplied. @@ -245,11 +268,7 @@ def __init__(self, jsondict=None, strict=True): self.productReference = None """ What is to be administered/supplied. - Type `FHIRReference` referencing `Medication, Substance` (represented as `dict` in JSON). """ - - self.prohibited = None - """ Do NOT do. - Type `bool`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.quantity = None """ How much to administer/supply/consume. @@ -260,8 +279,8 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None - """ Condition triggering need for activity. - List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + """ Why activity is needed. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.scheduledPeriod = None """ When activity is to occur. @@ -277,29 +296,30 @@ def __init__(self, jsondict=None, strict=True): self.status = None """ not-started | scheduled | in-progress | on-hold | completed | - cancelled | unknown. + cancelled | stopped | unknown | entered-in-error. Type `str`. """ self.statusReason = None """ Reason for current status. - Type `str`. """ + Type `CodeableConcept` (represented as `dict` in JSON). """ super(CarePlanActivityDetail, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(CarePlanActivityDetail, self).elementProperties() js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("dailyAmount", "dailyAmount", quantity.Quantity, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, False, None, False), ("description", "description", str, False, None, False), + ("doNotPerform", "doNotPerform", bool, False, None, False), ("goal", "goal", fhirreference.FHIRReference, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), + ("kind", "kind", str, False, None, False), ("location", "location", fhirreference.FHIRReference, False, None, False), ("performer", "performer", fhirreference.FHIRReference, True, None, False), ("productCodeableConcept", "productCodeableConcept", codeableconcept.CodeableConcept, False, "product", False), ("productReference", "productReference", fhirreference.FHIRReference, False, "product", False), - ("prohibited", "prohibited", bool, False, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), @@ -307,7 +327,7 @@ def elementProperties(self): ("scheduledString", "scheduledString", str, False, "scheduled", False), ("scheduledTiming", "scheduledTiming", timing.Timing, False, "scheduled", False), ("status", "status", str, False, None, True), - ("statusReason", "statusReason", str, False, None, False), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -321,6 +341,10 @@ def elementProperties(self): from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] try: from . import fhirreference except ImportError: diff --git a/fhirclient/models/careplan_tests.py b/fhirclient/models/careplan_tests.py index 62b5f5334..53e03c136 100644 --- a/fhirclient/models/careplan_tests.py +++ b/fhirclient/models/careplan_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return careplan.CarePlan(js) def testCarePlan1(self): - inst = self.instantiate_from("careplan-example-f001-heart.json") + inst = self.instantiate_from("careplan-example-f002-lung.json") self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") self.implCarePlan1(inst) @@ -32,30 +32,32 @@ def testCarePlan1(self): self.implCarePlan1(inst2) def implCarePlan1(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "procedure") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") - self.assertEqual(inst.activity[0].detail.code.coding[0].code, "64915003") - self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Operation on heart") + self.assertEqual(inst.activity[0].detail.code.coding[0].code, "359615001") + self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Partial lobectomy of lung") self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") - self.assertTrue(inst.activity[0].detail.prohibited) - self.assertEqual(inst.activity[0].detail.scheduledString, "2011-06-27T09:30:10+01:00") + self.assertTrue(inst.activity[0].detail.doNotPerform) + self.assertEqual(inst.activity[0].detail.kind, "ServiceRequest") + self.assertEqual(inst.activity[0].detail.scheduledString, "2011-07-07T09:30:10+01:00") self.assertEqual(inst.activity[0].detail.status, "completed") self.assertEqual(inst.contained[0].id, "careteam") self.assertEqual(inst.contained[1].id, "goal") - self.assertEqual(inst.id, "f001") + self.assertEqual(inst.id, "f002") self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/careplans") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "CP2903") + self.assertEqual(inst.identifier[0].value, "CP2934") self.assertEqual(inst.intent, "plan") - self.assertEqual(inst.period.end.date, FHIRDate("2011-06-27").date) - self.assertEqual(inst.period.end.as_json(), "2011-06-27") - self.assertEqual(inst.period.start.date, FHIRDate("2011-06-26").date) - self.assertEqual(inst.period.start.as_json(), "2011-06-26") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.period.end.date, FHIRDate("2013-07-07").date) + self.assertEqual(inst.period.end.as_json(), "2013-07-07") + self.assertEqual(inst.period.start.date, FHIRDate("2011-07-06").date) + self.assertEqual(inst.period.start.as_json(), "2011-07-06") self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") def testCarePlan2(self): - inst = self.instantiate_from("careplan-example-f002-lung.json") + inst = self.instantiate_from("careplan-example-f202-malignancy.json") self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") self.implCarePlan2(inst) @@ -65,30 +67,28 @@ def testCarePlan2(self): self.implCarePlan2(inst2) def implCarePlan2(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "procedure") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") - self.assertEqual(inst.activity[0].detail.code.coding[0].code, "359615001") - self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Partial lobectomy of lung") + self.assertEqual(inst.activity[0].detail.code.coding[0].code, "367336001") + self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Chemotherapy") self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") - self.assertTrue(inst.activity[0].detail.prohibited) - self.assertEqual(inst.activity[0].detail.scheduledString, "2011-07-07T09:30:10+01:00") - self.assertEqual(inst.activity[0].detail.status, "completed") - self.assertEqual(inst.contained[0].id, "careteam") - self.assertEqual(inst.contained[1].id, "goal") - self.assertEqual(inst.id, "f002") - self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/careplans") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "CP2934") + self.assertFalse(inst.activity[0].detail.doNotPerform) + self.assertEqual(inst.activity[0].detail.kind, "ServiceRequest") + self.assertEqual(inst.activity[0].detail.status, "in-progress") + self.assertEqual(inst.contained[0].id, "doce") + self.assertEqual(inst.contained[1].id, "cisp") + self.assertEqual(inst.contained[2].id, "fluo") + self.assertEqual(inst.contained[3].id, "tpf") + self.assertEqual(inst.contained[4].id, "careteam") + self.assertEqual(inst.contained[5].id, "goal") + self.assertEqual(inst.id, "f202") self.assertEqual(inst.intent, "plan") - self.assertEqual(inst.period.end.date, FHIRDate("2013-07-07").date) - self.assertEqual(inst.period.end.as_json(), "2013-07-07") - self.assertEqual(inst.period.start.date, FHIRDate("2011-07-06").date) - self.assertEqual(inst.period.start.as_json(), "2011-07-06") - self.assertEqual(inst.status, "completed") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testCarePlan3(self): - inst = self.instantiate_from("careplan-example-f003-pharynx.json") + inst = self.instantiate_from("careplan-example-obesity-narrative.json") self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") self.implCarePlan3(inst) @@ -98,30 +98,16 @@ def testCarePlan3(self): self.implCarePlan3(inst2) def implCarePlan3(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "procedure") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") - self.assertEqual(inst.activity[0].detail.code.coding[0].code, "172960003") - self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Incision of retropharyngeal abscess") - self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") - self.assertTrue(inst.activity[0].detail.prohibited) - self.assertEqual(inst.activity[0].detail.scheduledString, "2011-06-27T09:30:10+01:00") - self.assertEqual(inst.activity[0].detail.status, "completed") - self.assertEqual(inst.contained[0].id, "careteam") - self.assertEqual(inst.contained[1].id, "goal") - self.assertEqual(inst.id, "f003") - self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/careplans") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "CP3953") + self.assertEqual(inst.id, "obesity-narrative") self.assertEqual(inst.intent, "plan") - self.assertEqual(inst.period.end.date, FHIRDate("2013-03-08T09:30:10+01:00").date) - self.assertEqual(inst.period.end.as_json(), "2013-03-08T09:30:10+01:00") - self.assertEqual(inst.period.start.date, FHIRDate("2013-03-08T09:00:10+01:00").date) - self.assertEqual(inst.period.start.as_json(), "2013-03-08T09:00:10+01:00") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "additional") def testCarePlan4(self): - inst = self.instantiate_from("careplan-example-f201-renal.json") + inst = self.instantiate_from("careplan-example.json") self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") self.implCarePlan4(inst) @@ -131,8 +117,49 @@ def testCarePlan4(self): self.implCarePlan4(inst2) def implCarePlan4(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "diet") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") + self.assertEqual(inst.activity[0].detail.code.coding[0].code, "3141-9") + self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Weight Measured") + self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.activity[0].detail.code.coding[1].code, "27113001") + self.assertEqual(inst.activity[0].detail.code.coding[1].display, "Body weight") + self.assertEqual(inst.activity[0].detail.code.coding[1].system, "http://snomed.info/sct") + self.assertFalse(inst.activity[0].detail.doNotPerform) + self.assertEqual(inst.activity[0].detail.scheduledTiming.repeat.frequency, 1) + self.assertEqual(inst.activity[0].detail.scheduledTiming.repeat.period, 1) + self.assertEqual(inst.activity[0].detail.scheduledTiming.repeat.periodUnit, "d") + self.assertEqual(inst.activity[0].detail.status, "completed") + self.assertEqual(inst.activity[0].detail.statusReason.text, "Achieved weight loss to mitigate diabetes risk.") + self.assertEqual(inst.activity[0].outcomeCodeableConcept[0].coding[0].code, "161832001") + self.assertEqual(inst.activity[0].outcomeCodeableConcept[0].coding[0].display, "Progressive weight loss") + self.assertEqual(inst.activity[0].outcomeCodeableConcept[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].text, "Weight management plan") + self.assertEqual(inst.contained[0].id, "p1") + self.assertEqual(inst.created.date, FHIRDate("2016-01-01").date) + self.assertEqual(inst.created.as_json(), "2016-01-01") + self.assertEqual(inst.description, "Manage obesity and weight loss") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.instantiatesUri[0], "http://example.org/protocol-for-obesity") + self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.period.end.date, FHIRDate("2017-06-01").date) + self.assertEqual(inst.period.end.as_json(), "2017-06-01") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "additional") + + def testCarePlan5(self): + inst = self.instantiate_from("careplan-example-f201-renal.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan5(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan5(inst2) + + def implCarePlan5(self, inst): self.assertEqual(inst.activity[0].detail.code.coding[0].code, "284093001") self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Potassium supplementation") self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") @@ -140,20 +167,23 @@ def implCarePlan4(self, inst): self.assertEqual(inst.activity[0].detail.dailyAmount.system, "http://snomed.info/sct") self.assertEqual(inst.activity[0].detail.dailyAmount.unit, "mmol") self.assertEqual(inst.activity[0].detail.dailyAmount.value, 80) - self.assertFalse(inst.activity[0].detail.prohibited) + self.assertFalse(inst.activity[0].detail.doNotPerform) + self.assertEqual(inst.activity[0].detail.kind, "NutritionOrder") self.assertEqual(inst.activity[0].detail.scheduledString, "daily") self.assertEqual(inst.activity[0].detail.status, "completed") - self.assertEqual(inst.activity[1].detail.category.coding[0].code, "observation") - self.assertEqual(inst.activity[1].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[1].detail.code.coding[0].code, "306005") self.assertEqual(inst.activity[1].detail.code.coding[0].display, "Echography of kidney") self.assertEqual(inst.activity[1].detail.code.coding[0].system, "http://snomed.info/sct") - self.assertFalse(inst.activity[1].detail.prohibited) + self.assertFalse(inst.activity[1].detail.doNotPerform) + self.assertEqual(inst.activity[1].detail.kind, "ServiceRequest") self.assertEqual(inst.activity[1].detail.status, "completed") self.assertEqual(inst.contained[0].id, "careteam") self.assertEqual(inst.contained[1].id, "goal") self.assertEqual(inst.id, "f201") self.assertEqual(inst.intent, "proposal") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2013-03-13").date) self.assertEqual(inst.period.end.as_json(), "2013-03-13") self.assertEqual(inst.period.start.date, FHIRDate("2013-03-11").date) @@ -161,37 +191,8 @@ def implCarePlan4(self, inst): self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") - def testCarePlan5(self): - inst = self.instantiate_from("careplan-example-f202-malignancy.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan5(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan5(inst2) - - def implCarePlan5(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "procedure") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") - self.assertEqual(inst.activity[0].detail.code.coding[0].code, "367336001") - self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Chemotherapy") - self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") - self.assertFalse(inst.activity[0].detail.prohibited) - self.assertEqual(inst.activity[0].detail.status, "in-progress") - self.assertEqual(inst.contained[0].id, "doce") - self.assertEqual(inst.contained[1].id, "cisp") - self.assertEqual(inst.contained[2].id, "fluo") - self.assertEqual(inst.contained[3].id, "tpf") - self.assertEqual(inst.contained[4].id, "careteam") - self.assertEqual(inst.contained[5].id, "goal") - self.assertEqual(inst.id, "f202") - self.assertEqual(inst.intent, "plan") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - def testCarePlan6(self): - inst = self.instantiate_from("careplan-example-f203-sepsis.json") + inst = self.instantiate_from("careplan-example-GPVisit.json") self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") self.implCarePlan6(inst) @@ -201,117 +202,82 @@ def testCarePlan6(self): self.implCarePlan6(inst2) def implCarePlan6(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "observation") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") - self.assertEqual(inst.activity[0].detail.code.coding[0].code, "241541005") - self.assertEqual(inst.activity[0].detail.code.coding[0].display, "High resolution computed tomography of lungs") - self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") - self.assertFalse(inst.activity[0].detail.prohibited) - self.assertEqual(inst.activity[0].detail.status, "not-started") - self.assertEqual(inst.contained[0].id, "careteam") - self.assertEqual(inst.contained[1].id, "goal") - self.assertEqual(inst.id, "f203") - self.assertEqual(inst.intent, "plan") - self.assertEqual(inst.period.end.date, FHIRDate("2013-04-21").date) - self.assertEqual(inst.period.end.as_json(), "2013-04-21") - self.assertEqual(inst.period.start.date, FHIRDate("2013-04-14").date) - self.assertEqual(inst.period.start.as_json(), "2013-04-14") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testCarePlan7(self): - inst = self.instantiate_from("careplan-example-GPVisit.json") - self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan7(inst) - - js = inst.as_json() - self.assertEqual("CarePlan", js["resourceType"]) - inst2 = careplan.CarePlan(js) - self.implCarePlan7(inst2) - - def implCarePlan7(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "encounter") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[0].detail.code.coding[0].code, "nursecon") self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://example.org/local") self.assertEqual(inst.activity[0].detail.code.text, "Nurse Consultation") - self.assertFalse(inst.activity[0].detail.prohibited) + self.assertFalse(inst.activity[0].detail.doNotPerform) + self.assertEqual(inst.activity[0].detail.kind, "Appointment") self.assertEqual(inst.activity[0].detail.scheduledPeriod.end.date, FHIRDate("2013-01-01T10:50:00+00:00").date) self.assertEqual(inst.activity[0].detail.scheduledPeriod.end.as_json(), "2013-01-01T10:50:00+00:00") self.assertEqual(inst.activity[0].detail.scheduledPeriod.start.date, FHIRDate("2013-01-01T10:38:00+00:00").date) self.assertEqual(inst.activity[0].detail.scheduledPeriod.start.as_json(), "2013-01-01T10:38:00+00:00") self.assertEqual(inst.activity[0].detail.status, "completed") - self.assertEqual(inst.activity[1].detail.category.coding[0].code, "encounter") - self.assertEqual(inst.activity[1].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[1].detail.code.coding[0].code, "doccon") self.assertEqual(inst.activity[1].detail.code.coding[0].system, "http://example.org/local") self.assertEqual(inst.activity[1].detail.code.text, "Doctor Consultation") - self.assertFalse(inst.activity[1].detail.prohibited) + self.assertFalse(inst.activity[1].detail.doNotPerform) + self.assertEqual(inst.activity[1].detail.kind, "Appointment") self.assertEqual(inst.activity[1].detail.status, "scheduled") self.assertEqual(inst.contained[0].id, "p1") self.assertEqual(inst.contained[1].id, "careteam") self.assertEqual(inst.contained[2].id, "goal") self.assertEqual(inst.id, "gpvisit") self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.start.date, FHIRDate("2013-01-01T10:30:00+00:00").date) self.assertEqual(inst.period.start.as_json(), "2013-01-01T10:30:00+00:00") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "additional") - def testCarePlan8(self): + def testCarePlan7(self): inst = self.instantiate_from("careplan-example-integrated.json") self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") - self.implCarePlan8(inst) + self.implCarePlan7(inst) js = inst.as_json() self.assertEqual("CarePlan", js["resourceType"]) inst2 = careplan.CarePlan(js) - self.implCarePlan8(inst2) + self.implCarePlan7(inst2) - def implCarePlan8(self, inst): - self.assertEqual(inst.activity[0].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[0].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") + def implCarePlan7(self, inst): self.assertEqual(inst.activity[0].detail.description, "Eve will review photos of high and low density foods and share with her parents") + self.assertFalse(inst.activity[0].detail.doNotPerform) self.assertEqual(inst.activity[0].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[0].detail.extension[0].valueDate.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[0].detail.extension[0].valueDate.as_json(), "2012-09-10") - self.assertFalse(inst.activity[0].detail.prohibited) self.assertEqual(inst.activity[0].detail.scheduledPeriod.start.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[0].detail.scheduledPeriod.start.as_json(), "2012-09-10") self.assertEqual(inst.activity[0].detail.status, "not-started") self.assertEqual(inst.activity[0].progress[0].text, "Eve eats one meal a day with her parents") self.assertEqual(inst.activity[0].progress[0].time.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[0].progress[0].time.as_json(), "2012-09-10") - self.assertEqual(inst.activity[1].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[1].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[1].detail.description, "Eve will ask her dad to asist her to put the head of her bed on blocks") + self.assertFalse(inst.activity[1].detail.doNotPerform) self.assertEqual(inst.activity[1].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[1].detail.extension[0].valueDate.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[1].detail.extension[0].valueDate.as_json(), "2012-09-10") - self.assertFalse(inst.activity[1].detail.prohibited) + self.assertEqual(inst.activity[1].detail.kind, "CommunicationRequest") self.assertEqual(inst.activity[1].detail.scheduledPeriod.start.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[1].detail.scheduledPeriod.start.as_json(), "2012-09-10") self.assertEqual(inst.activity[1].detail.status, "not-started") self.assertEqual(inst.activity[1].progress[0].text, "Eve will sleep in her bed more often than the couch") self.assertEqual(inst.activity[1].progress[0].time.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[1].progress[0].time.as_json(), "2012-09-10") - self.assertEqual(inst.activity[2].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[2].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[2].detail.description, "Eve will reduce her intake of coffee and chocolate") + self.assertFalse(inst.activity[2].detail.doNotPerform) self.assertEqual(inst.activity[2].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[2].detail.extension[0].valueDate.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[2].detail.extension[0].valueDate.as_json(), "2012-09-10") - self.assertFalse(inst.activity[2].detail.prohibited) self.assertEqual(inst.activity[2].detail.scheduledPeriod.start.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[2].detail.scheduledPeriod.start.as_json(), "2012-09-10") self.assertEqual(inst.activity[2].detail.status, "in-progress") - self.assertEqual(inst.activity[3].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[3].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[3].detail.description, "Eve will walk her friend's dog up and down a big hill 15-30 minutes 3 days a week") + self.assertFalse(inst.activity[3].detail.doNotPerform) self.assertEqual(inst.activity[3].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[3].detail.extension[0].valueDate.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[3].detail.extension[0].valueDate.as_json(), "2012-09-10") - self.assertFalse(inst.activity[3].detail.prohibited) self.assertEqual(inst.activity[3].detail.scheduledPeriod.start.date, FHIRDate("2012-08-27").date) self.assertEqual(inst.activity[3].detail.scheduledPeriod.start.as_json(), "2012-08-27") self.assertEqual(inst.activity[3].detail.status, "in-progress") @@ -321,13 +287,11 @@ def implCarePlan8(self, inst): self.assertEqual(inst.activity[3].progress[1].text, "Eve is still walking the dogs.") self.assertEqual(inst.activity[3].progress[1].time.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[3].progress[1].time.as_json(), "2012-09-10") - self.assertEqual(inst.activity[4].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[4].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[4].detail.description, "Eve will walk 3 blocks to her parents house twice a week") + self.assertFalse(inst.activity[4].detail.doNotPerform) self.assertEqual(inst.activity[4].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[4].detail.extension[0].valueDate.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[4].detail.extension[0].valueDate.as_json(), "2012-09-10") - self.assertFalse(inst.activity[4].detail.prohibited) self.assertEqual(inst.activity[4].detail.scheduledPeriod.start.date, FHIRDate("2012-07-23").date) self.assertEqual(inst.activity[4].detail.scheduledPeriod.start.as_json(), "2012-07-23") self.assertEqual(inst.activity[4].detail.status, "in-progress") @@ -337,23 +301,19 @@ def implCarePlan8(self, inst): self.assertEqual(inst.activity[4].progress[1].text, "Eve did not walk to her parents the last week, but has plans to start again") self.assertEqual(inst.activity[4].progress[1].time.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[4].progress[1].time.as_json(), "2012-09-10") - self.assertEqual(inst.activity[5].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[5].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") - self.assertEqual(inst.activity[5].detail.description, "Eve will us a calendar to check off after medications are taken") + self.assertEqual(inst.activity[5].detail.description, "Eve will use a calendar to check off after medications are taken") + self.assertFalse(inst.activity[5].detail.doNotPerform) self.assertEqual(inst.activity[5].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[5].detail.extension[0].valueDate.date, FHIRDate("2012-08-13").date) self.assertEqual(inst.activity[5].detail.extension[0].valueDate.as_json(), "2012-08-13") - self.assertFalse(inst.activity[5].detail.prohibited) self.assertEqual(inst.activity[5].detail.scheduledPeriod.start.date, FHIRDate("2012-07-23").date) self.assertEqual(inst.activity[5].detail.scheduledPeriod.start.as_json(), "2012-07-23") self.assertEqual(inst.activity[5].detail.status, "in-progress") - self.assertEqual(inst.activity[6].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[6].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[6].detail.description, "Eve will use her lights MWF after her shower for 3 minutes") + self.assertFalse(inst.activity[6].detail.doNotPerform) self.assertEqual(inst.activity[6].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[6].detail.extension[0].valueDate.date, FHIRDate("2012-08-27").date) self.assertEqual(inst.activity[6].detail.extension[0].valueDate.as_json(), "2012-08-27") - self.assertFalse(inst.activity[6].detail.prohibited) self.assertEqual(inst.activity[6].detail.scheduledPeriod.start.date, FHIRDate("2012-07-23").date) self.assertEqual(inst.activity[6].detail.scheduledPeriod.start.as_json(), "2012-07-23") self.assertEqual(inst.activity[6].detail.status, "in-progress") @@ -363,26 +323,22 @@ def implCarePlan8(self, inst): self.assertEqual(inst.activity[6].progress[1].text, "Since her skin is improved Eve has not been using the light treatment as often, maybe once a week. She would like to increase to 3 times a week again") self.assertEqual(inst.activity[6].progress[1].time.date, FHIRDate("2012-08-27").date) self.assertEqual(inst.activity[6].progress[1].time.as_json(), "2012-08-27") - self.assertEqual(inst.activity[7].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[7].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[7].detail.description, "Eve will use a calendar of a chart to help her remember when to take her medications") + self.assertFalse(inst.activity[7].detail.doNotPerform) self.assertEqual(inst.activity[7].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[7].detail.extension[0].valueDate.date, FHIRDate("2012-09-10").date) self.assertEqual(inst.activity[7].detail.extension[0].valueDate.as_json(), "2012-09-10") - self.assertFalse(inst.activity[7].detail.prohibited) self.assertEqual(inst.activity[7].detail.scheduledPeriod.start.date, FHIRDate("2012-07-10").date) self.assertEqual(inst.activity[7].detail.scheduledPeriod.start.as_json(), "2012-07-10") self.assertEqual(inst.activity[7].detail.status, "in-progress") self.assertEqual(inst.activity[7].progress[0].text, "Eve created a chart as a reminer to take the medications that do not fit in her pill box") self.assertEqual(inst.activity[7].progress[0].time.date, FHIRDate("2012-07-23").date) self.assertEqual(inst.activity[7].progress[0].time.as_json(), "2012-07-23") - self.assertEqual(inst.activity[8].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[8].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[8].detail.description, "Eve will start using stretch bands and one step 2 days a week Mon/Wed 6-7am and maybe Friday afternoon") + self.assertFalse(inst.activity[8].detail.doNotPerform) self.assertEqual(inst.activity[8].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[8].detail.extension[0].valueDate.date, FHIRDate("2012-08-23").date) self.assertEqual(inst.activity[8].detail.extension[0].valueDate.as_json(), "2012-08-23") - self.assertFalse(inst.activity[8].detail.prohibited) self.assertEqual(inst.activity[8].detail.scheduledPeriod.start.date, FHIRDate("2012-07-23").date) self.assertEqual(inst.activity[8].detail.scheduledPeriod.start.as_json(), "2012-07-23") self.assertEqual(inst.activity[8].detail.status, "on-hold") @@ -392,13 +348,11 @@ def implCarePlan8(self, inst): self.assertEqual(inst.activity[8].progress[1].text, "Eve prefers to focus on walking at this time") self.assertEqual(inst.activity[8].progress[1].time.date, FHIRDate("2012-08-13").date) self.assertEqual(inst.activity[8].progress[1].time.as_json(), "2012-08-13") - self.assertEqual(inst.activity[9].detail.category.coding[0].code, "other") - self.assertEqual(inst.activity[9].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[9].detail.description, "Eve will match a printed medication worksheet with the medication bottles at home") + self.assertFalse(inst.activity[9].detail.doNotPerform) self.assertEqual(inst.activity[9].detail.extension[0].url, "http://example.org/fhir/StructureDefinition/RevisionDate") self.assertEqual(inst.activity[9].detail.extension[0].valueDate.date, FHIRDate("2012-07-23").date) self.assertEqual(inst.activity[9].detail.extension[0].valueDate.as_json(), "2012-07-23") - self.assertFalse(inst.activity[9].detail.prohibited) self.assertEqual(inst.activity[9].detail.scheduledPeriod.start.date, FHIRDate("2012-07-10").date) self.assertEqual(inst.activity[9].detail.scheduledPeriod.start.as_json(), "2012-07-10") self.assertEqual(inst.activity[9].detail.status, "completed") @@ -412,12 +366,50 @@ def implCarePlan8(self, inst): self.assertEqual(inst.contained[7].id, "g5") self.assertEqual(inst.id, "integrate") self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "Patient family is not ready to commit to goal setting at this time. Goal setting will be addressed in the future") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") + def testCarePlan8(self): + inst = self.instantiate_from("careplan-example-f003-pharynx.json") + self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") + self.implCarePlan8(inst) + + js = inst.as_json() + self.assertEqual("CarePlan", js["resourceType"]) + inst2 = careplan.CarePlan(js) + self.implCarePlan8(inst2) + + def implCarePlan8(self, inst): + self.assertEqual(inst.activity[0].detail.code.coding[0].code, "172960003") + self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Incision of retropharyngeal abscess") + self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") + self.assertTrue(inst.activity[0].detail.doNotPerform) + self.assertEqual(inst.activity[0].detail.kind, "ServiceRequest") + self.assertEqual(inst.activity[0].detail.scheduledString, "2011-06-27T09:30:10+01:00") + self.assertEqual(inst.activity[0].detail.status, "completed") + self.assertEqual(inst.contained[0].id, "careteam") + self.assertEqual(inst.contained[1].id, "goal") + self.assertEqual(inst.id, "f003") + self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/careplans") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "CP3953") + self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.period.end.date, FHIRDate("2013-03-08T09:30:10+01:00").date) + self.assertEqual(inst.period.end.as_json(), "2013-03-08T09:30:10+01:00") + self.assertEqual(inst.period.start.date, FHIRDate("2013-03-08T09:00:10+01:00").date) + self.assertEqual(inst.period.start.as_json(), "2013-03-08T09:00:10+01:00") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + def testCarePlan9(self): - inst = self.instantiate_from("careplan-example-obesity-narrative.json") + inst = self.instantiate_from("careplan-example-f001-heart.json") self.assertIsNotNone(inst, "Must have instantiated a CarePlan instance") self.implCarePlan9(inst) @@ -427,10 +419,29 @@ def testCarePlan9(self): self.implCarePlan9(inst2) def implCarePlan9(self, inst): - self.assertEqual(inst.id, "obesity-narrative") + self.assertEqual(inst.activity[0].detail.code.coding[0].code, "64915003") + self.assertEqual(inst.activity[0].detail.code.coding[0].display, "Operation on heart") + self.assertEqual(inst.activity[0].detail.code.coding[0].system, "http://snomed.info/sct") + self.assertTrue(inst.activity[0].detail.doNotPerform) + self.assertEqual(inst.activity[0].detail.kind, "ServiceRequest") + self.assertEqual(inst.activity[0].detail.scheduledString, "2011-06-27T09:30:10+01:00") + self.assertEqual(inst.activity[0].detail.status, "completed") + self.assertEqual(inst.contained[0].id, "careteam") + self.assertEqual(inst.contained[1].id, "goal") + self.assertEqual(inst.id, "f001") + self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/careplans") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "CP2903") self.assertEqual(inst.intent, "plan") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.period.end.date, FHIRDate("2011-06-27").date) + self.assertEqual(inst.period.end.as_json(), "2011-06-27") + self.assertEqual(inst.period.start.date, FHIRDate("2011-06-26").date) + self.assertEqual(inst.period.start.as_json(), "2011-06-26") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") def testCarePlan10(self): inst = self.instantiate_from("careplan-example-pregnancy.json") @@ -443,13 +454,12 @@ def testCarePlan10(self): self.implCarePlan10(inst2) def implCarePlan10(self, inst): - self.assertEqual(inst.activity[1].detail.category.coding[0].code, "encounter") - self.assertEqual(inst.activity[1].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[1].detail.code.coding[0].code, "1an") self.assertEqual(inst.activity[1].detail.code.coding[0].system, "http://example.org/mySystem") self.assertEqual(inst.activity[1].detail.code.text, "First Antenatal encounter") self.assertEqual(inst.activity[1].detail.description, "The first antenatal encounter. This is where a detailed physical examination is performed. and the pregnanacy discussed with the mother-to-be.") - self.assertFalse(inst.activity[1].detail.prohibited) + self.assertFalse(inst.activity[1].detail.doNotPerform) + self.assertEqual(inst.activity[1].detail.kind, "Appointment") self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.end.date, FHIRDate("2013-02-28").date) self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.end.as_json(), "2013-02-28") self.assertEqual(inst.activity[1].detail.scheduledTiming.repeat.boundsPeriod.start.date, FHIRDate("2013-02-14").date) @@ -457,25 +467,23 @@ def implCarePlan10(self, inst): self.assertEqual(inst.activity[1].detail.status, "scheduled") self.assertEqual(inst.activity[1].extension[0].url, "http://example.org/fhir/StructureDefinition/careplan#andetails") self.assertEqual(inst.activity[1].extension[0].valueUri, "http://orionhealth.com/fhir/careplan/1andetails") - self.assertEqual(inst.activity[2].detail.category.coding[0].code, "encounter") - self.assertEqual(inst.activity[2].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[2].detail.code.coding[0].code, "an") self.assertEqual(inst.activity[2].detail.code.coding[0].system, "http://example.org/mySystem") self.assertEqual(inst.activity[2].detail.code.text, "Follow-up Antenatal encounter") self.assertEqual(inst.activity[2].detail.description, "The second antenatal encounter. Discuss any issues that arose from the first antenatal encounter") - self.assertFalse(inst.activity[2].detail.prohibited) + self.assertFalse(inst.activity[2].detail.doNotPerform) + self.assertEqual(inst.activity[2].detail.kind, "Appointment") self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.end.date, FHIRDate("2013-03-14").date) self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.end.as_json(), "2013-03-14") self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.start.date, FHIRDate("2013-03-01").date) self.assertEqual(inst.activity[2].detail.scheduledTiming.repeat.boundsPeriod.start.as_json(), "2013-03-01") self.assertEqual(inst.activity[2].detail.status, "not-started") - self.assertEqual(inst.activity[3].detail.category.coding[0].code, "encounter") - self.assertEqual(inst.activity[3].detail.category.coding[0].system, "http://hl7.org/fhir/care-plan-activity-category") self.assertEqual(inst.activity[3].detail.code.coding[0].code, "del") self.assertEqual(inst.activity[3].detail.code.coding[0].system, "http://example.org/mySystem") self.assertEqual(inst.activity[3].detail.code.text, "Delivery") self.assertEqual(inst.activity[3].detail.description, "The delivery.") - self.assertFalse(inst.activity[3].detail.prohibited) + self.assertFalse(inst.activity[3].detail.doNotPerform) + self.assertEqual(inst.activity[3].detail.kind, "Appointment") self.assertEqual(inst.activity[3].detail.scheduledTiming.repeat.boundsPeriod.end.date, FHIRDate("2013-09-14").date) self.assertEqual(inst.activity[3].detail.scheduledTiming.repeat.boundsPeriod.end.as_json(), "2013-09-14") self.assertEqual(inst.activity[3].detail.scheduledTiming.repeat.boundsPeriod.start.date, FHIRDate("2013-09-01").date) @@ -491,6 +499,9 @@ def implCarePlan10(self, inst): self.assertEqual(inst.extension[0].valueDateTime.as_json(), "2013-01-01") self.assertEqual(inst.id, "preg") self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2013-10-01").date) self.assertEqual(inst.period.end.as_json(), "2013-10-01") self.assertEqual(inst.period.start.date, FHIRDate("2013-01-01").date) diff --git a/fhirclient/models/careteam.py b/fhirclient/models/careteam.py index f078cf670..43bb8b9a4 100644 --- a/fhirclient/models/careteam.py +++ b/fhirclient/models/careteam.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/CareTeam) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CareTeam) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -29,9 +29,9 @@ def __init__(self, jsondict=None, strict=True): """ Type of team. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.context = None - """ Encounter or episode associated with CareTeam. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ External Ids for this team. @@ -39,7 +39,7 @@ def __init__(self, jsondict=None, strict=True): self.managingOrganization = None """ Organization responsible for the care team. - List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.name = None """ Name of the team, such as crisis assessment team. @@ -63,7 +63,7 @@ def __init__(self, jsondict=None, strict=True): self.reasonReference = None """ Why the care team exists. - List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ proposed | active | suspended | inactive | entered-in-error. @@ -71,7 +71,11 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Who care team is for. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.telecom = None + """ A contact detail for the care team (that applies to all members). + List of `ContactPoint` items (represented as `dict` in JSON). """ super(CareTeam, self).__init__(jsondict=jsondict, strict=strict) @@ -79,7 +83,7 @@ def elementProperties(self): js = super(CareTeam, self).elementProperties() js.extend([ ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, True, None, False), ("name", "name", str, False, None, False), @@ -90,6 +94,7 @@ def elementProperties(self): ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), ]) return js @@ -115,11 +120,11 @@ def __init__(self, jsondict=None, strict=True): self.member = None """ Who is involved. - Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Organization, CareTeam` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.onBehalfOf = None """ Organization of the practitioner. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Time period of participant. @@ -127,7 +132,7 @@ def __init__(self, jsondict=None, strict=True): self.role = None """ Type of involvement. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ super(CareTeamParticipant, self).__init__(jsondict=jsondict, strict=strict) @@ -137,7 +142,7 @@ def elementProperties(self): ("member", "member", fhirreference.FHIRReference, False, None, False), ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), ("period", "period", period.Period, False, None, False), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, True, None, False), ]) return js @@ -151,6 +156,10 @@ def elementProperties(self): from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] try: from . import fhirreference except ImportError: diff --git a/fhirclient/models/careteam_tests.py b/fhirclient/models/careteam_tests.py index 4950dba0d..7a1aa33d2 100644 --- a/fhirclient/models/careteam_tests.py +++ b/fhirclient/models/careteam_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,16 +32,20 @@ def testCareTeam1(self): self.implCareTeam1(inst2) def implCareTeam1(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "encounter") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/care-team-category") + self.assertEqual(inst.category[0].coding[0].code, "LA27976-2") + self.assertEqual(inst.category[0].coding[0].display, "Encounter-focused care team") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.contained[0].id, "pr1") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "Peter James Charlmers Care Plan for Inpatient Encounter") - self.assertEqual(inst.participant[0].role.text, "responsiblePerson") + self.assertEqual(inst.participant[0].role[0].text, "responsiblePerson") self.assertEqual(inst.participant[1].period.end.date, FHIRDate("2013-01-01").date) self.assertEqual(inst.participant[1].period.end.as_json(), "2013-01-01") - self.assertEqual(inst.participant[1].role.text, "adviser") + self.assertEqual(inst.participant[1].role[0].text, "adviser") self.assertEqual(inst.period.end.date, FHIRDate("2013-01-01").date) self.assertEqual(inst.period.end.as_json(), "2013-01-01") self.assertEqual(inst.status, "active") diff --git a/fhirclient/models/catalogentry.py b/fhirclient/models/catalogentry.py new file mode 100644 index 000000000..78e7d56bd --- /dev/null +++ b/fhirclient/models/catalogentry.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CatalogEntry) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class CatalogEntry(domainresource.DomainResource): + """ An entry in a catalog. + + Catalog entries are wrappers that contextualize items included in a + catalog. + """ + + resource_type = "CatalogEntry" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additionalCharacteristic = None + """ Additional characteristics of the catalog entry. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.additionalClassification = None + """ Additional classification of the catalog entry. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.additionalIdentifier = None + """ Any additional identifier(s) for the catalog item, in the same + granularity or concept. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.classification = None + """ Classification (category or class) of the item entry. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Unique identifier of the catalog item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.lastUpdated = None + """ When was this catalog last updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.orderable = None + """ Whether the entry represents an orderable item. + Type `bool`. """ + + self.referencedItem = None + """ The item that is being defined. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.relatedEntry = None + """ An item that this catalog entry is related to. + List of `CatalogEntryRelatedEntry` items (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.type = None + """ The type of item - medication, device, service, protocol or other. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.validTo = None + """ The date until which this catalog entry is expected to be active. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.validityPeriod = None + """ The time period in which this catalog entry is expected to be + active. + Type `Period` (represented as `dict` in JSON). """ + + super(CatalogEntry, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CatalogEntry, self).elementProperties() + js.extend([ + ("additionalCharacteristic", "additionalCharacteristic", codeableconcept.CodeableConcept, True, None, False), + ("additionalClassification", "additionalClassification", codeableconcept.CodeableConcept, True, None, False), + ("additionalIdentifier", "additionalIdentifier", identifier.Identifier, True, None, False), + ("classification", "classification", codeableconcept.CodeableConcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("lastUpdated", "lastUpdated", fhirdate.FHIRDate, False, None, False), + ("orderable", "orderable", bool, False, None, True), + ("referencedItem", "referencedItem", fhirreference.FHIRReference, False, None, True), + ("relatedEntry", "relatedEntry", CatalogEntryRelatedEntry, True, None, False), + ("status", "status", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("validTo", "validTo", fhirdate.FHIRDate, False, None, False), + ("validityPeriod", "validityPeriod", period.Period, False, None, False), + ]) + return js + + +from . import backboneelement + +class CatalogEntryRelatedEntry(backboneelement.BackboneElement): + """ An item that this catalog entry is related to. + + Used for example, to point to a substance, or to a device used to + administer a medication. + """ + + resource_type = "CatalogEntryRelatedEntry" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.item = None + """ The reference to the related item. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.relationtype = None + """ triggers | is-replaced-by. + Type `str`. """ + + super(CatalogEntryRelatedEntry, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CatalogEntryRelatedEntry, self).elementProperties() + js.extend([ + ("item", "item", fhirreference.FHIRReference, False, None, True), + ("relationtype", "relationtype", str, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/catalogentry_tests.py b/fhirclient/models/catalogentry_tests.py new file mode 100644 index 000000000..dc949504f --- /dev/null +++ b/fhirclient/models/catalogentry_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import catalogentry +from .fhirdate import FHIRDate + + +class CatalogEntryTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("CatalogEntry", js["resourceType"]) + return catalogentry.CatalogEntry(js) + + def testCatalogEntry1(self): + inst = self.instantiate_from("catalogentry-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CatalogEntry instance") + self.implCatalogEntry1(inst) + + js = inst.as_json() + self.assertEqual("CatalogEntry", js["resourceType"]) + inst2 = catalogentry.CatalogEntry(js) + self.implCatalogEntry1(inst2) + + def implCatalogEntry1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://example.com/identifier") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertTrue(inst.orderable) + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.text, "Medication") + diff --git a/fhirclient/models/chargeitem.py b/fhirclient/models/chargeitem.py index 3b71392a6..0c0181b65 100644 --- a/fhirclient/models/chargeitem.py +++ b/fhirclient/models/chargeitem.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ChargeItem) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ChargeItem) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -31,7 +31,7 @@ def __init__(self, jsondict=None, strict=True): self.account = None """ Account to place this charge. - List of `FHIRReference` items referencing `Account` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.bodysite = None """ Anatomical location, if relevant. @@ -43,9 +43,17 @@ def __init__(self, jsondict=None, strict=True): self.context = None """ Encounter / Episode associated with event. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.definition = None + self.costCenter = None + """ Organization that has ownership of the (potential, future) revenue. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.definitionCanonical = None + """ Resource defining the code of this ChargeItem. + List of `str` items. """ + + self.definitionUri = None """ Defining information about the code of this charge item. List of `str` items. """ @@ -55,7 +63,7 @@ def __init__(self, jsondict=None, strict=True): self.enterer = None """ Individual who was entering. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.factorOverride = None """ Factor overriding the associated rules. @@ -63,7 +71,7 @@ def __init__(self, jsondict=None, strict=True): self.identifier = None """ Business Identifier for item. - Type `Identifier` (represented as `dict` in JSON). """ + List of `Identifier` items (represented as `dict` in JSON). """ self.note = None """ Comments made about the ChargeItem. @@ -87,20 +95,28 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Part of referenced ChargeItem. - List of `FHIRReference` items referencing `ChargeItem` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.participant = None + self.performer = None """ Who performed charged service. - List of `ChargeItemParticipant` items (represented as `dict` in JSON). """ + List of `ChargeItemPerformer` items (represented as `dict` in JSON). """ self.performingOrganization = None - """ Organization providing the charged sevice. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Organization providing the charged service. + Type `FHIRReference` (represented as `dict` in JSON). """ self.priceOverride = None """ Price overriding the associated rules. Type `Money` (represented as `dict` in JSON). """ + self.productCodeableConcept = None + """ Product charged. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.productReference = None + """ Product charged. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.quantity = None """ Quantity of which the charge item has been serviced. Type `Quantity` (represented as `dict` in JSON). """ @@ -111,11 +127,11 @@ def __init__(self, jsondict=None, strict=True): self.requestingOrganization = None """ Organization requesting the charged service. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.service = None """ Which rendered service is being charged?. - List of `FHIRReference` items referencing `DiagnosticReport, ImagingStudy, Immunization, MedicationAdministration, MedicationDispense, Observation, Procedure, SupplyDelivery` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ planned | billable | not-billable | aborted | billed | entered-in- @@ -124,11 +140,11 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Individual service was done for/to. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.supportingInformation = None - """ Further information supporting the this charge. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + """ Further information supporting this charge. + List of `FHIRReference` items (represented as `dict` in JSON). """ super(ChargeItem, self).__init__(jsondict=jsondict, strict=strict) @@ -139,20 +155,24 @@ def elementProperties(self): ("bodysite", "bodysite", codeableconcept.CodeableConcept, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, True), ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", str, True, None, False), + ("costCenter", "costCenter", fhirreference.FHIRReference, False, None, False), + ("definitionCanonical", "definitionCanonical", str, True, None, False), + ("definitionUri", "definitionUri", str, True, None, False), ("enteredDate", "enteredDate", fhirdate.FHIRDate, False, None, False), ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), ("factorOverride", "factorOverride", float, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("note", "note", annotation.Annotation, True, None, False), ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), ("overrideReason", "overrideReason", str, False, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), - ("participant", "participant", ChargeItemParticipant, True, None, False), + ("performer", "performer", ChargeItemPerformer, True, None, False), ("performingOrganization", "performingOrganization", fhirreference.FHIRReference, False, None, False), ("priceOverride", "priceOverride", money.Money, False, None, False), + ("productCodeableConcept", "productCodeableConcept", codeableconcept.CodeableConcept, False, "product", False), + ("productReference", "productReference", fhirreference.FHIRReference, False, "product", False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), ("requestingOrganization", "requestingOrganization", fhirreference.FHIRReference, False, None, False), @@ -166,13 +186,13 @@ def elementProperties(self): from . import backboneelement -class ChargeItemParticipant(backboneelement.BackboneElement): +class ChargeItemPerformer(backboneelement.BackboneElement): """ Who performed charged service. Indicates who or what performed or participated in the charged service. """ - resource_type = "ChargeItemParticipant" + resource_type = "ChargeItemPerformer" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -184,19 +204,19 @@ def __init__(self, jsondict=None, strict=True): self.actor = None """ Individual who was performing. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.role = None + self.function = None """ What type of performance was done. Type `CodeableConcept` (represented as `dict` in JSON). """ - super(ChargeItemParticipant, self).__init__(jsondict=jsondict, strict=strict) + super(ChargeItemPerformer, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ChargeItemParticipant, self).elementProperties() + js = super(ChargeItemPerformer, self).elementProperties() js.extend([ ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), ]) return js diff --git a/fhirclient/models/chargeitem_tests.py b/fhirclient/models/chargeitem_tests.py index 6b45b2c49..d9c794fc3 100644 --- a/fhirclient/models/chargeitem_tests.py +++ b/fhirclient/models/chargeitem_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -34,13 +34,16 @@ def testChargeItem1(self): def implChargeItem1(self, inst): self.assertEqual(inst.code.coding[0].code, "01510") self.assertEqual(inst.code.coding[0].display, "Zusatzpauschale für Beobachtung nach diagnostischer Koronarangiografie") - self.assertEqual(inst.definition[0], "http://www.kbv.de/tools/ebm/html/01520_2904360860826220813632.html") + self.assertEqual(inst.definitionUri[0], "http://www.kbv.de/tools/ebm/html/01520_2904360860826220813632.html") self.assertEqual(inst.enteredDate.date, FHIRDate("2017-01-25T23:55:04+01:00").date) self.assertEqual(inst.enteredDate.as_json(), "2017-01-25T23:55:04+01:00") self.assertEqual(inst.factorOverride, 0.8) self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.system, "http://myHospital.org/ChargeItems") - self.assertEqual(inst.identifier.value, "654321") + self.assertEqual(inst.identifier[0].system, "http://myHospital.org/ChargeItems") + self.assertEqual(inst.identifier[0].value, "654321") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "The code is only applicable for periods longer than 4h") self.assertEqual(inst.note[0].time.date, FHIRDate("2017-01-25T23:55:04+01:00").date) self.assertEqual(inst.note[0].time.as_json(), "2017-01-25T23:55:04+01:00") @@ -49,15 +52,13 @@ def implChargeItem1(self, inst): self.assertEqual(inst.occurrencePeriod.start.date, FHIRDate("2017-01-25T08:00:00+01:00").date) self.assertEqual(inst.occurrencePeriod.start.as_json(), "2017-01-25T08:00:00+01:00") self.assertEqual(inst.overrideReason, "Patient is Cardiologist's golf buddy, so he gets a 20% discount!") - self.assertEqual(inst.participant[0].role.coding[0].code, "17561000") - self.assertEqual(inst.participant[0].role.coding[0].display, "Cardiologist") - self.assertEqual(inst.participant[0].role.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.participant[1].role.coding[0].code, "224542009") - self.assertEqual(inst.participant[1].role.coding[0].display, "Coronary Care Nurse") - self.assertEqual(inst.participant[1].role.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.priceOverride.code, "EUR") - self.assertEqual(inst.priceOverride.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.priceOverride.unit, "EUR") + self.assertEqual(inst.performer[0].function.coding[0].code, "17561000") + self.assertEqual(inst.performer[0].function.coding[0].display, "Cardiologist") + self.assertEqual(inst.performer[0].function.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.performer[1].function.coding[0].code, "224542009") + self.assertEqual(inst.performer[1].function.coding[0].display, "Coronary Care Nurse") + self.assertEqual(inst.performer[1].function.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.priceOverride.currency, "EUR") self.assertEqual(inst.priceOverride.value, 40) self.assertEqual(inst.quantity.value, 1) self.assertEqual(inst.reason[0].coding[0].code, "123456") diff --git a/fhirclient/models/chargeitemdefinition.py b/fhirclient/models/chargeitemdefinition.py new file mode 100644 index 000000000..9385db328 --- /dev/null +++ b/fhirclient/models/chargeitemdefinition.py @@ -0,0 +1,319 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ChargeItemDefinition) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class ChargeItemDefinition(domainresource.DomainResource): + """ Definition of properties and rules about how the price and the + applicability of a ChargeItem can be determined. + + The ChargeItemDefinition resource provides the properties that apply to the + (billing) codes necessary to calculate costs and prices. The properties may + differ largely depending on type and realm, therefore this resource gives + only a rough structure and requires profiling for each type of billing code + system. + """ + + resource_type = "ChargeItemDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.applicability = None + """ Whether or not the billing code is applicable. + List of `ChargeItemDefinitionApplicability` items (represented as `dict` in JSON). """ + + self.approvalDate = None + """ When the charge item definition was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.code = None + """ Billing codes or product types this definition applies to. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.derivedFromUri = None + """ Underlying externally-defined charge item definition. + List of `str` items. """ + + self.description = None + """ Natural language description of the charge item definition. + Type `str`. """ + + self.effectivePeriod = None + """ When the charge item definition is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.identifier = None + """ Additional identifier for the charge item definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.instance = None + """ Instances this definition applies to. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for charge item definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the charge item definition was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.partOf = None + """ A larger definition of which this particular definition is a + component or step. + List of `str` items. """ + + self.propertyGroup = None + """ Group of properties which are applicable under the same conditions. + List of `ChargeItemDefinitionPropertyGroup` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.replaces = None + """ Completed or terminated request(s) whose function is taken by this + new request. + List of `str` items. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this charge item definition (human friendly). + Type `str`. """ + + self.url = None + """ Canonical identifier for this charge item definition, represented + as a URI (globally unique). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the charge item definition. + Type `str`. """ + + super(ChargeItemDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItemDefinition, self).elementProperties() + js.extend([ + ("applicability", "applicability", ChargeItemDefinitionApplicability, True, None, False), + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("derivedFromUri", "derivedFromUri", str, True, None, False), + ("description", "description", str, False, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instance", "instance", fhirreference.FHIRReference, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("partOf", "partOf", str, True, None, False), + ("propertyGroup", "propertyGroup", ChargeItemDefinitionPropertyGroup, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("replaces", "replaces", str, True, None, False), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ("url", "url", str, False, None, True), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ChargeItemDefinitionApplicability(backboneelement.BackboneElement): + """ Whether or not the billing code is applicable. + + Expressions that describe applicability criteria for the billing code. + """ + + resource_type = "ChargeItemDefinitionApplicability" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Natural language description of the condition. + Type `str`. """ + + self.expression = None + """ Boolean-valued expression. + Type `str`. """ + + self.language = None + """ Language of the expression. + Type `str`. """ + + super(ChargeItemDefinitionApplicability, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItemDefinitionApplicability, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("expression", "expression", str, False, None, False), + ("language", "language", str, False, None, False), + ]) + return js + + +class ChargeItemDefinitionPropertyGroup(backboneelement.BackboneElement): + """ Group of properties which are applicable under the same conditions. + + Group of properties which are applicable under the same conditions. If no + applicability rules are established for the group, then all properties + always apply. + """ + + resource_type = "ChargeItemDefinitionPropertyGroup" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.applicability = None + """ Conditions under which the priceComponent is applicable. + List of `ChargeItemDefinitionApplicability` items (represented as `dict` in JSON). """ + + self.priceComponent = None + """ Components of total line item price. + List of `ChargeItemDefinitionPropertyGroupPriceComponent` items (represented as `dict` in JSON). """ + + super(ChargeItemDefinitionPropertyGroup, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItemDefinitionPropertyGroup, self).elementProperties() + js.extend([ + ("applicability", "applicability", ChargeItemDefinitionApplicability, True, None, False), + ("priceComponent", "priceComponent", ChargeItemDefinitionPropertyGroupPriceComponent, True, None, False), + ]) + return js + + +class ChargeItemDefinitionPropertyGroupPriceComponent(backboneelement.BackboneElement): + """ Components of total line item price. + + The price for a ChargeItem may be calculated as a base price with + surcharges/deductions that apply in certain conditions. A + ChargeItemDefinition resource that defines the prices, factors and + conditions that apply to a billing code is currently under development. The + priceComponent element can be used to offer transparency to the recipient + of the Invoice of how the prices have been calculated. + """ + + resource_type = "ChargeItemDefinitionPropertyGroupPriceComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Monetary amount associated with this component. + Type `Money` (represented as `dict` in JSON). """ + + self.code = None + """ Code identifying the specific component. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.factor = None + """ Factor used for calculating this component. + Type `float`. """ + + self.type = None + """ base | surcharge | deduction | discount | tax | informational. + Type `str`. """ + + super(ChargeItemDefinitionPropertyGroupPriceComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ChargeItemDefinitionPropertyGroupPriceComponent, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("factor", "factor", float, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import money +except ImportError: + money = sys.modules[__package__ + '.money'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/chargeitemdefinition_tests.py b/fhirclient/models/chargeitemdefinition_tests.py new file mode 100644 index 000000000..79ef9a423 --- /dev/null +++ b/fhirclient/models/chargeitemdefinition_tests.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import chargeitemdefinition +from .fhirdate import FHIRDate + + +class ChargeItemDefinitionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("ChargeItemDefinition", js["resourceType"]) + return chargeitemdefinition.ChargeItemDefinition(js) + + def testChargeItemDefinition1(self): + inst = self.instantiate_from("chargeitemdefinition-device-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ChargeItemDefinition instance") + self.implChargeItemDefinition1(inst) + + js = inst.as_json() + self.assertEqual("ChargeItemDefinition", js["resourceType"]) + inst2 = chargeitemdefinition.ChargeItemDefinition(js) + self.implChargeItemDefinition1(inst2) + + def implChargeItemDefinition1(self, inst): + self.assertEqual(inst.applicability[0].description, "Verify ChargeItem pertains to Device 12345") + self.assertEqual(inst.applicability[0].expression, "%context.service.suppliedItem='Device/12345'") + self.assertEqual(inst.applicability[0].language, "text/fhirpath") + self.assertEqual(inst.description, "Financial details for custom made device") + self.assertEqual(inst.id, "device") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].amount.currency, "EUR") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].amount.value, 67.44) + self.assertEqual(inst.propertyGroup[0].priceComponent[0].code.coding[0].code, "VK") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].code.coding[0].display, "Verkaufspreis (netto)") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].code.coding[0].system, "http://fhir.de/CodeSystem/billing-attributes") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].type, "base") + self.assertEqual(inst.propertyGroup[1].applicability[0].description, "Gültigkeit Steuersatz") + self.assertEqual(inst.propertyGroup[1].applicability[0].expression, "%context.occurenceDateTime > '2018-04-01'") + self.assertEqual(inst.propertyGroup[1].applicability[0].language, "text/fhirpath") + self.assertEqual(inst.propertyGroup[1].priceComponent[0].code.coding[0].code, "MWST") + self.assertEqual(inst.propertyGroup[1].priceComponent[0].code.coding[0].display, "Mehrwersteuersatz") + self.assertEqual(inst.propertyGroup[1].priceComponent[0].code.coding[0].system, "http://fhir.de/CodeSystem/billing-attributes") + self.assertEqual(inst.propertyGroup[1].priceComponent[0].factor, 1.19) + self.assertEqual(inst.propertyGroup[1].priceComponent[0].type, "tax") + self.assertEqual(inst.propertyGroup[2].applicability[0].description, "Gültigkeit Steuersatz") + self.assertEqual(inst.propertyGroup[2].applicability[0].expression, "%context.occurenceDateTime <= '2018-04-01'") + self.assertEqual(inst.propertyGroup[2].applicability[0].language, "text/fhirpath") + self.assertEqual(inst.propertyGroup[2].priceComponent[0].code.coding[0].code, "MWST") + self.assertEqual(inst.propertyGroup[2].priceComponent[0].code.coding[0].display, "Mehrwersteuersatz") + self.assertEqual(inst.propertyGroup[2].priceComponent[0].code.coding[0].system, "http://fhir.de/CodeSystem/billing-attributes") + self.assertEqual(inst.propertyGroup[2].priceComponent[0].factor, 1.07) + self.assertEqual(inst.propertyGroup[2].priceComponent[0].type, "tax") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://sap.org/ChargeItemDefinition/device-123") + + def testChargeItemDefinition2(self): + inst = self.instantiate_from("chargeitemdefinition-ebm-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ChargeItemDefinition instance") + self.implChargeItemDefinition2(inst) + + js = inst.as_json() + self.assertEqual("ChargeItemDefinition", js["resourceType"]) + inst2 = chargeitemdefinition.ChargeItemDefinition(js) + self.implChargeItemDefinition2(inst2) + + def implChargeItemDefinition2(self, inst): + self.assertEqual(inst.applicability[0].description, "Excludes billing code 13250 for same Encounter") + self.assertEqual(inst.applicability[0].expression, "[some CQL expression]") + self.assertEqual(inst.applicability[0].language, "text/cql") + self.assertEqual(inst.applicability[1].description, "Applies only once per Encounter") + self.assertEqual(inst.applicability[1].expression, "[some CQL expression]") + self.assertEqual(inst.applicability[1].language, "text/CQL") + self.assertEqual(inst.code.coding[0].code, "30110") + self.assertEqual(inst.code.coding[0].display, "Allergologiediagnostik I") + self.assertEqual(inst.code.coding[0].system, "http://fhir.de/CodingSystem/kbv/ebm") + self.assertEqual(inst.description, "Allergologisch-diagnostischer Komplex zur Diagnostik und/oder zum Ausschluss einer (Kontakt-)Allergie vom Spättyp (Typ IV), einschl. Kosten") + self.assertEqual(inst.effectivePeriod.end.date, FHIRDate("2018-06-30").date) + self.assertEqual(inst.effectivePeriod.end.as_json(), "2018-06-30") + self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2018-04-01").date) + self.assertEqual(inst.effectivePeriod.start.as_json(), "2018-04-01") + self.assertEqual(inst.id, "ebm") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].amount.currency, "EUR") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].amount.value, 67.44) + self.assertEqual(inst.propertyGroup[0].priceComponent[0].code.coding[0].code, "gesamt-euro") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].code.coding[0].display, "Gesamt (Euro)") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].code.coding[0].system, "http://fhir.de/CodeSystem/kbv/ebm-attribute") + self.assertEqual(inst.propertyGroup[0].priceComponent[0].type, "base") + self.assertEqual(inst.propertyGroup[0].priceComponent[1].code.coding[0].code, "gesamt-punkte") + self.assertEqual(inst.propertyGroup[0].priceComponent[1].code.coding[0].display, "Gesamt (Punkte)") + self.assertEqual(inst.propertyGroup[0].priceComponent[1].code.coding[0].system, "http://fhir.de/CodeSystem/kbv/ebm-attribute") + self.assertEqual(inst.propertyGroup[0].priceComponent[1].factor, 633) + self.assertEqual(inst.propertyGroup[0].priceComponent[1].type, "informational") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://fhir.de/ChargeItemDefinition/kbv/ebm-30110") + self.assertEqual(inst.version, "2-2018") + diff --git a/fhirclient/models/claim.py b/fhirclient/models/claim.py index 9570d2b47..8746641ee 100644 --- a/fhirclient/models/claim.py +++ b/fhirclient/models/claim.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Claim) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Claim) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,9 +10,9 @@ class Claim(domainresource.DomainResource): """ Claim, Pre-determination or Pre-authorization. - A provider issued list of services and products provided, or to be - provided, to a patient which is provided to an insurer for payment - recovery. + A provider issued list of professional services and products which have + been provided, or are to be provided, to a patient which is sent to an + insurer for reimbursement. """ resource_type = "Claim" @@ -26,11 +26,11 @@ def __init__(self, jsondict=None, strict=True): """ self.accident = None - """ Details about an accident. + """ Details of the event. Type `ClaimAccident` (represented as `dict` in JSON). """ self.billablePeriod = None - """ Period for charge submission. + """ Relevant time frame for the claim. Type `Period` (represented as `dict` in JSON). """ self.careTeam = None @@ -38,92 +38,75 @@ def __init__(self, jsondict=None, strict=True): List of `ClaimCareTeam` items (represented as `dict` in JSON). """ self.created = None - """ Creation date. + """ Resource creation date. Type `FHIRDate` (represented as `str` in JSON). """ self.diagnosis = None - """ List of Diagnosis. + """ Pertinent diagnosis information. List of `ClaimDiagnosis` items (represented as `dict` in JSON). """ - self.employmentImpacted = None - """ Period unable to work. - Type `Period` (represented as `dict` in JSON). """ - self.enterer = None - """ Author. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + """ Author of the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ self.facility = None - """ Servicing Facility. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Servicing facility. + Type `FHIRReference` (represented as `dict` in JSON). """ self.fundsReserve = None - """ Funds requested to be reserved. + """ For whom to reserve funds. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.hospitalization = None - """ Period in hospital. - Type `Period` (represented as `dict` in JSON). """ - self.identifier = None - """ Claim number. + """ Business Identifier for claim. List of `Identifier` items (represented as `dict` in JSON). """ - self.information = None - """ Exceptions, special considerations, the condition, situation, prior - or concurrent issues. - List of `ClaimInformation` items (represented as `dict` in JSON). """ - self.insurance = None - """ Insurance or medical plan. + """ Patient insurance information. List of `ClaimInsurance` items (represented as `dict` in JSON). """ self.insurer = None """ Target. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.item = None - """ Goods and Services. + """ Product or service provided. List of `ClaimItem` items (represented as `dict` in JSON). """ - self.organization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - self.originalPrescription = None - """ Original prescription if superceded by fulfiller. - Type `FHIRReference` referencing `MedicationRequest` (represented as `dict` in JSON). """ + """ Original prescription if superseded by fulfiller. + Type `FHIRReference` (represented as `dict` in JSON). """ self.patient = None - """ The subject of the Products and Services. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + """ The recipient of the products and services. + Type `FHIRReference` (represented as `dict` in JSON). """ self.payee = None - """ Party to be paid any benefits payable. + """ Recipient of benefits payable. Type `ClaimPayee` (represented as `dict` in JSON). """ self.prescription = None - """ Prescription authorizing services or products. - Type `FHIRReference` referencing `MedicationRequest, VisionPrescription` (represented as `dict` in JSON). """ + """ Prescription authorizing services and products. + Type `FHIRReference` (represented as `dict` in JSON). """ self.priority = None - """ Desired processing priority. + """ Desired processing ugency. Type `CodeableConcept` (represented as `dict` in JSON). """ self.procedure = None - """ Procedures performed. + """ Clinical procedures performed. List of `ClaimProcedure` items (represented as `dict` in JSON). """ self.provider = None - """ Responsible provider. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + """ Party responsible for the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ self.referral = None - """ Treatment Referral. - Type `FHIRReference` referencing `ReferralRequest` (represented as `dict` in JSON). """ + """ Treatment referral. + Type `FHIRReference` (represented as `dict` in JSON). """ self.related = None - """ Related Claims which may be revelant to processing this claimn. + """ Prior or corollary claims. List of `ClaimRelated` items (represented as `dict` in JSON). """ self.status = None @@ -131,19 +114,23 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.subType = None - """ Finer grained claim type information. - List of `CodeableConcept` items (represented as `dict` in JSON). """ + """ More granular claim type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.supportingInfo = None + """ Supporting information. + List of `ClaimSupportingInfo` items (represented as `dict` in JSON). """ self.total = None """ Total claim cost. Type `Money` (represented as `dict` in JSON). """ self.type = None - """ Type or discipline. + """ Category or discipline. Type `CodeableConcept` (represented as `dict` in JSON). """ self.use = None - """ complete | proposed | exploratory | other. + """ claim | preauthorization | predetermination. Type `str`. """ super(Claim, self).__init__(jsondict=jsondict, strict=strict) @@ -154,33 +141,30 @@ def elementProperties(self): ("accident", "accident", ClaimAccident, False, None, False), ("billablePeriod", "billablePeriod", period.Period, False, None, False), ("careTeam", "careTeam", ClaimCareTeam, True, None, False), - ("created", "created", fhirdate.FHIRDate, False, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, True), ("diagnosis", "diagnosis", ClaimDiagnosis, True, None, False), - ("employmentImpacted", "employmentImpacted", period.Period, False, None, False), ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), ("facility", "facility", fhirreference.FHIRReference, False, None, False), ("fundsReserve", "fundsReserve", codeableconcept.CodeableConcept, False, None, False), - ("hospitalization", "hospitalization", period.Period, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("information", "information", ClaimInformation, True, None, False), - ("insurance", "insurance", ClaimInsurance, True, None, False), + ("insurance", "insurance", ClaimInsurance, True, None, True), ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), ("item", "item", ClaimItem, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), ("originalPrescription", "originalPrescription", fhirreference.FHIRReference, False, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("payee", "payee", ClaimPayee, False, None, False), ("prescription", "prescription", fhirreference.FHIRReference, False, None, False), - ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, True), ("procedure", "procedure", ClaimProcedure, True, None, False), - ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, True), ("referral", "referral", fhirreference.FHIRReference, False, None, False), ("related", "related", ClaimRelated, True, None, False), - ("status", "status", str, False, None, False), - ("subType", "subType", codeableconcept.CodeableConcept, True, None, False), + ("status", "status", str, False, None, True), + ("subType", "subType", codeableconcept.CodeableConcept, False, None, False), + ("supportingInfo", "supportingInfo", ClaimSupportingInfo, True, None, False), ("total", "total", money.Money, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("use", "use", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("use", "use", str, False, None, True), ]) return js @@ -188,9 +172,10 @@ def elementProperties(self): from . import backboneelement class ClaimAccident(backboneelement.BackboneElement): - """ Details about an accident. + """ Details of the event. - An accident which resulted in the need for healthcare services. + Details of an accident which resulted in injuries which required the + products and services listed in the claim. """ resource_type = "ClaimAccident" @@ -204,18 +189,16 @@ def __init__(self, jsondict=None, strict=True): """ self.date = None - """ When the accident occurred - see information codes - see information codes. + """ When the incident occurred. Type `FHIRDate` (represented as `str` in JSON). """ self.locationAddress = None - """ Accident Place. + """ Where the event occurred. Type `Address` (represented as `dict` in JSON). """ self.locationReference = None - """ Accident Place. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Where the event occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ The nature of the accident. @@ -237,8 +220,7 @@ def elementProperties(self): class ClaimCareTeam(backboneelement.BackboneElement): """ Members of the care team. - The members of the team who provided the overall service as well as their - role and whether responsible and qualifications. + The members of the team who provided the products and services. """ resource_type = "ClaimCareTeam" @@ -252,23 +234,23 @@ def __init__(self, jsondict=None, strict=True): """ self.provider = None - """ Provider individual or organization. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + """ Practitioner or organization. + Type `FHIRReference` (represented as `dict` in JSON). """ self.qualification = None - """ Type, classification or Specialization. + """ Practitioner credential or specialization. Type `CodeableConcept` (represented as `dict` in JSON). """ self.responsible = None - """ Billing provider. + """ Indicator of the lead practitioner. Type `bool`. """ self.role = None - """ Role on the team. + """ Function within the team. Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Number to covey order of careTeam. + """ Order of care team. Type `int`. """ super(ClaimCareTeam, self).__init__(jsondict=jsondict, strict=strict) @@ -286,9 +268,9 @@ def elementProperties(self): class ClaimDiagnosis(backboneelement.BackboneElement): - """ List of Diagnosis. + """ Pertinent diagnosis information. - List of patient diagnosis for which care is sought. + Information about diagnoses relevant to the claim items. """ resource_type = "ClaimDiagnosis" @@ -302,19 +284,23 @@ def __init__(self, jsondict=None, strict=True): """ self.diagnosisCodeableConcept = None - """ Patient's diagnosis. + """ Nature of illness or problem. Type `CodeableConcept` (represented as `dict` in JSON). """ self.diagnosisReference = None - """ Patient's diagnosis. - Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + """ Nature of illness or problem. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.onAdmission = None + """ Present on admission. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.packageCode = None """ Package billing code. Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Number to covey order of diagnosis. + """ Diagnosis instance identifier. Type `int`. """ self.type = None @@ -328,6 +314,7 @@ def elementProperties(self): js.extend([ ("diagnosisCodeableConcept", "diagnosisCodeableConcept", codeableconcept.CodeableConcept, False, "diagnosis", True), ("diagnosisReference", "diagnosisReference", fhirreference.FHIRReference, False, "diagnosis", True), + ("onAdmission", "onAdmission", codeableconcept.CodeableConcept, False, None, False), ("packageCode", "packageCode", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), ("type", "type", codeableconcept.CodeableConcept, True, None, False), @@ -335,88 +322,11 @@ def elementProperties(self): return js -class ClaimInformation(backboneelement.BackboneElement): - """ Exceptions, special considerations, the condition, situation, prior or - concurrent issues. - - Additional information codes regarding exceptions, special considerations, - the condition, situation, prior or concurrent issues. Often there are - mutiple jurisdiction specific valuesets which are required. - """ - - resource_type = "ClaimInformation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.category = None - """ General class of information. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.code = None - """ Type of information. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.reason = None - """ Reason associated with the information. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.sequence = None - """ Information instance identifier. - Type `int`. """ - - self.timingDate = None - """ When it occurred. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.timingPeriod = None - """ When it occurred. - Type `Period` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Additional Data or supporting information. - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueQuantity = None - """ Additional Data or supporting information. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueReference = None - """ Additional Data or supporting information. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.valueString = None - """ Additional Data or supporting information. - Type `str`. """ - - super(ClaimInformation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ClaimInformation, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, True), - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), - ("sequence", "sequence", int, False, None, True), - ("timingDate", "timingDate", fhirdate.FHIRDate, False, "timing", False), - ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), - ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), - ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), - ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), - ("valueString", "valueString", str, False, "value", False), - ]) - return js - - class ClaimInsurance(backboneelement.BackboneElement): - """ Insurance or medical plan. + """ Patient insurance information. - Financial instrument by which payment information for health care. + Financial instruments for reimbursement for the health care products and + services specified on the claim. """ resource_type = "ClaimInsurance" @@ -430,27 +340,31 @@ def __init__(self, jsondict=None, strict=True): """ self.businessArrangement = None - """ Business agreement. + """ Additional provider contract number. Type `str`. """ self.claimResponse = None """ Adjudication results. - Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.coverage = None """ Insurance information. - Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.focal = None - """ Is the focal Coverage. + """ Coverage to be used for adjudication. Type `bool`. """ + self.identifier = None + """ Pre-assigned Claim number. + Type `Identifier` (represented as `dict` in JSON). """ + self.preAuthRef = None - """ Pre-Authorization/Determination Reference. + """ Prior authorization reference number. List of `str` items. """ self.sequence = None - """ Service instance identifier. + """ Insurance instance identifier. Type `int`. """ super(ClaimInsurance, self).__init__(jsondict=jsondict, strict=strict) @@ -462,6 +376,7 @@ def elementProperties(self): ("claimResponse", "claimResponse", fhirreference.FHIRReference, False, None, False), ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), ("focal", "focal", bool, False, None, True), + ("identifier", "identifier", identifier.Identifier, False, None, False), ("preAuthRef", "preAuthRef", str, True, None, False), ("sequence", "sequence", int, False, None, True), ]) @@ -469,9 +384,10 @@ def elementProperties(self): class ClaimItem(backboneelement.BackboneElement): - """ Goods and Services. + """ Product or service provided. - First tier of goods and services. + A claim line. Either a simple product or service or a 'group' of details + which can each be a simple items or groups of sub-details. """ resource_type = "ClaimItem" @@ -485,67 +401,71 @@ def __init__(self, jsondict=None, strict=True): """ self.bodySite = None - """ Service Location. + """ Anatomical location. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.careTeamLinkId = None + self.careTeamSequence = None """ Applicable careTeam members. List of `int` items. """ self.category = None - """ Type of service or product. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.detail = None - """ Additional items. + """ Product or service provided. List of `ClaimItemDetail` items (represented as `dict` in JSON). """ - self.diagnosisLinkId = None + self.diagnosisSequence = None """ Applicable diagnoses. List of `int` items. """ self.encounter = None """ Encounters related to this billed item. - List of `FHIRReference` items referencing `Encounter` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.factor = None """ Price scaling factor. Type `float`. """ - self.informationLinkId = None + self.informationSequence = None """ Applicable exception and supporting information. List of `int` items. """ self.locationAddress = None - """ Place of service. + """ Place of service or where product was supplied. Type `Address` (represented as `dict` in JSON). """ self.locationCodeableConcept = None - """ Place of service. + """ Place of service or where product was supplied. Type `CodeableConcept` (represented as `dict` in JSON). """ self.locationReference = None - """ Place of service. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Place of service or where product was supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ self.modifier = None - """ Service/Product billing modifiers. + """ Product or service billing modifiers. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.net = None """ Total item cost. Type `Money` (represented as `dict` in JSON). """ - self.procedureLinkId = None + self.procedureSequence = None """ Applicable procedures. List of `int` items. """ + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.programCode = None - """ Program specific reason for item inclusion. + """ Program the product or service is provided under. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.quantity = None - """ Count of Products or Services. + """ Count of products or services. Type `Quantity` (represented as `dict` in JSON). """ self.revenue = None @@ -553,31 +473,27 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Service instance. + """ Item instance identifier. Type `int`. """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.servicedDate = None - """ Date or dates of Service. + """ Date or dates of service or product delivery. Type `FHIRDate` (represented as `str` in JSON). """ self.servicedPeriod = None - """ Date or dates of Service. + """ Date or dates of service or product delivery. Type `Period` (represented as `dict` in JSON). """ self.subSite = None - """ Service Sub-location. + """ Anatomical sub-location. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.udi = None - """ Unique Device Identifier. - List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.unitPrice = None - """ Fee, charge or cost per point. + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ super(ClaimItem, self).__init__(jsondict=jsondict, strict=strict) @@ -586,24 +502,24 @@ def elementProperties(self): js = super(ClaimItem, self).elementProperties() js.extend([ ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("careTeamLinkId", "careTeamLinkId", int, True, None, False), + ("careTeamSequence", "careTeamSequence", int, True, None, False), ("category", "category", codeableconcept.CodeableConcept, False, None, False), ("detail", "detail", ClaimItemDetail, True, None, False), - ("diagnosisLinkId", "diagnosisLinkId", int, True, None, False), + ("diagnosisSequence", "diagnosisSequence", int, True, None, False), ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), ("factor", "factor", float, False, None, False), - ("informationLinkId", "informationLinkId", int, True, None, False), + ("informationSequence", "informationSequence", int, True, None, False), ("locationAddress", "locationAddress", address.Address, False, "location", False), ("locationCodeableConcept", "locationCodeableConcept", codeableconcept.CodeableConcept, False, "location", False), ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), ("net", "net", money.Money, False, None, False), - ("procedureLinkId", "procedureLinkId", int, True, None, False), + ("procedureSequence", "procedureSequence", int, True, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), @@ -614,9 +530,10 @@ def elementProperties(self): class ClaimItemDetail(backboneelement.BackboneElement): - """ Additional items. + """ Product or service provided. - Second tier of goods and services. + A claim detail line. Either a simple (a product or service) or a 'group' of + sub-details which are simple items. """ resource_type = "ClaimItemDetail" @@ -630,7 +547,7 @@ def __init__(self, jsondict=None, strict=True): """ self.category = None - """ Type of service or product. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.factor = None @@ -642,15 +559,19 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.net = None - """ Total additional item cost. + """ Total item cost. Type `Money` (represented as `dict` in JSON). """ + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.programCode = None - """ Program specific reason for item inclusion. + """ Program the product or service is provided under. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.quantity = None - """ Count of Products or Services. + """ Count of products or services. Type `Quantity` (represented as `dict` in JSON). """ self.revenue = None @@ -658,23 +579,19 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Service instance. + """ Item instance identifier. Type `int`. """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.subDetail = None - """ Additional items. + """ Product or service provided. List of `ClaimItemDetailSubDetail` items (represented as `dict` in JSON). """ self.udi = None - """ Unique Device Identifier. - List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.unitPrice = None - """ Fee, charge or cost per point. + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ super(ClaimItemDetail, self).__init__(jsondict=jsondict, strict=strict) @@ -686,11 +603,11 @@ def elementProperties(self): ("factor", "factor", float, False, None, False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), ("net", "net", money.Money, False, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), ("subDetail", "subDetail", ClaimItemDetailSubDetail, True, None, False), ("udi", "udi", fhirreference.FHIRReference, True, None, False), ("unitPrice", "unitPrice", money.Money, False, None, False), @@ -699,9 +616,10 @@ def elementProperties(self): class ClaimItemDetailSubDetail(backboneelement.BackboneElement): - """ Additional items. + """ Product or service provided. - Third tier of goods and services. + A claim detail line. Either a simple (a product or service) or a 'group' of + sub-details which are simple items. """ resource_type = "ClaimItemDetailSubDetail" @@ -715,7 +633,7 @@ def __init__(self, jsondict=None, strict=True): """ self.category = None - """ Type of service or product. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.factor = None @@ -727,15 +645,19 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.net = None - """ Net additional item cost. + """ Total item cost. Type `Money` (represented as `dict` in JSON). """ + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.programCode = None - """ Program specific reason for item inclusion. + """ Program the product or service is provided under. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.quantity = None - """ Count of Products or Services. + """ Count of products or services. Type `Quantity` (represented as `dict` in JSON). """ self.revenue = None @@ -743,19 +665,15 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Service instance. + """ Item instance identifier. Type `int`. """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.udi = None - """ Unique Device Identifier. - List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.unitPrice = None - """ Fee, charge or cost per point. + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ super(ClaimItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) @@ -767,11 +685,11 @@ def elementProperties(self): ("factor", "factor", float, False, None, False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), ("net", "net", money.Money, False, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), ("udi", "udi", fhirreference.FHIRReference, True, None, False), ("unitPrice", "unitPrice", money.Money, False, None, False), ]) @@ -779,9 +697,10 @@ def elementProperties(self): class ClaimPayee(backboneelement.BackboneElement): - """ Party to be paid any benefits payable. + """ Recipient of benefits payable. - The party to be reimbursed for the services. + The party to be reimbursed for cost of the products and services according + to the terms of the policy. """ resource_type = "ClaimPayee" @@ -795,15 +714,11 @@ def __init__(self, jsondict=None, strict=True): """ self.party = None - """ Party to receive the payable. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ - - self.resourceType = None - """ organization | patient | practitioner | relatedperson. - Type `Coding` (represented as `dict` in JSON). """ + """ Recipient reference. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None - """ Type of party: Subscriber, Provider, other. + """ Category of recipient. Type `CodeableConcept` (represented as `dict` in JSON). """ super(ClaimPayee, self).__init__(jsondict=jsondict, strict=strict) @@ -812,16 +727,16 @@ def elementProperties(self): js = super(ClaimPayee, self).elementProperties() js.extend([ ("party", "party", fhirreference.FHIRReference, False, None, False), - ("resourceType", "resourceType", coding.Coding, False, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, True), ]) return js class ClaimProcedure(backboneelement.BackboneElement): - """ Procedures performed. + """ Clinical procedures performed. - Ordered list of patient procedures performed to support the adjudication. + Procedures performed on the patient relevant to the billing items with the + claim. """ resource_type = "ClaimProcedure" @@ -839,17 +754,25 @@ def __init__(self, jsondict=None, strict=True): Type `FHIRDate` (represented as `str` in JSON). """ self.procedureCodeableConcept = None - """ Patient's list of procedures performed. + """ Specific clinical procedure. Type `CodeableConcept` (represented as `dict` in JSON). """ self.procedureReference = None - """ Patient's list of procedures performed. - Type `FHIRReference` referencing `Procedure` (represented as `dict` in JSON). """ + """ Specific clinical procedure. + Type `FHIRReference` (represented as `dict` in JSON). """ self.sequence = None - """ Procedure sequence for reference. + """ Procedure instance identifier. Type `int`. """ + self.type = None + """ Category of Procedure. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + super(ClaimProcedure, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -859,15 +782,17 @@ def elementProperties(self): ("procedureCodeableConcept", "procedureCodeableConcept", codeableconcept.CodeableConcept, False, "procedure", True), ("procedureReference", "procedureReference", fhirreference.FHIRReference, False, "procedure", True), ("sequence", "sequence", int, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), ]) return js class ClaimRelated(backboneelement.BackboneElement): - """ Related Claims which may be revelant to processing this claimn. + """ Prior or corollary claims. - Other claims which are related to this claim such as prior claim versions - or for related services. + Other claims which are related to this claim such as prior submissions or + claims for related services or for the same event. """ resource_type = "ClaimRelated" @@ -882,10 +807,10 @@ def __init__(self, jsondict=None, strict=True): self.claim = None """ Reference to the related claim. - Type `FHIRReference` referencing `Claim` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.reference = None - """ Related file or case reference. + """ File or case reference. Type `Identifier` (represented as `dict` in JSON). """ self.relationship = None @@ -904,6 +829,87 @@ def elementProperties(self): return js +class ClaimSupportingInfo(backboneelement.BackboneElement): + """ Supporting information. + + Additional information codes regarding exceptions, special considerations, + the condition, situation, prior or concurrent issues. + """ + + resource_type = "ClaimSupportingInfo" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.category = None + """ Classification of the supplied information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Type of information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Explanation for the information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequence = None + """ Information instance identifier. + Type `int`. """ + + self.timingDate = None + """ When it occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingPeriod = None + """ When it occurred. + Type `Period` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Data to be provided. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Data to be provided. + Type `bool`. """ + + self.valueQuantity = None + """ Data to be provided. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Data to be provided. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueString = None + """ Data to be provided. + Type `str`. """ + + super(ClaimSupportingInfo, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimSupportingInfo, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("sequence", "sequence", int, False, None, True), + ("timingDate", "timingDate", fhirdate.FHIRDate, False, "timing", False), + ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ]) + return js + + import sys try: from . import address @@ -917,10 +923,6 @@ def elementProperties(self): from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/claim_tests.py b/fhirclient/models/claim_tests.py index ae5ce39ba..7fe79f78c 100644 --- a/fhirclient/models/claim_tests.py +++ b/fhirclient/models/claim_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,34 +37,26 @@ def implClaim1(self, inst): self.assertEqual(inst.accident.locationAddress.text, "Grouse Mountain Ski Hill") self.assertEqual(inst.accident.type.coding[0].code, "SPT") self.assertEqual(inst.accident.type.coding[0].display, "Sporting Accident") - self.assertEqual(inst.accident.type.coding[0].system, "http://hl7.org/fhir/v3/ActIncidentCode") + self.assertEqual(inst.accident.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActIncidentCode") self.assertEqual(inst.billablePeriod.end.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.billablePeriod.end.as_json(), "2014-08-16") self.assertEqual(inst.billablePeriod.start.date, FHIRDate("2014-08-15").date) self.assertEqual(inst.billablePeriod.start.as_json(), "2014-08-15") self.assertEqual(inst.careTeam[0].qualification.coding[0].code, "physician") - self.assertEqual(inst.careTeam[0].qualification.coding[0].system, "http://hl7.org/fhir/provider-qualification") + self.assertEqual(inst.careTeam[0].qualification.coding[0].system, "http://example.org/fhir/CodeSystem/provider-qualification") self.assertTrue(inst.careTeam[0].responsible) self.assertEqual(inst.careTeam[0].role.coding[0].code, "primary") - self.assertEqual(inst.careTeam[0].role.coding[0].system, "http://hl7.org/fhir/claim-careteamrole") + self.assertEqual(inst.careTeam[0].role.coding[0].system, "http://example.org/fhir/CodeSystem/claim-careteamrole") self.assertEqual(inst.careTeam[0].sequence, 1) self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654456") self.assertEqual(inst.diagnosis[0].packageCode.coding[0].code, "400") self.assertEqual(inst.diagnosis[0].packageCode.coding[0].display, "Head trauma - concussion") - self.assertEqual(inst.diagnosis[0].packageCode.coding[0].system, "http://hl7.org/fhir/ex-diagnosisrelatedgroup") + self.assertEqual(inst.diagnosis[0].packageCode.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-diagnosisrelatedgroup") self.assertEqual(inst.diagnosis[0].sequence, 1) self.assertEqual(inst.diagnosis[0].type[0].coding[0].code, "admitting") - self.assertEqual(inst.diagnosis[0].type[0].coding[0].system, "http://hl7.org/fhir/ex-diagnosistype") - self.assertEqual(inst.employmentImpacted.end.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.employmentImpacted.end.as_json(), "2014-08-16") - self.assertEqual(inst.employmentImpacted.start.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.employmentImpacted.start.as_json(), "2014-08-16") - self.assertEqual(inst.hospitalization.end.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.hospitalization.end.as_json(), "2014-08-16") - self.assertEqual(inst.hospitalization.start.date, FHIRDate("2014-08-15").date) - self.assertEqual(inst.hospitalization.start.as_json(), "2014-08-15") + self.assertEqual(inst.diagnosis[0].type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-diagnosistype") self.assertEqual(inst.id, "960151") self.assertEqual(inst.identifier[0].system, "http://happyhospital.com/claim") self.assertEqual(inst.identifier[0].value, "96123451") @@ -72,32 +64,46 @@ def implClaim1(self, inst): self.assertTrue(inst.insurance[0].focal) self.assertEqual(inst.insurance[0].preAuthRef[0], "PA2014G56473") self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") self.assertEqual(inst.item[0].net.value, 125.0) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "exam") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://hl7.org/fhir/ex-serviceproduct") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "exam") - self.assertEqual(inst.item[0].service.coding[0].system, "http://hl7.org/fhir/ex-serviceproduct") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") self.assertEqual(inst.item[0].unitPrice.value, 125.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") self.assertEqual(inst.status, "active") + self.assertEqual(inst.supportingInfo[0].category.coding[0].code, "employmentimpacted") + self.assertEqual(inst.supportingInfo[0].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/claiminformationcategory") + self.assertEqual(inst.supportingInfo[0].sequence, 1) + self.assertEqual(inst.supportingInfo[0].timingPeriod.end.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.supportingInfo[0].timingPeriod.end.as_json(), "2014-08-16") + self.assertEqual(inst.supportingInfo[0].timingPeriod.start.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.supportingInfo[0].timingPeriod.start.as_json(), "2014-08-16") + self.assertEqual(inst.supportingInfo[1].category.coding[0].code, "hospitalized") + self.assertEqual(inst.supportingInfo[1].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/claiminformationcategory") + self.assertEqual(inst.supportingInfo[1].sequence, 2) + self.assertEqual(inst.supportingInfo[1].timingPeriod.end.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.supportingInfo[1].timingPeriod.end.as_json(), "2014-08-16") + self.assertEqual(inst.supportingInfo[1].timingPeriod.start.date, FHIRDate("2014-08-15").date) + self.assertEqual(inst.supportingInfo[1].timingPeriod.start.as_json(), "2014-08-15") self.assertEqual(inst.text.div, "
A human-readable rendering of the Claim
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.total.code, "USD") - self.assertEqual(inst.total.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.total.currency, "USD") self.assertEqual(inst.total.value, 125.0) self.assertEqual(inst.type.coding[0].code, "institutional") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") def testClaim2(self): - inst = self.instantiate_from("claim-example-institutional.json") + inst = self.instantiate_from("claim-example-professional.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim2(inst) @@ -112,39 +118,35 @@ def implClaim2(self, inst): self.assertEqual(inst.created.as_json(), "2014-08-16") self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654456") self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "960150") - self.assertEqual(inst.identifier[0].system, "http://happyhospital.com/claim") - self.assertEqual(inst.identifier[0].value, "9612345") + self.assertEqual(inst.id, "860150") + self.assertEqual(inst.identifier[0].system, "http://happypdocs.com/claim") + self.assertEqual(inst.identifier[0].value, "8612345") self.assertTrue(inst.insurance[0].focal) self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].net.value, 125.0) + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") + self.assertEqual(inst.item[0].net.value, 75.0) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "exam") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://hl7.org/fhir/ex-serviceproduct") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "exam") - self.assertEqual(inst.item[0].service.coding[0].system, "http://hl7.org/fhir/ex-serviceproduct") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].unitPrice.value, 125.0) + self.assertEqual(inst.item[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].unitPrice.value, 75.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") self.assertEqual(inst.status, "active") - self.assertEqual(inst.subType[0].coding[0].code, "emergency") - self.assertEqual(inst.subType[0].coding[0].system, "http://hl7.org/fhir/ex-claimsubtype") self.assertEqual(inst.text.div, "
A human-readable rendering of the Claim
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.total.code, "USD") - self.assertEqual(inst.total.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.total.value, 125.0) - self.assertEqual(inst.type.coding[0].code, "institutional") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.type.coding[0].code, "professional") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") def testClaim3(self): - inst = self.instantiate_from("claim-example-oral-average.json") + inst = self.instantiate_from("claim-example.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim3(inst) @@ -159,98 +161,36 @@ def implClaim3(self, inst): self.assertEqual(inst.created.as_json(), "2014-08-16") self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "123456") self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "100151") + self.assertEqual(inst.id, "100150") self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") - self.assertEqual(inst.identifier[0].value, "12346") - self.assertEqual(inst.information[0].category.coding[0].code, "missingtooth") - self.assertEqual(inst.information[0].category.coding[0].system, "http://hl7.org/fhir/claiminformationcategory") - self.assertEqual(inst.information[0].code.coding[0].code, "15") - self.assertEqual(inst.information[0].code.coding[0].system, "http://hl7.org/fhir/ex-tooth") - self.assertEqual(inst.information[0].reason.coding[0].code, "e") - self.assertEqual(inst.information[0].reason.coding[0].system, "http://hl7.org/fhir/missingtoothreason") - self.assertEqual(inst.information[0].sequence, 1) - self.assertEqual(inst.information[0].timingDate.date, FHIRDate("2012-04-07").date) - self.assertEqual(inst.information[0].timingDate.as_json(), "2012-04-07") - self.assertEqual(inst.information[1].category.coding[0].code, "exception") - self.assertEqual(inst.information[1].category.coding[0].system, "http://hl7.org/fhir/claiminformationcategory") - self.assertEqual(inst.information[1].code.coding[0].code, "student") - self.assertEqual(inst.information[1].code.coding[0].system, "http://hl7.org/fhir/claim-exception") - self.assertEqual(inst.information[1].sequence, 2) - self.assertEqual(inst.information[1].valueString, "Happy Valley Community College") + self.assertEqual(inst.identifier[0].value, "12345") self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.insurance[0].identifier.system, "http://happyvalley.com/claim") + self.assertEqual(inst.insurance[0].identifier.value, "12345") self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") self.assertEqual(inst.item[0].net.value, 135.57) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "1200") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "1200") - self.assertEqual(inst.item[0].service.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") self.assertEqual(inst.item[0].unitPrice.value, 135.57) - self.assertEqual(inst.item[1].bodySite.coding[0].code, "21") - self.assertEqual(inst.item[1].bodySite.coding[0].system, "http://fdi.org/fhir/oraltoothcodes") - self.assertEqual(inst.item[1].careTeamLinkId[0], 1) - self.assertEqual(inst.item[1].net.code, "USD") - self.assertEqual(inst.item[1].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[1].net.value, 105.0) - self.assertEqual(inst.item[1].sequence, 2) - self.assertEqual(inst.item[1].service.coding[0].code, "21211") - self.assertEqual(inst.item[1].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[1].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[1].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[1].subSite[0].coding[0].code, "L") - self.assertEqual(inst.item[1].subSite[0].coding[0].system, "http://fdi.org/fhir/oralsurfacecodes") - self.assertEqual(inst.item[1].unitPrice.code, "USD") - self.assertEqual(inst.item[1].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[1].unitPrice.value, 105.0) - self.assertEqual(inst.item[2].bodySite.coding[0].code, "36") - self.assertEqual(inst.item[2].bodySite.coding[0].system, "http://fdi.org/fhir/oraltoothcodes") - self.assertEqual(inst.item[2].careTeamLinkId[0], 1) - self.assertEqual(inst.item[2].detail[0].factor, 0.75) - self.assertEqual(inst.item[2].detail[0].net.code, "USD") - self.assertEqual(inst.item[2].detail[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[0].net.value, 750.0) - self.assertEqual(inst.item[2].detail[0].sequence, 1) - self.assertEqual(inst.item[2].detail[0].service.coding[0].code, "27211") - self.assertEqual(inst.item[2].detail[0].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].detail[0].unitPrice.code, "USD") - self.assertEqual(inst.item[2].detail[0].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[0].unitPrice.value, 1000.0) - self.assertEqual(inst.item[2].detail[1].net.code, "USD") - self.assertEqual(inst.item[2].detail[1].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[1].net.value, 350.0) - self.assertEqual(inst.item[2].detail[1].sequence, 2) - self.assertEqual(inst.item[2].detail[1].service.coding[0].code, "lab") - self.assertEqual(inst.item[2].detail[1].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].detail[1].unitPrice.code, "USD") - self.assertEqual(inst.item[2].detail[1].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[1].unitPrice.value, 350.0) - self.assertEqual(inst.item[2].net.code, "USD") - self.assertEqual(inst.item[2].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].net.value, 1100.0) - self.assertEqual(inst.item[2].sequence, 3) - self.assertEqual(inst.item[2].service.coding[0].code, "27211") - self.assertEqual(inst.item[2].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[2].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[2].unitPrice.code, "USD") - self.assertEqual(inst.item[2].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].unitPrice.value, 1100.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "oral") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") def testClaim4(self): - inst = self.instantiate_from("claim-example-oral-bridge.json") + inst = self.instantiate_from("claim-example-vision.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim4(inst) @@ -261,118 +201,39 @@ def testClaim4(self): def implClaim4(self, inst): self.assertEqual(inst.careTeam[0].sequence, 1) - self.assertEqual(inst.contained[0].id, "device-bridge") - self.assertEqual(inst.contained[1].id, "referral") self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "100156") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") - self.assertEqual(inst.identifier[0].value, "123466") - self.assertEqual(inst.information[0].category.coding[0].code, "prosthesis") - self.assertEqual(inst.information[0].category.coding[0].system, "http://hl7.org/fhir/claiminformationcategory") - self.assertEqual(inst.information[0].code.coding[0].code, "2") - self.assertEqual(inst.information[0].code.coding[0].display, "Maryland Bridge") - self.assertEqual(inst.information[0].code.coding[0].system, "http://hl7.org/fhir/ex-oralprostho") - self.assertEqual(inst.information[0].sequence, 1) - self.assertEqual(inst.information[0].timingDate.date, FHIRDate("2001-04-07").date) - self.assertEqual(inst.information[0].timingDate.as_json(), "2001-04-07") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654321") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "660150") + self.assertEqual(inst.identifier[0].system, "http://happysight.com/claim") + self.assertEqual(inst.identifier[0].value, "6612345") self.assertTrue(inst.insurance[0].focal) self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].bodySite.coding[0].code, "01") - self.assertEqual(inst.item[0].bodySite.coding[0].system, "http://fdi.org/fhir/oraltoothcodes") - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].factor, 0.75) - self.assertEqual(inst.item[0].informationLinkId[0], 1) - self.assertEqual(inst.item[0].locationCodeableConcept.coding[0].code, "11") - self.assertEqual(inst.item[0].locationCodeableConcept.coding[0].system, "http://hl7.org/fhir/ex-serviceplace") - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].net.value, 1050.0) + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") + self.assertEqual(inst.item[0].net.value, 80.0) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "exam") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "67221") - self.assertEqual(inst.item[0].service.coding[0].display, "Maryland Bridge") - self.assertEqual(inst.item[0].service.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].unitPrice.value, 1400.0) - self.assertEqual(inst.item[1].bodySite.coding[0].code, "21") - self.assertEqual(inst.item[1].bodySite.coding[0].system, "http://fdi.org/fhir/oraltoothcodes") - self.assertEqual(inst.item[1].careTeamLinkId[0], 1) - self.assertEqual(inst.item[1].locationCodeableConcept.coding[0].code, "11") - self.assertEqual(inst.item[1].locationCodeableConcept.coding[0].system, "http://hl7.org/fhir/ex-serviceplace") - self.assertEqual(inst.item[1].net.code, "USD") - self.assertEqual(inst.item[1].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[1].net.value, 105.0) - self.assertEqual(inst.item[1].sequence, 2) - self.assertEqual(inst.item[1].service.coding[0].code, "21211") - self.assertEqual(inst.item[1].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[1].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[1].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[1].subSite[0].coding[0].code, "L") - self.assertEqual(inst.item[1].subSite[0].coding[0].system, "http://fdi.org/fhir/oralsurfacecodes") - self.assertEqual(inst.item[1].unitPrice.code, "USD") - self.assertEqual(inst.item[1].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[1].unitPrice.value, 105.0) - self.assertEqual(inst.item[2].bodySite.coding[0].code, "24") - self.assertEqual(inst.item[2].bodySite.coding[0].system, "http://fdi.org/fhir/oraltoothcodes") - self.assertEqual(inst.item[2].careTeamLinkId[0], 1) - self.assertEqual(inst.item[2].detail[0].factor, 0.75) - self.assertEqual(inst.item[2].detail[0].net.code, "USD") - self.assertEqual(inst.item[2].detail[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[0].net.value, 750.0) - self.assertEqual(inst.item[2].detail[0].sequence, 1) - self.assertEqual(inst.item[2].detail[0].service.coding[0].code, "27211") - self.assertEqual(inst.item[2].detail[0].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].detail[0].unitPrice.code, "USD") - self.assertEqual(inst.item[2].detail[0].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[0].unitPrice.value, 1000.0) - self.assertEqual(inst.item[2].detail[1].net.code, "USD") - self.assertEqual(inst.item[2].detail[1].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[1].net.value, 350.0) - self.assertEqual(inst.item[2].detail[1].sequence, 2) - self.assertEqual(inst.item[2].detail[1].service.coding[0].code, "lab") - self.assertEqual(inst.item[2].detail[1].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].detail[1].unitPrice.code, "USD") - self.assertEqual(inst.item[2].detail[1].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].detail[1].unitPrice.value, 350.0) - self.assertEqual(inst.item[2].locationCodeableConcept.coding[0].code, "11") - self.assertEqual(inst.item[2].locationCodeableConcept.coding[0].system, "http://hl7.org/fhir/ex-serviceplace") - self.assertEqual(inst.item[2].net.code, "USD") - self.assertEqual(inst.item[2].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].net.value, 1100.0) - self.assertEqual(inst.item[2].procedureLinkId[0], 1) - self.assertEqual(inst.item[2].sequence, 3) - self.assertEqual(inst.item[2].service.coding[0].code, "27211") - self.assertEqual(inst.item[2].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[2].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[2].unitPrice.code, "USD") - self.assertEqual(inst.item[2].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[2].unitPrice.value, 1100.0) - self.assertEqual(inst.payee.type.coding[0].code, "other") - self.assertEqual(inst.payee.type.coding[0].system, "http://hl7.org/fhir/payeetype") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].unitPrice.value, 80.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") - self.assertEqual(inst.procedure[0].date.date, FHIRDate("2014-07-04").date) - self.assertEqual(inst.procedure[0].date.as_json(), "2014-07-04") - self.assertEqual(inst.procedure[0].procedureCodeableConcept.text, "Resection of gum to increase exposed tooth.") - self.assertEqual(inst.procedure[0].sequence, 1) - self.assertEqual(inst.related[0].reference.value, "CASE156746B") - self.assertEqual(inst.related[0].relationship.coding[0].code, "associated") - self.assertEqual(inst.related[0].relationship.coding[0].system, "http://hl7.org/fhir/ex-relatedclaimrelationship") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Vision Claim
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.total.code, "USD") - self.assertEqual(inst.total.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.total.value, 2255.0) - self.assertEqual(inst.type.coding[0].code, "oral") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.type.coding[0].code, "vision") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") def testClaim5(self): - inst = self.instantiate_from("claim-example-oral-contained-identifier.json") + inst = self.instantiate_from("claim-example-vision-glasses-3tier.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim5(inst) @@ -383,38 +244,154 @@ def testClaim5(self): def implClaim5(self, inst): self.assertEqual(inst.careTeam[0].sequence, 1) - self.assertEqual(inst.contained[0].id, "patient-1") + self.assertEqual(inst.contained[0].id, "device-frame") + self.assertEqual(inst.contained[1].id, "device-lens") self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "123456") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654321") self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "100155") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") - self.assertEqual(inst.identifier[0].value, "12347") - self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.id, "660152") + self.assertEqual(inst.identifier[0].system, "http://happysight.com/claim") + self.assertEqual(inst.identifier[0].value, "6612347") + self.assertFalse(inst.insurance[0].focal) + self.assertEqual(inst.insurance[0].preAuthRef[0], "PR7652387237") self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].net.value, 135.57) + self.assertTrue(inst.insurance[1].focal) + self.assertEqual(inst.insurance[1].preAuthRef[0], "AB543GTD7567") + self.assertEqual(inst.insurance[1].sequence, 2) + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].category.coding[0].code, "F6") + self.assertEqual(inst.item[0].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.item[0].category.coding[0].system, "http://example.org/fhir/CodeSystem/benefit-subcategory") + self.assertEqual(inst.item[0].detail[0].category.coding[0].code, "F6") + self.assertEqual(inst.item[0].detail[0].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.item[0].detail[0].category.coding[0].system, "http://example.org/fhir/CodeSystem/benefit-subcategory") + self.assertEqual(inst.item[0].detail[0].factor, 1.1) + self.assertEqual(inst.item[0].detail[0].modifier[0].coding[0].code, "rooh") + self.assertEqual(inst.item[0].detail[0].modifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/modifiers") + self.assertEqual(inst.item[0].detail[0].net.currency, "USD") + self.assertEqual(inst.item[0].detail[0].net.value, 110.0) + self.assertEqual(inst.item[0].detail[0].productOrService.coding[0].code, "frame") + self.assertEqual(inst.item[0].detail[0].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") + self.assertEqual(inst.item[0].detail[0].revenue.coding[0].code, "0010") + self.assertEqual(inst.item[0].detail[0].revenue.coding[0].display, "Vision Clinic") + self.assertEqual(inst.item[0].detail[0].revenue.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-revenue-center") + self.assertEqual(inst.item[0].detail[0].sequence, 1) + self.assertEqual(inst.item[0].detail[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[0].unitPrice.value, 100.0) + self.assertEqual(inst.item[0].detail[1].category.coding[0].code, "F6") + self.assertEqual(inst.item[0].detail[1].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.item[0].detail[1].category.coding[0].system, "http://example.org/fhir/CodeSystem/benefit-subcategory") + self.assertEqual(inst.item[0].detail[1].net.currency, "USD") + self.assertEqual(inst.item[0].detail[1].net.value, 110.0) + self.assertEqual(inst.item[0].detail[1].productOrService.coding[0].code, "lens") + self.assertEqual(inst.item[0].detail[1].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].programCode[0].coding[0].code, "none") + self.assertEqual(inst.item[0].detail[1].programCode[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-programcode") + self.assertEqual(inst.item[0].detail[1].quantity.value, 2) + self.assertEqual(inst.item[0].detail[1].revenue.coding[0].code, "0010") + self.assertEqual(inst.item[0].detail[1].revenue.coding[0].display, "Vision Clinic") + self.assertEqual(inst.item[0].detail[1].revenue.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].sequence, 2) + self.assertEqual(inst.item[0].detail[1].subDetail[0].category.coding[0].code, "F6") + self.assertEqual(inst.item[0].detail[1].subDetail[0].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.item[0].detail[1].subDetail[0].category.coding[0].system, "http://example.org/fhir/CodeSystem/benefit-subcategory") + self.assertEqual(inst.item[0].detail[1].subDetail[0].factor, 1.1) + self.assertEqual(inst.item[0].detail[1].subDetail[0].modifier[0].coding[0].code, "rooh") + self.assertEqual(inst.item[0].detail[1].subDetail[0].modifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/modifiers") + self.assertEqual(inst.item[0].detail[1].subDetail[0].net.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[0].net.value, 66.0) + self.assertEqual(inst.item[0].detail[1].subDetail[0].productOrService.coding[0].code, "lens") + self.assertEqual(inst.item[0].detail[1].subDetail[0].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].subDetail[0].programCode[0].coding[0].code, "none") + self.assertEqual(inst.item[0].detail[1].subDetail[0].programCode[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-programcode") + self.assertEqual(inst.item[0].detail[1].subDetail[0].quantity.value, 2) + self.assertEqual(inst.item[0].detail[1].subDetail[0].revenue.coding[0].code, "0010") + self.assertEqual(inst.item[0].detail[1].subDetail[0].revenue.coding[0].display, "Vision Clinic") + self.assertEqual(inst.item[0].detail[1].subDetail[0].revenue.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].subDetail[0].sequence, 1) + self.assertEqual(inst.item[0].detail[1].subDetail[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[0].unitPrice.value, 30.0) + self.assertEqual(inst.item[0].detail[1].subDetail[1].category.coding[0].code, "F6") + self.assertEqual(inst.item[0].detail[1].subDetail[1].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.item[0].detail[1].subDetail[1].category.coding[0].system, "http://example.org/fhir/CodeSystem/benefit-subcategory") + self.assertEqual(inst.item[0].detail[1].subDetail[1].factor, 1.1) + self.assertEqual(inst.item[0].detail[1].subDetail[1].modifier[0].coding[0].code, "rooh") + self.assertEqual(inst.item[0].detail[1].subDetail[1].modifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/modifiers") + self.assertEqual(inst.item[0].detail[1].subDetail[1].net.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[1].net.value, 33.0) + self.assertEqual(inst.item[0].detail[1].subDetail[1].productOrService.coding[0].code, "hardening") + self.assertEqual(inst.item[0].detail[1].subDetail[1].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].subDetail[1].quantity.value, 2) + self.assertEqual(inst.item[0].detail[1].subDetail[1].revenue.coding[0].code, "0010") + self.assertEqual(inst.item[0].detail[1].subDetail[1].revenue.coding[0].display, "Vision Clinic") + self.assertEqual(inst.item[0].detail[1].subDetail[1].revenue.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].subDetail[1].sequence, 2) + self.assertEqual(inst.item[0].detail[1].subDetail[1].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[1].unitPrice.value, 15.0) + self.assertEqual(inst.item[0].detail[1].subDetail[2].category.coding[0].code, "F6") + self.assertEqual(inst.item[0].detail[1].subDetail[2].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.item[0].detail[1].subDetail[2].category.coding[0].system, "http://example.org/fhir/CodeSystem/benefit-subcategory") + self.assertEqual(inst.item[0].detail[1].subDetail[2].factor, 1.1) + self.assertEqual(inst.item[0].detail[1].subDetail[2].modifier[0].coding[0].code, "rooh") + self.assertEqual(inst.item[0].detail[1].subDetail[2].modifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/modifiers") + self.assertEqual(inst.item[0].detail[1].subDetail[2].net.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[2].net.value, 11.0) + self.assertEqual(inst.item[0].detail[1].subDetail[2].productOrService.coding[0].code, "UV coating") + self.assertEqual(inst.item[0].detail[1].subDetail[2].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") + self.assertEqual(inst.item[0].detail[1].subDetail[2].quantity.value, 2) + self.assertEqual(inst.item[0].detail[1].subDetail[2].revenue.coding[0].code, "0010") + self.assertEqual(inst.item[0].detail[1].subDetail[2].revenue.coding[0].display, "Vision Clinic") + self.assertEqual(inst.item[0].detail[1].subDetail[2].revenue.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-revenue-center") + self.assertEqual(inst.item[0].detail[1].subDetail[2].sequence, 3) + self.assertEqual(inst.item[0].detail[1].subDetail[2].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[2].unitPrice.value, 5.0) + self.assertEqual(inst.item[0].detail[1].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[1].unitPrice.value, 55.0) + self.assertEqual(inst.item[0].detail[2].category.coding[0].code, "F6") + self.assertEqual(inst.item[0].detail[2].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.item[0].detail[2].category.coding[0].system, "http://example.org/fhir/CodeSystem/benefit-subcategory") + self.assertEqual(inst.item[0].detail[2].factor, 0.07) + self.assertEqual(inst.item[0].detail[2].net.currency, "USD") + self.assertEqual(inst.item[0].detail[2].net.value, 15.4) + self.assertEqual(inst.item[0].detail[2].productOrService.coding[0].code, "fst") + self.assertEqual(inst.item[0].detail[2].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") + self.assertEqual(inst.item[0].detail[2].revenue.coding[0].code, "0010") + self.assertEqual(inst.item[0].detail[2].revenue.coding[0].display, "Vision Clinic") + self.assertEqual(inst.item[0].detail[2].revenue.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-revenue-center") + self.assertEqual(inst.item[0].detail[2].sequence, 3) + self.assertEqual(inst.item[0].detail[2].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].detail[2].unitPrice.value, 220.0) + self.assertEqual(inst.item[0].modifier[0].coding[0].code, "rooh") + self.assertEqual(inst.item[0].modifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/modifiers") + self.assertEqual(inst.item[0].net.currency, "USD") + self.assertEqual(inst.item[0].net.value, 235.4) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "glasses") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://example.org/fhir/CodeSystem/ex-visionservice") + self.assertEqual(inst.item[0].programCode[0].coding[0].code, "none") + self.assertEqual(inst.item[0].programCode[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-programcode") + self.assertEqual(inst.item[0].revenue.coding[0].code, "0010") + self.assertEqual(inst.item[0].revenue.coding[0].display, "Vision Clinic") + self.assertEqual(inst.item[0].revenue.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-revenue-center") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "1200") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].unitPrice.value, 135.57) + self.assertEqual(inst.item[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].unitPrice.value, 235.4) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
This example assumes a national health care scheme where patients, providers and organizations have known business identifiers.
") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Vision Claim for Glasses
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "oral") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.type.coding[0].code, "vision") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") def testClaim6(self): - inst = self.instantiate_from("claim-example-oral-contained.json") + inst = self.instantiate_from("claim-example-institutional.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim6(inst) @@ -425,42 +402,49 @@ def testClaim6(self): def implClaim6(self, inst): self.assertEqual(inst.careTeam[0].sequence, 1) - self.assertEqual(inst.contained[0].id, "org-insurer") - self.assertEqual(inst.contained[1].id, "org-org") - self.assertEqual(inst.contained[2].id, "provider-1") - self.assertEqual(inst.contained[3].id, "patient-1") - self.assertEqual(inst.contained[4].id, "coverage-1") self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "123456") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654456") self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "100152") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") - self.assertEqual(inst.identifier[0].value, "12347") + self.assertEqual(inst.id, "960150") + self.assertEqual(inst.identifier[0].system, "http://happyhospital.com/claim") + self.assertEqual(inst.identifier[0].value, "9612345") self.assertTrue(inst.insurance[0].focal) self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].net.value, 135.57) + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") + self.assertEqual(inst.item[0].net.value, 125.0) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "exam") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://hl7.org/fhir/ex-serviceproduct") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "1200") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].unitPrice.value, 135.57) + self.assertEqual(inst.item[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].unitPrice.value, 125.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") + self.assertEqual(inst.procedure[0].date.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.procedure[0].date.as_json(), "2014-08-16") + self.assertEqual(inst.procedure[0].procedureCodeableConcept.coding[0].code, "SDI9901") + self.assertEqual(inst.procedure[0].procedureCodeableConcept.text, "Subcutaneous diagnostic implant") + self.assertEqual(inst.procedure[0].sequence, 1) + self.assertEqual(inst.procedure[0].type[0].coding[0].code, "primary") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") + self.assertEqual(inst.subType.coding[0].code, "emergency") + self.assertEqual(inst.subType.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-claimsubtype") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Claim
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "oral") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.total.currency, "USD") + self.assertEqual(inst.total.value, 125.0) + self.assertEqual(inst.type.coding[0].code, "institutional") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") def testClaim7(self): - inst = self.instantiate_from("claim-example-oral-identifier.json") + inst = self.instantiate_from("claim-example-oral-contained.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim7(inst) @@ -471,37 +455,43 @@ def testClaim7(self): def implClaim7(self, inst): self.assertEqual(inst.careTeam[0].sequence, 1) + self.assertEqual(inst.contained[0].id, "org-insurer") + self.assertEqual(inst.contained[1].id, "org-org") + self.assertEqual(inst.contained[2].id, "provider-1") + self.assertEqual(inst.contained[3].id, "patient-1") + self.assertEqual(inst.contained[4].id, "coverage-1") self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "123456") self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "100154") + self.assertEqual(inst.id, "100152") self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/claim") self.assertEqual(inst.identifier[0].value, "12347") self.assertTrue(inst.insurance[0].focal) self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") self.assertEqual(inst.item[0].net.value, 135.57) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "1200") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "1200") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") self.assertEqual(inst.item[0].unitPrice.value, 135.57) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
This example assumes a national health care scheme where patients, providers and organizations have known business identifiers.
") + self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "oral") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") def testClaim8(self): - inst = self.instantiate_from("claim-example-oral-orthoplan.json") + inst = self.instantiate_from("claim-example-pharmacy-medication.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim8(inst) @@ -511,6 +501,86 @@ def testClaim8(self): self.implClaim8(inst2) def implClaim8(self, inst): + self.assertEqual(inst.careTeam[0].sequence, 1) + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654456") + self.assertEqual(inst.diagnosis[0].sequence, 1) + self.assertEqual(inst.id, "760151") + self.assertEqual(inst.identifier[0].system, "http://happypharma.com/claim") + self.assertEqual(inst.identifier[0].value, "7612345") + self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.insurance[0].sequence, 1) + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].detail[0].net.currency, "USD") + self.assertEqual(inst.item[0].detail[0].net.value, 45.0) + self.assertEqual(inst.item[0].detail[0].productOrService.coding[0].code, "drugcost") + self.assertEqual(inst.item[0].detail[0].productOrService.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") + self.assertEqual(inst.item[0].detail[0].sequence, 1) + self.assertEqual(inst.item[0].detail[1].net.currency, "USD") + self.assertEqual(inst.item[0].detail[1].net.value, 9.0) + self.assertEqual(inst.item[0].detail[1].productOrService.coding[0].code, "markup") + self.assertEqual(inst.item[0].detail[1].productOrService.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") + self.assertEqual(inst.item[0].detail[1].sequence, 2) + self.assertEqual(inst.item[0].detail[2].net.currency, "USD") + self.assertEqual(inst.item[0].detail[2].net.value, 36.0) + self.assertEqual(inst.item[0].detail[2].productOrService.coding[0].code, "dispensefee") + self.assertEqual(inst.item[0].detail[2].productOrService.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") + self.assertEqual(inst.item[0].detail[2].sequence, 3) + self.assertEqual(inst.item[0].informationSequence[0], 1) + self.assertEqual(inst.item[0].informationSequence[1], 2) + self.assertEqual(inst.item[0].informationSequence[2], 3) + self.assertEqual(inst.item[0].net.currency, "USD") + self.assertEqual(inst.item[0].net.value, 90.0) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "562721") + self.assertEqual(inst.item[0].productOrService.coding[0].display, "Alprazolam 0.25mg (Xanax)") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://www.nlm.nih.gov/research/umls/rxnorm") + self.assertEqual(inst.item[0].quantity.code, "TAB") + self.assertEqual(inst.item[0].quantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.item[0].quantity.unit, "TAB") + self.assertEqual(inst.item[0].quantity.value, 90) + self.assertEqual(inst.item[0].sequence, 1) + self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.payee.type.coding[0].code, "provider") + self.assertEqual(inst.priority.coding[0].code, "stat") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.supportingInfo[0].category.coding[0].code, "pharmacyrefill") + self.assertEqual(inst.supportingInfo[0].code.coding[0].code, "new") + self.assertEqual(inst.supportingInfo[0].code.coding[0].system, "http://example.org/fhir/CodeSystem/pharmacy-refill") + self.assertEqual(inst.supportingInfo[0].sequence, 1) + self.assertEqual(inst.supportingInfo[1].category.coding[0].code, "pharmacyinformation") + self.assertEqual(inst.supportingInfo[1].code.coding[0].code, "refillsremaining") + self.assertEqual(inst.supportingInfo[1].code.coding[0].system, "http://example.org/fhir/CodeSystem/pharmacy-information") + self.assertEqual(inst.supportingInfo[1].sequence, 2) + self.assertEqual(inst.supportingInfo[1].valueQuantity.value, 2) + self.assertEqual(inst.supportingInfo[2].category.coding[0].code, "pharmacyinformation") + self.assertEqual(inst.supportingInfo[2].code.coding[0].code, "dayssupply") + self.assertEqual(inst.supportingInfo[2].code.coding[0].system, "http://example.org/fhir/CodeSystem/pharmacy-information") + self.assertEqual(inst.supportingInfo[2].sequence, 3) + self.assertEqual(inst.supportingInfo[2].valueQuantity.value, 90) + self.assertEqual(inst.text.div, "
A human-readable rendering of the Pharmacy Claim
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.total.currency, "USD") + self.assertEqual(inst.total.value, 90.0) + self.assertEqual(inst.type.coding[0].code, "pharmacy") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") + + def testClaim9(self): + inst = self.instantiate_from("claim-example-oral-orthoplan.json") + self.assertIsNotNone(inst, "Must have instantiated a Claim instance") + self.implClaim9(inst) + + js = inst.as_json() + self.assertEqual("Claim", js["resourceType"]) + inst2 = claim.Claim(js) + self.implClaim9(inst2) + + def implClaim9(self, inst): self.assertEqual(inst.careTeam[0].sequence, 1) self.assertEqual(inst.created.date, FHIRDate("2015-03-16").date) self.assertEqual(inst.created.as_json(), "2015-03-16") @@ -523,245 +593,104 @@ def implClaim8(self, inst): self.assertEqual(inst.identifier[0].value, "12355") self.assertTrue(inst.insurance[0].focal) self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].detail[0].net.code, "USD") - self.assertEqual(inst.item[0].detail[0].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].detail[0].net.currency, "USD") self.assertEqual(inst.item[0].detail[0].net.value, 1000.0) + self.assertEqual(inst.item[0].detail[0].productOrService.coding[0].code, "ORTHOEXAM") + self.assertEqual(inst.item[0].detail[0].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].detail[0].sequence, 1) - self.assertEqual(inst.item[0].detail[0].service.coding[0].code, "ORTHOEXAM") - self.assertEqual(inst.item[0].detail[0].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[0].detail[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].detail[0].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[0].unitPrice.currency, "USD") self.assertEqual(inst.item[0].detail[0].unitPrice.value, 1000.0) - self.assertEqual(inst.item[0].detail[1].net.code, "USD") - self.assertEqual(inst.item[0].detail[1].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[1].net.currency, "USD") self.assertEqual(inst.item[0].detail[1].net.value, 1500.0) + self.assertEqual(inst.item[0].detail[1].productOrService.coding[0].code, "ORTHODIAG") + self.assertEqual(inst.item[0].detail[1].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].detail[1].sequence, 2) - self.assertEqual(inst.item[0].detail[1].service.coding[0].code, "ORTHODIAG") - self.assertEqual(inst.item[0].detail[1].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[0].detail[1].unitPrice.code, "USD") - self.assertEqual(inst.item[0].detail[1].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[1].unitPrice.currency, "USD") self.assertEqual(inst.item[0].detail[1].unitPrice.value, 1500.0) - self.assertEqual(inst.item[0].detail[2].net.code, "USD") - self.assertEqual(inst.item[0].detail[2].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[2].net.currency, "USD") self.assertEqual(inst.item[0].detail[2].net.value, 500.0) + self.assertEqual(inst.item[0].detail[2].productOrService.coding[0].code, "ORTHOINITIAL") + self.assertEqual(inst.item[0].detail[2].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].detail[2].sequence, 3) - self.assertEqual(inst.item[0].detail[2].service.coding[0].code, "ORTHOINITIAL") - self.assertEqual(inst.item[0].detail[2].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[0].detail[2].unitPrice.code, "USD") - self.assertEqual(inst.item[0].detail[2].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[2].unitPrice.currency, "USD") self.assertEqual(inst.item[0].detail[2].unitPrice.value, 500.0) + self.assertEqual(inst.item[0].detail[3].productOrService.coding[0].code, "ORTHOMONTHS") + self.assertEqual(inst.item[0].detail[3].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].detail[3].quantity.value, 24) self.assertEqual(inst.item[0].detail[3].sequence, 4) - self.assertEqual(inst.item[0].detail[3].service.coding[0].code, "ORTHOMONTHS") - self.assertEqual(inst.item[0].detail[3].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[0].detail[4].net.code, "USD") - self.assertEqual(inst.item[0].detail[4].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[4].net.currency, "USD") self.assertEqual(inst.item[0].detail[4].net.value, 250.0) + self.assertEqual(inst.item[0].detail[4].productOrService.coding[0].code, "ORTHOPERIODIC") + self.assertEqual(inst.item[0].detail[4].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].detail[4].quantity.value, 24) self.assertEqual(inst.item[0].detail[4].sequence, 5) - self.assertEqual(inst.item[0].detail[4].service.coding[0].code, "ORTHOPERIODIC") - self.assertEqual(inst.item[0].detail[4].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[0].detail[4].unitPrice.code, "USD") - self.assertEqual(inst.item[0].detail[4].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].detail[4].unitPrice.currency, "USD") self.assertEqual(inst.item[0].detail[4].unitPrice.value, 250.0) - self.assertEqual(inst.item[0].diagnosisLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].diagnosisSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") self.assertEqual(inst.item[0].net.value, 9000.0) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "ORTHPLAN") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "ORTHPLAN") - self.assertEqual(inst.item[0].service.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2015-05-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2015-05-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") self.assertEqual(inst.item[0].unitPrice.value, 9000.0) self.assertEqual(inst.item[1].bodySite.coding[0].code, "21") self.assertEqual(inst.item[1].bodySite.coding[0].system, "http://fdi.org/fhir/oraltoothcodes") - self.assertEqual(inst.item[1].careTeamLinkId[0], 1) - self.assertEqual(inst.item[1].net.code, "USD") - self.assertEqual(inst.item[1].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[1].careTeamSequence[0], 1) + self.assertEqual(inst.item[1].net.currency, "USD") self.assertEqual(inst.item[1].net.value, 105.0) + self.assertEqual(inst.item[1].productOrService.coding[0].code, "21211") + self.assertEqual(inst.item[1].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[1].sequence, 2) - self.assertEqual(inst.item[1].service.coding[0].code, "21211") - self.assertEqual(inst.item[1].service.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[1].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[1].servicedDate.as_json(), "2014-08-16") self.assertEqual(inst.item[1].subSite[0].coding[0].code, "L") self.assertEqual(inst.item[1].subSite[0].coding[0].system, "http://fdi.org/fhir/oralsurfacecodes") - self.assertEqual(inst.item[1].unitPrice.code, "USD") - self.assertEqual(inst.item[1].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[1].unitPrice.currency, "USD") self.assertEqual(inst.item[1].unitPrice.value, 105.0) self.assertEqual(inst.item[2].bodySite.coding[0].code, "36") self.assertEqual(inst.item[2].bodySite.coding[0].system, "http://fdi.org/fhir/oraltoothcodes") - self.assertEqual(inst.item[2].careTeamLinkId[0], 1) - self.assertEqual(inst.item[2].detail[0].net.code, "USD") - self.assertEqual(inst.item[2].detail[0].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[2].careTeamSequence[0], 1) + self.assertEqual(inst.item[2].detail[0].net.currency, "USD") self.assertEqual(inst.item[2].detail[0].net.value, 750.0) + self.assertEqual(inst.item[2].detail[0].productOrService.coding[0].code, "27211") + self.assertEqual(inst.item[2].detail[0].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[2].detail[0].sequence, 1) - self.assertEqual(inst.item[2].detail[0].service.coding[0].code, "27211") - self.assertEqual(inst.item[2].detail[0].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].detail[0].unitPrice.code, "USD") - self.assertEqual(inst.item[2].detail[0].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[2].detail[0].unitPrice.currency, "USD") self.assertEqual(inst.item[2].detail[0].unitPrice.value, 750.0) - self.assertEqual(inst.item[2].detail[1].net.code, "USD") - self.assertEqual(inst.item[2].detail[1].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[2].detail[1].net.currency, "USD") self.assertEqual(inst.item[2].detail[1].net.value, 350.0) + self.assertEqual(inst.item[2].detail[1].productOrService.coding[0].code, "lab") + self.assertEqual(inst.item[2].detail[1].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[2].detail[1].sequence, 2) - self.assertEqual(inst.item[2].detail[1].service.coding[0].code, "lab") - self.assertEqual(inst.item[2].detail[1].service.coding[0].system, "http://example.org/fhir/oralservicecodes") - self.assertEqual(inst.item[2].detail[1].unitPrice.code, "USD") - self.assertEqual(inst.item[2].detail[1].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[2].detail[1].unitPrice.currency, "USD") self.assertEqual(inst.item[2].detail[1].unitPrice.value, 350.0) - self.assertEqual(inst.item[2].net.code, "USD") - self.assertEqual(inst.item[2].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[2].net.currency, "USD") self.assertEqual(inst.item[2].net.value, 1100.0) + self.assertEqual(inst.item[2].productOrService.coding[0].code, "27211") + self.assertEqual(inst.item[2].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[2].sequence, 3) - self.assertEqual(inst.item[2].service.coding[0].code, "27211") - self.assertEqual(inst.item[2].service.coding[0].system, "http://example.org/fhir/oralservicecodes") self.assertEqual(inst.item[2].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[2].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[2].unitPrice.code, "USD") - self.assertEqual(inst.item[2].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[2].unitPrice.currency, "USD") self.assertEqual(inst.item[2].unitPrice.value, 1100.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") self.assertEqual(inst.priority.coding[0].code, "normal") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
A human-readable rendering of the Oral Health Claim
") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "oral") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "proposed") - - def testClaim9(self): - inst = self.instantiate_from("claim-example-pharmacy-compound.json") - self.assertIsNotNone(inst, "Must have instantiated a Claim instance") - self.implClaim9(inst) - - js = inst.as_json() - self.assertEqual("Claim", js["resourceType"]) - inst2 = claim.Claim(js) - self.implClaim9(inst2) - - def implClaim9(self, inst): - self.assertEqual(inst.careTeam[0].sequence, 1) - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654456") - self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "760152") - self.assertEqual(inst.identifier[0].system, "http://happypharma.com/claim") - self.assertEqual(inst.identifier[0].value, "7612345") - self.assertEqual(inst.information[0].category.coding[0].code, "pharmacyrefill") - self.assertEqual(inst.information[0].code.coding[0].code, "new") - self.assertEqual(inst.information[0].code.coding[0].system, "http://hl7.org/fhir/pharmacy-refill") - self.assertEqual(inst.information[0].sequence, 1) - self.assertEqual(inst.information[1].category.coding[0].code, "pharmacyinformation") - self.assertEqual(inst.information[1].code.coding[0].code, "refillsremaining") - self.assertEqual(inst.information[1].code.coding[0].system, "http://hl7.org/fhir/pharmacy-information") - self.assertEqual(inst.information[1].sequence, 2) - self.assertEqual(inst.information[1].valueQuantity.value, 0) - self.assertEqual(inst.information[2].category.coding[0].code, "pharmacyinformation") - self.assertEqual(inst.information[2].code.coding[0].code, "dayssupply") - self.assertEqual(inst.information[2].code.coding[0].system, "http://hl7.org/fhir/pharmacy-information") - self.assertEqual(inst.information[2].sequence, 3) - self.assertEqual(inst.information[2].valueQuantity.value, 10) - self.assertEqual(inst.information[3].category.coding[0].code, "pharmacy") - self.assertEqual(inst.information[3].code.coding[0].code, "capsule") - self.assertEqual(inst.information[3].code.coding[0].system, "http://hl7.org/fhir/pharmacy-form") - self.assertEqual(inst.information[3].sequence, 4) - self.assertTrue(inst.insurance[0].focal) - self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].detail[0].net.code, "USD") - self.assertEqual(inst.item[0].detail[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[0].net.value, 20.0) - self.assertEqual(inst.item[0].detail[0].quantity.unit, "mg") - self.assertEqual(inst.item[0].detail[0].quantity.value, 250) - self.assertEqual(inst.item[0].detail[0].sequence, 1) - self.assertEqual(inst.item[0].detail[0].service.coding[0].code, "44001") - self.assertEqual(inst.item[0].detail[0].service.coding[0].display, "Acetaminophen 250mg") - self.assertEqual(inst.item[0].detail[0].service.coding[0].system, "http://localdruglist.org") - self.assertEqual(inst.item[0].detail[0].subDetail[0].net.code, "USD") - self.assertEqual(inst.item[0].detail[0].subDetail[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[0].subDetail[0].net.value, 20.0) - self.assertEqual(inst.item[0].detail[0].subDetail[0].sequence, 1) - self.assertEqual(inst.item[0].detail[0].subDetail[0].service.coding[0].code, "drugcost") - self.assertEqual(inst.item[0].detail[0].subDetail[0].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].detail[1].net.code, "USD") - self.assertEqual(inst.item[0].detail[1].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[1].net.value, 25.0) - self.assertEqual(inst.item[0].detail[1].quantity.unit, "mg") - self.assertEqual(inst.item[0].detail[1].quantity.value, 50) - self.assertEqual(inst.item[0].detail[1].sequence, 2) - self.assertEqual(inst.item[0].detail[1].service.coding[0].code, "44035") - self.assertEqual(inst.item[0].detail[1].service.coding[0].display, "Phenacetin 50mg") - self.assertEqual(inst.item[0].detail[1].service.coding[0].system, "http://localdruglist.org") - self.assertEqual(inst.item[0].detail[1].subDetail[0].net.code, "USD") - self.assertEqual(inst.item[0].detail[1].subDetail[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[1].subDetail[0].net.value, 25.0) - self.assertEqual(inst.item[0].detail[1].subDetail[0].sequence, 1) - self.assertEqual(inst.item[0].detail[1].subDetail[0].service.coding[0].code, "drugcost") - self.assertEqual(inst.item[0].detail[1].subDetail[0].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].detail[2].net.code, "USD") - self.assertEqual(inst.item[0].detail[2].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[2].net.value, 28.0) - self.assertEqual(inst.item[0].detail[2].quantity.unit, "mg") - self.assertEqual(inst.item[0].detail[2].quantity.value, 25) - self.assertEqual(inst.item[0].detail[2].sequence, 3) - self.assertEqual(inst.item[0].detail[2].service.coding[0].code, "44057") - self.assertEqual(inst.item[0].detail[2].service.coding[0].display, "Codeine 25mg") - self.assertEqual(inst.item[0].detail[2].service.coding[0].system, "http://localdruglist.org") - self.assertEqual(inst.item[0].detail[2].subDetail[0].net.code, "USD") - self.assertEqual(inst.item[0].detail[2].subDetail[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[2].subDetail[0].net.value, 28.0) - self.assertEqual(inst.item[0].detail[2].subDetail[0].sequence, 1) - self.assertEqual(inst.item[0].detail[2].subDetail[0].service.coding[0].code, "drugcost") - self.assertEqual(inst.item[0].detail[2].subDetail[0].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].detail[3].net.code, "USD") - self.assertEqual(inst.item[0].detail[3].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[3].net.value, 22.0) - self.assertEqual(inst.item[0].detail[3].sequence, 2) - self.assertEqual(inst.item[0].detail[3].service.coding[0].code, "markup") - self.assertEqual(inst.item[0].detail[3].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].detail[4].net.code, "USD") - self.assertEqual(inst.item[0].detail[4].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[4].net.value, 60.0) - self.assertEqual(inst.item[0].detail[4].sequence, 3) - self.assertEqual(inst.item[0].detail[4].service.coding[0].code, "compoundfee") - self.assertEqual(inst.item[0].detail[4].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].informationLinkId[0], 1) - self.assertEqual(inst.item[0].informationLinkId[1], 2) - self.assertEqual(inst.item[0].informationLinkId[2], 3) - self.assertEqual(inst.item[0].informationLinkId[3], 4) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].net.value, 155.0) - self.assertEqual(inst.item[0].quantity.code, "TAB") - self.assertEqual(inst.item[0].quantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.item[0].quantity.unit, "TAB") - self.assertEqual(inst.item[0].quantity.value, 30) - self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "compound") - self.assertEqual(inst.item[0].service.coding[0].display, "Custom compound") - self.assertEqual(inst.item[0].service.coding[0].system, "http://localdruglist.org") - self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.payee.type.coding[0].code, "provider") - self.assertEqual(inst.priority.coding[0].code, "stat") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Pharmacy Claim
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.total.code, "USD") - self.assertEqual(inst.total.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.total.value, 155.0) - self.assertEqual(inst.type.coding[0].code, "pharmacy") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "preauthorization") def testClaim10(self): - inst = self.instantiate_from("claim-example-pharmacy-medication.json") + inst = self.instantiate_from("claim-example-cms1500-medical.json") self.assertIsNotNone(inst, "Must have instantiated a Claim instance") self.implClaim10(inst) @@ -772,73 +701,77 @@ def testClaim10(self): def implClaim10(self, inst): self.assertEqual(inst.careTeam[0].sequence, 1) - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "654456") + self.assertEqual(inst.contained[0].id, "patient-1") + self.assertEqual(inst.contained[1].id, "coverage-1") + self.assertEqual(inst.created.date, FHIRDate("2015-10-16T00:00:00-07:00").date) + self.assertEqual(inst.created.as_json(), "2015-10-16T00:00:00-07:00") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].code, "M96.1") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].display, "Postlaminectomy syndrome") + self.assertEqual(inst.diagnosis[0].diagnosisCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/icd-10") self.assertEqual(inst.diagnosis[0].sequence, 1) - self.assertEqual(inst.id, "760151") - self.assertEqual(inst.identifier[0].system, "http://happypharma.com/claim") - self.assertEqual(inst.identifier[0].value, "7612345") - self.assertEqual(inst.information[0].category.coding[0].code, "pharmacyrefill") - self.assertEqual(inst.information[0].code.coding[0].code, "new") - self.assertEqual(inst.information[0].code.coding[0].system, "http://hl7.org/fhir/pharmacy-refill") - self.assertEqual(inst.information[0].sequence, 1) - self.assertEqual(inst.information[1].category.coding[0].code, "pharmacyinformation") - self.assertEqual(inst.information[1].code.coding[0].code, "refillsremaining") - self.assertEqual(inst.information[1].code.coding[0].system, "http://hl7.org/fhir/pharmacy-information") - self.assertEqual(inst.information[1].sequence, 2) - self.assertEqual(inst.information[1].valueQuantity.value, 2) - self.assertEqual(inst.information[2].category.coding[0].code, "pharmacyinformation") - self.assertEqual(inst.information[2].code.coding[0].code, "dayssupply") - self.assertEqual(inst.information[2].code.coding[0].system, "http://hl7.org/fhir/pharmacy-information") - self.assertEqual(inst.information[2].sequence, 3) - self.assertEqual(inst.information[2].valueQuantity.value, 90) + self.assertEqual(inst.diagnosis[1].diagnosisCodeableConcept.coding[0].code, "G89.4") + self.assertEqual(inst.diagnosis[1].diagnosisCodeableConcept.coding[0].display, "Chronic pain syndrome") + self.assertEqual(inst.diagnosis[1].diagnosisCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/icd-10") + self.assertEqual(inst.diagnosis[1].sequence, 2) + self.assertEqual(inst.diagnosis[2].diagnosisCodeableConcept.coding[0].code, "M53.88") + self.assertEqual(inst.diagnosis[2].diagnosisCodeableConcept.coding[0].display, "Other specified dorsopathies, sacral and sacrococcygeal region") + self.assertEqual(inst.diagnosis[2].diagnosisCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/icd-10") + self.assertEqual(inst.diagnosis[2].sequence, 3) + self.assertEqual(inst.diagnosis[3].diagnosisCodeableConcept.coding[0].code, "M47.816") + self.assertEqual(inst.diagnosis[3].diagnosisCodeableConcept.coding[0].display, "Spondylosis without myelopathy or radiculopathy, lumbar region") + self.assertEqual(inst.diagnosis[3].diagnosisCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/icd-10") + self.assertEqual(inst.diagnosis[3].sequence, 4) + self.assertEqual(inst.id, "MED-00050") + self.assertEqual(inst.identifier[0].system, "http://CedarArmsMedicalCenter.com/claim") + self.assertEqual(inst.identifier[0].value, "MED-00050") self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.insurance[0].identifier.system, "http://CedarArmsMedicalCenter.com/claim") + self.assertEqual(inst.insurance[0].identifier.value, "MED-00050") self.assertEqual(inst.insurance[0].sequence, 1) - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].detail[0].net.code, "USD") - self.assertEqual(inst.item[0].detail[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[0].net.value, 45.0) - self.assertEqual(inst.item[0].detail[0].sequence, 1) - self.assertEqual(inst.item[0].detail[0].service.coding[0].code, "drugcost") - self.assertEqual(inst.item[0].detail[0].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].detail[1].net.code, "USD") - self.assertEqual(inst.item[0].detail[1].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[1].net.value, 9.0) - self.assertEqual(inst.item[0].detail[1].sequence, 2) - self.assertEqual(inst.item[0].detail[1].service.coding[0].code, "markup") - self.assertEqual(inst.item[0].detail[1].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].detail[2].net.code, "USD") - self.assertEqual(inst.item[0].detail[2].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].detail[2].net.value, 36.0) - self.assertEqual(inst.item[0].detail[2].sequence, 3) - self.assertEqual(inst.item[0].detail[2].service.coding[0].code, "dispensefee") - self.assertEqual(inst.item[0].detail[2].service.coding[0].system, "http://hl7.org/fhir/ex-pharmaservice") - self.assertEqual(inst.item[0].informationLinkId[0], 1) - self.assertEqual(inst.item[0].informationLinkId[1], 2) - self.assertEqual(inst.item[0].informationLinkId[2], 3) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].net.value, 90.0) - self.assertEqual(inst.item[0].quantity.code, "TAB") - self.assertEqual(inst.item[0].quantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.item[0].quantity.unit, "TAB") - self.assertEqual(inst.item[0].quantity.value, 90) + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].diagnosisSequence[0], 2) + self.assertEqual(inst.item[0].diagnosisSequence[1], 4) + self.assertEqual(inst.item[0].informationSequence[0], 1) + self.assertEqual(inst.item[0].locationCodeableConcept.coding[0].code, "24") + self.assertEqual(inst.item[0].locationCodeableConcept.coding[0].display, "Ambulatory Surgical Center") + self.assertEqual(inst.item[0].locationCodeableConcept.coding[0].system, "https://www.cms.gov/medicare/coding/place-of-service-codes/place_of_service_code_set.html") + self.assertEqual(inst.item[0].net.currency, "USD") + self.assertEqual(inst.item[0].net.value, 12500.0) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "62264") + self.assertEqual(inst.item[0].productOrService.coding[0].display, "Surgical Procedures on the Spine and Spinal Cord") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://www.ama-assn.org/go/cpt") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "562721") - self.assertEqual(inst.item[0].service.coding[0].display, "Alprazolam 0.25mg (Xanax)") - self.assertEqual(inst.item[0].service.coding[0].system, "http://hl7.org/fhir/RxNorm") - self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") + self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2015-10-13").date) + self.assertEqual(inst.item[0].servicedDate.as_json(), "2015-10-13") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[0].unitPrice.value, 12500.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payee.type.coding[0].code, "provider") - self.assertEqual(inst.priority.coding[0].code, "stat") + self.assertEqual(inst.payee.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/payeetype") + self.assertEqual(inst.priority.coding[0].code, "normal") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Pharmacy Claim
") + self.assertEqual(inst.subType.coding[0].code, "831") + self.assertEqual(inst.subType.coding[0].system, "https://www.cms.gov/codes/billtype") + self.assertEqual(inst.supportingInfo[0].category.coding[0].code, "hospitalized") + self.assertEqual(inst.supportingInfo[0].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/claiminformationcategory") + self.assertEqual(inst.supportingInfo[0].sequence, 1) + self.assertEqual(inst.supportingInfo[0].timingPeriod.end.date, FHIRDate("2015-10-05T00:00:00-07:00").date) + self.assertEqual(inst.supportingInfo[0].timingPeriod.end.as_json(), "2015-10-05T00:00:00-07:00") + self.assertEqual(inst.supportingInfo[0].timingPeriod.start.date, FHIRDate("2015-10-01T00:00:00-07:00").date) + self.assertEqual(inst.supportingInfo[0].timingPeriod.start.as_json(), "2015-10-01T00:00:00-07:00") + self.assertEqual(inst.supportingInfo[1].category.coding[0].code, "discharge") + self.assertEqual(inst.supportingInfo[1].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/claiminformationcategory") + self.assertEqual(inst.supportingInfo[1].code.coding[0].code, "01") + self.assertEqual(inst.supportingInfo[1].code.coding[0].display, "Discharge to Home or Self Care") + self.assertEqual(inst.supportingInfo[1].code.coding[0].system, "https://www.cms.gov/Outreach-and-Education/Medicare-Learning-Network-MLN/MLNMattersArticles/downloads/SE0801.pdf") + self.assertEqual(inst.supportingInfo[1].sequence, 2) + self.assertEqual(inst.text.div, "
A human-readable rendering of a CMS 1500 Claim
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.total.code, "USD") - self.assertEqual(inst.total.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.total.value, 90.0) - self.assertEqual(inst.type.coding[0].code, "pharmacy") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") - self.assertEqual(inst.use, "complete") + self.assertEqual(inst.total.currency, "USD") + self.assertEqual(inst.total.value, 12500.0) + self.assertEqual(inst.type.coding[0].code, "institutional") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") diff --git a/fhirclient/models/claimresponse.py b/fhirclient/models/claimresponse.py index 447aac7c1..f19d2db4d 100644 --- a/fhirclient/models/claimresponse.py +++ b/fhirclient/models/claimresponse.py @@ -1,14 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class ClaimResponse(domainresource.DomainResource): - """ Remittance resource. + """ Response to a claim predetermination or preauthorization. This resource provides the adjudication details from the processing of a Claim resource. @@ -28,12 +28,16 @@ def __init__(self, jsondict=None, strict=True): """ Insurer added line items. List of `ClaimResponseAddItem` items (represented as `dict` in JSON). """ + self.adjudication = None + """ Header-level adjudication. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + self.communicationRequest = None """ Request for additional information. - List of `FHIRReference` items referencing `CommunicationRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.created = None - """ Creation date. + """ Response creation date. Type `FHIRDate` (represented as `str` in JSON). """ self.disposition = None @@ -45,76 +49,88 @@ def __init__(self, jsondict=None, strict=True): List of `ClaimResponseError` items (represented as `dict` in JSON). """ self.form = None - """ Printed Form Identifier. + """ Printed reference or actual form. + Type `Attachment` (represented as `dict` in JSON). """ + + self.formCode = None + """ Printed form identifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fundsReserve = None + """ Funds reserved status. Type `CodeableConcept` (represented as `dict` in JSON). """ self.identifier = None - """ Response number. + """ Business Identifier for a claim response. List of `Identifier` items (represented as `dict` in JSON). """ self.insurance = None - """ Insurance or medical plan. + """ Patient insurance information. List of `ClaimResponseInsurance` items (represented as `dict` in JSON). """ self.insurer = None - """ Insurance issuing organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Party responsible for reimbursement. + Type `FHIRReference` (represented as `dict` in JSON). """ self.item = None - """ Line items. + """ Adjudication for claim line items. List of `ClaimResponseItem` items (represented as `dict` in JSON). """ self.outcome = None - """ complete | error | partial. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ queued | complete | error | partial. + Type `str`. """ self.patient = None - """ The subject of the Products and Services. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + """ The recipient of the products and services. + Type `FHIRReference` (represented as `dict` in JSON). """ self.payeeType = None """ Party to be paid any benefits payable. Type `CodeableConcept` (represented as `dict` in JSON). """ self.payment = None - """ Payment details, if paid. + """ Payment Details. Type `ClaimResponsePayment` (represented as `dict` in JSON). """ + self.preAuthPeriod = None + """ Preauthorization reference effective period. + Type `Period` (represented as `dict` in JSON). """ + + self.preAuthRef = None + """ Preauthorization reference. + Type `str`. """ + self.processNote = None - """ Processing notes. + """ Note concerning adjudication. List of `ClaimResponseProcessNote` items (represented as `dict` in JSON). """ self.request = None """ Id of resource triggering adjudication. - Type `FHIRReference` referencing `Claim` (represented as `dict` in JSON). """ - - self.requestOrganization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.requestProvider = None - """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.reserved = None - """ Funds reserved status. - Type `Coding` (represented as `dict` in JSON). """ + self.requestor = None + """ Party responsible for the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | cancelled | draft | entered-in-error. Type `str`. """ - self.totalBenefit = None - """ Total benefit payable for the Claim. - Type `Money` (represented as `dict` in JSON). """ + self.subType = None + """ More granular claim type. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.totalCost = None - """ Total Cost of service from the Claim. - Type `Money` (represented as `dict` in JSON). """ + self.total = None + """ Adjudication totals. + List of `ClaimResponseTotal` items (represented as `dict` in JSON). """ - self.unallocDeductable = None - """ Unallocated deductible. - Type `Money` (represented as `dict` in JSON). """ + self.type = None + """ More granular claim type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.use = None + """ claim | preauthorization | predetermination. + Type `str`. """ super(ClaimResponse, self).__init__(jsondict=jsondict, strict=strict) @@ -122,28 +138,32 @@ def elementProperties(self): js = super(ClaimResponse, self).elementProperties() js.extend([ ("addItem", "addItem", ClaimResponseAddItem, True, None, False), + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), ("communicationRequest", "communicationRequest", fhirreference.FHIRReference, True, None, False), - ("created", "created", fhirdate.FHIRDate, False, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, True), ("disposition", "disposition", str, False, None, False), ("error", "error", ClaimResponseError, True, None, False), - ("form", "form", codeableconcept.CodeableConcept, False, None, False), + ("form", "form", attachment.Attachment, False, None, False), + ("formCode", "formCode", codeableconcept.CodeableConcept, False, None, False), + ("fundsReserve", "fundsReserve", codeableconcept.CodeableConcept, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("insurance", "insurance", ClaimResponseInsurance, True, None, False), - ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), + ("insurer", "insurer", fhirreference.FHIRReference, False, None, True), ("item", "item", ClaimResponseItem, True, None, False), - ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("outcome", "outcome", str, False, None, True), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("payeeType", "payeeType", codeableconcept.CodeableConcept, False, None, False), ("payment", "payment", ClaimResponsePayment, False, None, False), + ("preAuthPeriod", "preAuthPeriod", period.Period, False, None, False), + ("preAuthRef", "preAuthRef", str, False, None, False), ("processNote", "processNote", ClaimResponseProcessNote, True, None, False), ("request", "request", fhirreference.FHIRReference, False, None, False), - ("requestOrganization", "requestOrganization", fhirreference.FHIRReference, False, None, False), - ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), - ("reserved", "reserved", coding.Coding, False, None, False), - ("status", "status", str, False, None, False), - ("totalBenefit", "totalBenefit", money.Money, False, None, False), - ("totalCost", "totalCost", money.Money, False, None, False), - ("unallocDeductable", "unallocDeductable", money.Money, False, None, False), + ("requestor", "requestor", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subType", "subType", codeableconcept.CodeableConcept, False, None, False), + ("total", "total", ClaimResponseTotal, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("use", "use", str, False, None, True), ]) return js @@ -153,7 +173,8 @@ def elementProperties(self): class ClaimResponseAddItem(backboneelement.BackboneElement): """ Insurer added line items. - The first tier service adjudications for payor added services. + The first-tier service adjudications for payor added product or service + lines. """ resource_type = "ClaimResponseAddItem" @@ -170,60 +191,120 @@ def __init__(self, jsondict=None, strict=True): """ Added items adjudication. List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ - self.category = None - """ Type of service or product. + self.bodySite = None + """ Anatomical location. Type `CodeableConcept` (represented as `dict` in JSON). """ self.detail = None - """ Added items details. + """ Insurer added line details. List of `ClaimResponseAddItemDetail` items (represented as `dict` in JSON). """ - self.fee = None - """ Professional fee or Product charge. - Type `Money` (represented as `dict` in JSON). """ + self.detailSequence = None + """ Detail sequence number. + List of `int` items. """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.itemSequence = None + """ Item sequence number. + List of `int` items. """ + + self.locationAddress = None + """ Place of service or where product was supplied. + Type `Address` (represented as `dict` in JSON). """ + + self.locationCodeableConcept = None + """ Place of service or where product was supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Place of service or where product was supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ self.modifier = None """ Service/Product billing modifiers. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.net = None + """ Total item cost. + Type `Money` (represented as `dict` in JSON). """ + self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.revenue = None - """ Revenue or cost center code. + self.productOrService = None + """ Billing, service, product, or drug code. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.sequenceLinkId = None - """ Service instances. + self.programCode = None + """ Program the product or service is provided under. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.provider = None + """ Authorized providers. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.servicedDate = None + """ Date or dates of service or product delivery. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.servicedPeriod = None + """ Date or dates of service or product delivery. + Type `Period` (represented as `dict` in JSON). """ + + self.subSite = None + """ Anatomical sub-location. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.subdetailSequence = None + """ Subdetail sequence number. List of `int` items. """ - self.service = None - """ Group, Service or Product. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ super(ClaimResponseAddItem, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ClaimResponseAddItem, self).elementProperties() js.extend([ - ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), ("detail", "detail", ClaimResponseAddItemDetail, True, None, False), - ("fee", "fee", money.Money, False, None, False), + ("detailSequence", "detailSequence", int, True, None, False), + ("factor", "factor", float, False, None, False), + ("itemSequence", "itemSequence", int, True, None, False), + ("locationAddress", "locationAddress", address.Address, False, "location", False), + ("locationCodeableConcept", "locationCodeableConcept", codeableconcept.CodeableConcept, False, "location", False), + ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), ("noteNumber", "noteNumber", int, True, None, False), - ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), - ("sequenceLinkId", "sequenceLinkId", int, True, None, False), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), + ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), + ("provider", "provider", fhirreference.FHIRReference, True, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), + ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), + ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), + ("subdetailSequence", "subdetailSequence", int, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), ]) return js class ClaimResponseAddItemDetail(backboneelement.BackboneElement): - """ Added items details. + """ Insurer added line details. - The second tier service adjudications for payor added services. + The second-tier service adjudications for payor added services. """ resource_type = "ClaimResponseAddItemDetail" @@ -240,42 +321,117 @@ def __init__(self, jsondict=None, strict=True): """ Added items detail adjudication. List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ - self.category = None - """ Type of service or product. + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.modifier = None + """ Service/Product billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.net = None + """ Total item cost. + Type `Money` (represented as `dict` in JSON). """ + + self.noteNumber = None + """ Applicable note numbers. + List of `int` items. """ + + self.productOrService = None + """ Billing, service, product, or drug code. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.fee = None - """ Professional fee or Product charge. + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.subDetail = None + """ Insurer added line items. + List of `ClaimResponseAddItemDetailSubDetail` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ + super(ClaimResponseAddItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseAddItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), + ("factor", "factor", float, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("subDetail", "subDetail", ClaimResponseAddItemDetailSubDetail, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ClaimResponseAddItemDetailSubDetail(backboneelement.BackboneElement): + """ Insurer added line items. + + The third-tier service adjudications for payor added services. + """ + + resource_type = "ClaimResponseAddItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.adjudication = None + """ Added items detail adjudication. + List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + self.modifier = None """ Service/Product billing modifiers. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.net = None + """ Total item cost. + Type `Money` (represented as `dict` in JSON). """ + self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.revenue = None - """ Revenue or cost center code. + self.productOrService = None + """ Billing, service, product, or drug code. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.service = None - """ Service or Product. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ - super(ClaimResponseAddItemDetail, self).__init__(jsondict=jsondict, strict=strict) + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ClaimResponseAddItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ClaimResponseAddItemDetail, self).elementProperties() + js = super(ClaimResponseAddItemDetailSubDetail, self).elementProperties() js.extend([ - ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("fee", "fee", money.Money, False, None, False), + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), + ("factor", "factor", float, False, None, False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), ("noteNumber", "noteNumber", int, True, None, False), - ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), ]) return js @@ -283,7 +439,7 @@ def elementProperties(self): class ClaimResponseError(backboneelement.BackboneElement): """ Processing errors. - Mutually exclusive with Services Provided (Item). + Errors encountered during the processing of the adjudication. """ resource_type = "ClaimResponseError" @@ -300,15 +456,15 @@ def __init__(self, jsondict=None, strict=True): """ Error code detailing processing issues. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.detailSequenceLinkId = None + self.detailSequence = None """ Detail sequence number. Type `int`. """ - self.sequenceLinkId = None + self.itemSequence = None """ Item sequence number. Type `int`. """ - self.subdetailSequenceLinkId = None + self.subDetailSequence = None """ Subdetail sequence number. Type `int`. """ @@ -318,17 +474,18 @@ def elementProperties(self): js = super(ClaimResponseError, self).elementProperties() js.extend([ ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("detailSequenceLinkId", "detailSequenceLinkId", int, False, None, False), - ("sequenceLinkId", "sequenceLinkId", int, False, None, False), - ("subdetailSequenceLinkId", "subdetailSequenceLinkId", int, False, None, False), + ("detailSequence", "detailSequence", int, False, None, False), + ("itemSequence", "itemSequence", int, False, None, False), + ("subDetailSequence", "subDetailSequence", int, False, None, False), ]) return js class ClaimResponseInsurance(backboneelement.BackboneElement): - """ Insurance or medical plan. + """ Patient insurance information. - Financial instrument by which payment information for health care. + Financial instruments for reimbursement for the health care products and + services specified on the claim. """ resource_type = "ClaimResponseInsurance" @@ -342,27 +499,23 @@ def __init__(self, jsondict=None, strict=True): """ self.businessArrangement = None - """ Business agreement. + """ Additional provider contract number. Type `str`. """ self.claimResponse = None """ Adjudication results. - Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.coverage = None """ Insurance information. - Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.focal = None - """ Is the focal Coverage. + """ Coverage to be used for adjudication. Type `bool`. """ - self.preAuthRef = None - """ Pre-Authorization/Determination Reference. - List of `str` items. """ - self.sequence = None - """ Service instance identifier. + """ Insurance instance identifier. Type `int`. """ super(ClaimResponseInsurance, self).__init__(jsondict=jsondict, strict=strict) @@ -374,16 +527,16 @@ def elementProperties(self): ("claimResponse", "claimResponse", fhirreference.FHIRReference, False, None, False), ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), ("focal", "focal", bool, False, None, True), - ("preAuthRef", "preAuthRef", str, True, None, False), ("sequence", "sequence", int, False, None, True), ]) return js class ClaimResponseItem(backboneelement.BackboneElement): - """ Line items. + """ Adjudication for claim line items. - The first tier service adjudications for submitted services. + A claim line. Either a simple (a product or service) or a 'group' of + details which can also be a simple items or groups of sub-details. """ resource_type = "ClaimResponseItem" @@ -401,26 +554,26 @@ def __init__(self, jsondict=None, strict=True): List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ self.detail = None - """ Detail line items. + """ Adjudication for claim details. List of `ClaimResponseItemDetail` items (represented as `dict` in JSON). """ + self.itemSequence = None + """ Claim item instance identifier. + Type `int`. """ + self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.sequenceLinkId = None - """ Service instance. - Type `int`. """ - super(ClaimResponseItem, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ClaimResponseItem, self).elementProperties() js.extend([ - ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), ("detail", "detail", ClaimResponseItemDetail, True, None, False), + ("itemSequence", "itemSequence", int, False, None, True), ("noteNumber", "noteNumber", int, True, None, False), - ("sequenceLinkId", "sequenceLinkId", int, False, None, True), ]) return js @@ -428,7 +581,9 @@ def elementProperties(self): class ClaimResponseItemAdjudication(backboneelement.BackboneElement): """ Adjudication details. - The adjudication results. + If this item is a group then the values here are a summary of the + adjudication of the detail items. If this item is a simple product or + service then this is the result of the adjudication of this item. """ resource_type = "ClaimResponseItemAdjudication" @@ -446,11 +601,11 @@ def __init__(self, jsondict=None, strict=True): Type `Money` (represented as `dict` in JSON). """ self.category = None - """ Adjudication category such as co-pay, eligible, benefit, etc.. + """ Type of adjudication information. Type `CodeableConcept` (represented as `dict` in JSON). """ self.reason = None - """ Explanation of Adjudication outcome. + """ Explanation of adjudication outcome. Type `CodeableConcept` (represented as `dict` in JSON). """ self.value = None @@ -471,9 +626,10 @@ def elementProperties(self): class ClaimResponseItemDetail(backboneelement.BackboneElement): - """ Detail line items. + """ Adjudication for claim details. - The second tier service adjudications for submitted services. + A claim detail. Either a simple (a product or service) or a 'group' of sub- + details which are simple items. """ resource_type = "ClaimResponseItemDetail" @@ -490,16 +646,16 @@ def __init__(self, jsondict=None, strict=True): """ Detail level adjudication details. List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ + self.detailSequence = None + """ Claim detail instance identifier. + Type `int`. """ + self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.sequenceLinkId = None - """ Service instance. - Type `int`. """ - self.subDetail = None - """ Subdetail line items. + """ Adjudication for claim sub-details. List of `ClaimResponseItemDetailSubDetail` items (represented as `dict` in JSON). """ super(ClaimResponseItemDetail, self).__init__(jsondict=jsondict, strict=strict) @@ -507,18 +663,18 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(ClaimResponseItemDetail, self).elementProperties() js.extend([ - ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), + ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, True), + ("detailSequence", "detailSequence", int, False, None, True), ("noteNumber", "noteNumber", int, True, None, False), - ("sequenceLinkId", "sequenceLinkId", int, False, None, True), ("subDetail", "subDetail", ClaimResponseItemDetailSubDetail, True, None, False), ]) return js class ClaimResponseItemDetailSubDetail(backboneelement.BackboneElement): - """ Subdetail line items. + """ Adjudication for claim sub-details. - The third tier service adjudications for submitted services. + A sub-detail adjudication of a simple product or service. """ resource_type = "ClaimResponseItemDetailSubDetail" @@ -536,11 +692,11 @@ def __init__(self, jsondict=None, strict=True): List of `ClaimResponseItemAdjudication` items (represented as `dict` in JSON). """ self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.sequenceLinkId = None - """ Service instance. + self.subDetailSequence = None + """ Claim sub-detail instance identifier. Type `int`. """ super(ClaimResponseItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) @@ -550,15 +706,15 @@ def elementProperties(self): js.extend([ ("adjudication", "adjudication", ClaimResponseItemAdjudication, True, None, False), ("noteNumber", "noteNumber", int, True, None, False), - ("sequenceLinkId", "sequenceLinkId", int, False, None, True), + ("subDetailSequence", "subDetailSequence", int, False, None, True), ]) return js class ClaimResponsePayment(backboneelement.BackboneElement): - """ Payment details, if paid. + """ Payment Details. - Payment details for the claim if the claim has been paid. + Payment details for the adjudication of the claim. """ resource_type = "ClaimResponsePayment" @@ -572,11 +728,11 @@ def __init__(self, jsondict=None, strict=True): """ self.adjustment = None - """ Payment adjustment for non-Claim issues. + """ Payment adjustment for non-claim issues. Type `Money` (represented as `dict` in JSON). """ self.adjustmentReason = None - """ Explanation for the non-claim adjustment. + """ Explanation for the adjustment. Type `CodeableConcept` (represented as `dict` in JSON). """ self.amount = None @@ -584,15 +740,15 @@ def __init__(self, jsondict=None, strict=True): Type `Money` (represented as `dict` in JSON). """ self.date = None - """ Expected data of Payment. + """ Expected date of payment. Type `FHIRDate` (represented as `str` in JSON). """ self.identifier = None - """ Identifier of the payment instrument. + """ Business identifier for the payment. Type `Identifier` (represented as `dict` in JSON). """ self.type = None - """ Partial or Complete. + """ Partial or complete payment. Type `CodeableConcept` (represented as `dict` in JSON). """ super(ClaimResponsePayment, self).__init__(jsondict=jsondict, strict=strict) @@ -602,18 +758,19 @@ def elementProperties(self): js.extend([ ("adjustment", "adjustment", money.Money, False, None, False), ("adjustmentReason", "adjustmentReason", codeableconcept.CodeableConcept, False, None, False), - ("amount", "amount", money.Money, False, None, False), + ("amount", "amount", money.Money, False, None, True), ("date", "date", fhirdate.FHIRDate, False, None, False), ("identifier", "identifier", identifier.Identifier, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), ]) return js class ClaimResponseProcessNote(backboneelement.BackboneElement): - """ Processing notes. + """ Note concerning adjudication. - Note text. + A note that describes or explains adjudication results in a human readable + form. """ resource_type = "ClaimResponseProcessNote" @@ -627,11 +784,11 @@ def __init__(self, jsondict=None, strict=True): """ self.language = None - """ Language if different from the resource. + """ Language of the text. Type `CodeableConcept` (represented as `dict` in JSON). """ self.number = None - """ Sequence Number for this note. + """ Note instance identifier. Type `int`. """ self.text = None @@ -640,7 +797,7 @@ def __init__(self, jsondict=None, strict=True): self.type = None """ display | print | printoper. - Type `CodeableConcept` (represented as `dict` in JSON). """ + Type `str`. """ super(ClaimResponseProcessNote, self).__init__(jsondict=jsondict, strict=strict) @@ -649,21 +806,60 @@ def elementProperties(self): js.extend([ ("language", "language", codeableconcept.CodeableConcept, False, None, False), ("number", "number", int, False, None, False), - ("text", "text", str, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("text", "text", str, False, None, True), + ("type", "type", str, False, None, False), + ]) + return js + + +class ClaimResponseTotal(backboneelement.BackboneElement): + """ Adjudication totals. + + Categorized monetary totals for the adjudication. + """ + + resource_type = "ClaimResponseTotal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Financial total for the category. + Type `Money` (represented as `dict` in JSON). """ + + self.category = None + """ Type of adjudication information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ClaimResponseTotal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ClaimResponseTotal, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, True), + ("category", "category", codeableconcept.CodeableConcept, False, None, True), ]) return js import sys try: - from . import codeableconcept + from . import address except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] + address = sys.modules[__package__ + '.address'] try: - from . import coding + from . import attachment except ImportError: - coding = sys.modules[__package__ + '.coding'] + attachment = sys.modules[__package__ + '.attachment'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] try: from . import fhirdate except ImportError: @@ -680,3 +876,11 @@ def elementProperties(self): from . import money except ImportError: money = sys.modules[__package__ + '.money'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/claimresponse_tests.py b/fhirclient/models/claimresponse_tests.py index 2e9d56e97..35501e543 100644 --- a/fhirclient/models/claimresponse_tests.py +++ b/fhirclient/models/claimresponse_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return claimresponse.ClaimResponse(js) def testClaimResponse1(self): - inst = self.instantiate_from("claimresponse-example.json") + inst = self.instantiate_from("claimresponse-example-unsolicited-preauth.json") self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") self.implClaimResponse1(inst) @@ -32,47 +32,443 @@ def testClaimResponse1(self): self.implClaimResponse1(inst2) def implClaimResponse1(self, inst): + self.assertEqual(inst.addItem[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.addItem[0].adjudication[0].amount.value, 250.0) + self.assertEqual(inst.addItem[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.addItem[0].adjudication[1].amount.currency, "USD") + self.assertEqual(inst.addItem[0].adjudication[1].amount.value, 10.0) + self.assertEqual(inst.addItem[0].adjudication[1].category.coding[0].code, "copay") + self.assertEqual(inst.addItem[0].adjudication[2].category.coding[0].code, "eligpercent") + self.assertEqual(inst.addItem[0].adjudication[2].value, 100.0) + self.assertEqual(inst.addItem[0].adjudication[3].amount.currency, "USD") + self.assertEqual(inst.addItem[0].adjudication[3].amount.value, 240.0) + self.assertEqual(inst.addItem[0].adjudication[3].category.coding[0].code, "benefit") + self.assertEqual(inst.addItem[0].itemSequence[0], 1) + self.assertEqual(inst.addItem[0].modifier[0].coding[0].code, "x") + self.assertEqual(inst.addItem[0].modifier[0].coding[0].display, "None") + self.assertEqual(inst.addItem[0].modifier[0].coding[0].system, "http://example.org/fhir/modifiers") + self.assertEqual(inst.addItem[0].net.currency, "USD") + self.assertEqual(inst.addItem[0].net.value, 250.0) + self.assertEqual(inst.addItem[0].noteNumber[0], 101) + self.assertEqual(inst.addItem[0].productOrService.coding[0].code, "1101") + self.assertEqual(inst.addItem[0].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") + self.assertEqual(inst.addItem[1].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.addItem[1].adjudication[0].amount.value, 800.0) + self.assertEqual(inst.addItem[1].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.addItem[1].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.addItem[1].adjudication[1].value, 100.0) + self.assertEqual(inst.addItem[1].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.addItem[1].adjudication[2].amount.value, 800.0) + self.assertEqual(inst.addItem[1].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.addItem[1].itemSequence[0], 1) + self.assertEqual(inst.addItem[1].net.currency, "USD") + self.assertEqual(inst.addItem[1].net.value, 800.0) + self.assertEqual(inst.addItem[1].productOrService.coding[0].code, "2101") + self.assertEqual(inst.addItem[1].productOrService.coding[0].display, "Radiograph, series (12)") + self.assertEqual(inst.addItem[1].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "The enclosed services are authorized for your provision within 30 days of this notice.") + self.assertEqual(inst.id, "UR3503") + self.assertEqual(inst.identifier[0].system, "http://www.SocialBenefitsInc.com/fhir/ClaimResponse") + self.assertEqual(inst.identifier[0].value, "UR3503") + self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.insurance[0].sequence, 1) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.payeeType.coding[0].code, "provider") + self.assertEqual(inst.payeeType.coding[0].system, "http://terminology.hl7.org/CodeSystem/payeetype") + self.assertEqual(inst.preAuthRef, "18SS12345") + self.assertEqual(inst.processNote[0].language.coding[0].code, "en-CA") + self.assertEqual(inst.processNote[0].language.coding[0].system, "urn:ietf:bcp:47") + self.assertEqual(inst.processNote[0].number, 101) + self.assertEqual(inst.processNote[0].text, "Please submit a Pre-Authorization request if a more extensive examination or urgent services are required.") + self.assertEqual(inst.processNote[0].type, "print") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A sample unsolicited pre-authorization response which authorizes basic dental services to be performed for a patient.
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.total[0].amount.currency, "USD") + self.assertEqual(inst.total[0].amount.value, 1050.0) + self.assertEqual(inst.total[0].category.coding[0].code, "submitted") + self.assertEqual(inst.total[1].amount.currency, "USD") + self.assertEqual(inst.total[1].amount.value, 1040.0) + self.assertEqual(inst.total[1].category.coding[0].code, "benefit") + self.assertEqual(inst.type.coding[0].code, "oral") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "preauthorization") + + def testClaimResponse2(self): + inst = self.instantiate_from("claimresponse-example-additem.json") + self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") + self.implClaimResponse2(inst) + + js = inst.as_json() + self.assertEqual("ClaimResponse", js["resourceType"]) + inst2 = claimresponse.ClaimResponse(js) + self.implClaimResponse2(inst2) + + def implClaimResponse2(self, inst): + self.assertEqual(inst.addItem[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.addItem[0].adjudication[0].amount.value, 100.0) + self.assertEqual(inst.addItem[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.addItem[0].adjudication[1].amount.currency, "USD") + self.assertEqual(inst.addItem[0].adjudication[1].amount.value, 10.0) + self.assertEqual(inst.addItem[0].adjudication[1].category.coding[0].code, "copay") + self.assertEqual(inst.addItem[0].adjudication[2].category.coding[0].code, "eligpercent") + self.assertEqual(inst.addItem[0].adjudication[2].value, 80.0) + self.assertEqual(inst.addItem[0].adjudication[3].amount.currency, "USD") + self.assertEqual(inst.addItem[0].adjudication[3].amount.value, 72.0) + self.assertEqual(inst.addItem[0].adjudication[3].category.coding[0].code, "benefit") + self.assertEqual(inst.addItem[0].adjudication[3].reason.coding[0].code, "ar002") + self.assertEqual(inst.addItem[0].adjudication[3].reason.coding[0].display, "Plan Limit Reached") + self.assertEqual(inst.addItem[0].adjudication[3].reason.coding[0].system, "http://terminology.hl7.org/CodeSystem/adjudication-reason") + self.assertEqual(inst.addItem[0].itemSequence[0], 1) + self.assertEqual(inst.addItem[0].modifier[0].coding[0].code, "x") + self.assertEqual(inst.addItem[0].modifier[0].coding[0].display, "None") + self.assertEqual(inst.addItem[0].modifier[0].coding[0].system, "http://example.org/fhir/modifiers") + self.assertEqual(inst.addItem[0].net.currency, "USD") + self.assertEqual(inst.addItem[0].net.value, 135.57) + self.assertEqual(inst.addItem[0].noteNumber[0], 101) + self.assertEqual(inst.addItem[0].productOrService.coding[0].code, "1101") + self.assertEqual(inst.addItem[0].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") + self.assertEqual(inst.addItem[1].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.addItem[1].adjudication[0].amount.value, 35.57) + self.assertEqual(inst.addItem[1].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.addItem[1].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.addItem[1].adjudication[1].value, 80.0) + self.assertEqual(inst.addItem[1].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.addItem[1].adjudication[2].amount.value, 28.47) + self.assertEqual(inst.addItem[1].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.addItem[1].itemSequence[0], 1) + self.assertEqual(inst.addItem[1].net.currency, "USD") + self.assertEqual(inst.addItem[1].net.value, 35.57) + self.assertEqual(inst.addItem[1].productOrService.coding[0].code, "2141") + self.assertEqual(inst.addItem[1].productOrService.coding[0].display, "Radiograph, bytewing") + self.assertEqual(inst.addItem[1].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") + self.assertEqual(inst.addItem[2].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.addItem[2].adjudication[0].amount.value, 350.0) + self.assertEqual(inst.addItem[2].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.addItem[2].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.addItem[2].adjudication[1].value, 80.0) + self.assertEqual(inst.addItem[2].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.addItem[2].adjudication[2].amount.value, 270.0) + self.assertEqual(inst.addItem[2].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.addItem[2].detailSequence[0], 2) + self.assertEqual(inst.addItem[2].itemSequence[0], 3) + self.assertEqual(inst.addItem[2].modifier[0].coding[0].code, "x") + self.assertEqual(inst.addItem[2].modifier[0].coding[0].display, "None") + self.assertEqual(inst.addItem[2].modifier[0].coding[0].system, "http://example.org/fhir/modifiers") + self.assertEqual(inst.addItem[2].net.currency, "USD") + self.assertEqual(inst.addItem[2].net.value, 350.0) + self.assertEqual(inst.addItem[2].noteNumber[0], 101) + self.assertEqual(inst.addItem[2].productOrService.coding[0].code, "expense") + self.assertEqual(inst.addItem[2].productOrService.coding[0].system, "http://example.org/fhir/oralservicecodes") + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "Claim settled as per contract.") + self.assertEqual(inst.id, "R3503") + self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/remittance") + self.assertEqual(inst.identifier[0].value, "R3503") + self.assertEqual(inst.item[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].adjudication[0].amount.value, 0.0) + self.assertEqual(inst.item[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].adjudication[1].amount.currency, "USD") + self.assertEqual(inst.item[0].adjudication[1].amount.value, 0.0) + self.assertEqual(inst.item[0].adjudication[1].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].itemSequence, 1) + self.assertEqual(inst.item[1].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[1].adjudication[0].amount.value, 105.0) + self.assertEqual(inst.item[1].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[1].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[1].adjudication[1].value, 80.0) + self.assertEqual(inst.item[1].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[1].adjudication[2].amount.value, 84.0) + self.assertEqual(inst.item[1].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[1].itemSequence, 2) + self.assertEqual(inst.item[2].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[2].adjudication[0].amount.value, 750.0) + self.assertEqual(inst.item[2].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[2].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[2].adjudication[1].value, 80.0) + self.assertEqual(inst.item[2].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[2].adjudication[2].amount.value, 600.0) + self.assertEqual(inst.item[2].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[2].detail[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[2].detail[0].adjudication[0].amount.value, 750.0) + self.assertEqual(inst.item[2].detail[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[2].detail[0].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[2].detail[0].adjudication[1].value, 80.0) + self.assertEqual(inst.item[2].detail[0].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[2].detail[0].adjudication[2].amount.value, 600.0) + self.assertEqual(inst.item[2].detail[0].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[2].detail[0].detailSequence, 1) + self.assertEqual(inst.item[2].detail[1].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[2].detail[1].adjudication[0].amount.value, 0.0) + self.assertEqual(inst.item[2].detail[1].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[2].detail[1].adjudication[1].amount.currency, "USD") + self.assertEqual(inst.item[2].detail[1].adjudication[1].amount.value, 0.0) + self.assertEqual(inst.item[2].detail[1].adjudication[1].category.coding[0].code, "benefit") + self.assertEqual(inst.item[2].detail[1].detailSequence, 2) + self.assertEqual(inst.item[2].itemSequence, 3) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.payeeType.coding[0].code, "provider") + self.assertEqual(inst.payeeType.coding[0].system, "http://terminology.hl7.org/CodeSystem/payeetype") + self.assertEqual(inst.payment.amount.currency, "USD") + self.assertEqual(inst.payment.amount.value, 100.47) + self.assertEqual(inst.payment.date.date, FHIRDate("2014-08-31").date) + self.assertEqual(inst.payment.date.as_json(), "2014-08-31") + self.assertEqual(inst.payment.identifier.system, "http://www.BenefitsInc.com/fhir/paymentidentifier") + self.assertEqual(inst.payment.identifier.value, "201408-2-15507") + self.assertEqual(inst.payment.type.coding[0].code, "complete") + self.assertEqual(inst.payment.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-paymenttype") + self.assertEqual(inst.processNote[0].language.coding[0].code, "en-CA") + self.assertEqual(inst.processNote[0].language.coding[0].system, "urn:ietf:bcp:47") + self.assertEqual(inst.processNote[0].number, 101) + self.assertEqual(inst.processNote[0].text, "Package codes are not permitted. Codes replaced by Insurer.") + self.assertEqual(inst.processNote[0].type, "print") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the ClaimResponse to Claim Oral Average with additional items
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.total[0].amount.currency, "USD") + self.assertEqual(inst.total[0].amount.value, 1340.57) + self.assertEqual(inst.total[0].category.coding[0].code, "submitted") + self.assertEqual(inst.total[1].amount.currency, "USD") + self.assertEqual(inst.total[1].amount.value, 1054.47) + self.assertEqual(inst.total[1].category.coding[0].code, "benefit") + self.assertEqual(inst.type.coding[0].code, "oral") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") + + def testClaimResponse3(self): + inst = self.instantiate_from("claimresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") + self.implClaimResponse3(inst) + + js = inst.as_json() + self.assertEqual("ClaimResponse", js["resourceType"]) + inst2 = claimresponse.ClaimResponse(js) + self.implClaimResponse3(inst2) + + def implClaimResponse3(self, inst): self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") self.assertEqual(inst.disposition, "Claim settled as per contract.") self.assertEqual(inst.id, "R3500") self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/remittance") self.assertEqual(inst.identifier[0].value, "R3500") - self.assertEqual(inst.item[0].adjudication[0].amount.code, "USD") - self.assertEqual(inst.item[0].adjudication[0].amount.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].adjudication[0].amount.currency, "USD") self.assertEqual(inst.item[0].adjudication[0].amount.value, 135.57) self.assertEqual(inst.item[0].adjudication[0].category.coding[0].code, "eligible") - self.assertEqual(inst.item[0].adjudication[1].amount.code, "USD") - self.assertEqual(inst.item[0].adjudication[1].amount.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].adjudication[1].amount.currency, "USD") self.assertEqual(inst.item[0].adjudication[1].amount.value, 10.0) self.assertEqual(inst.item[0].adjudication[1].category.coding[0].code, "copay") self.assertEqual(inst.item[0].adjudication[2].category.coding[0].code, "eligpercent") self.assertEqual(inst.item[0].adjudication[2].value, 80.0) - self.assertEqual(inst.item[0].adjudication[3].amount.code, "USD") - self.assertEqual(inst.item[0].adjudication[3].amount.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.item[0].adjudication[3].amount.value, 100.47) + self.assertEqual(inst.item[0].adjudication[3].amount.currency, "USD") + self.assertEqual(inst.item[0].adjudication[3].amount.value, 90.47) self.assertEqual(inst.item[0].adjudication[3].category.coding[0].code, "benefit") - self.assertEqual(inst.item[0].sequenceLinkId, 1) - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") + self.assertEqual(inst.item[0].adjudication[3].reason.coding[0].code, "ar002") + self.assertEqual(inst.item[0].adjudication[3].reason.coding[0].display, "Plan Limit Reached") + self.assertEqual(inst.item[0].adjudication[3].reason.coding[0].system, "http://terminology.hl7.org/CodeSystem/adjudication-reason") + self.assertEqual(inst.item[0].itemSequence, 1) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") self.assertEqual(inst.payeeType.coding[0].code, "provider") - self.assertEqual(inst.payeeType.coding[0].system, "http://hl7.org/fhir/payeetype") - self.assertEqual(inst.payment.amount.code, "USD") - self.assertEqual(inst.payment.amount.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.payeeType.coding[0].system, "http://terminology.hl7.org/CodeSystem/payeetype") + self.assertEqual(inst.payment.amount.currency, "USD") self.assertEqual(inst.payment.amount.value, 100.47) self.assertEqual(inst.payment.date.date, FHIRDate("2014-08-31").date) self.assertEqual(inst.payment.date.as_json(), "2014-08-31") self.assertEqual(inst.payment.identifier.system, "http://www.BenefitsInc.com/fhir/paymentidentifier") self.assertEqual(inst.payment.identifier.value, "201408-2-1569478") self.assertEqual(inst.payment.type.coding[0].code, "complete") - self.assertEqual(inst.payment.type.coding[0].system, "http://hl7.org/fhir/ex-paymenttype") + self.assertEqual(inst.payment.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-paymenttype") self.assertEqual(inst.status, "active") + self.assertEqual(inst.subType.coding[0].code, "emergency") + self.assertEqual(inst.subType.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-claimsubtype") self.assertEqual(inst.text.div, "
A human-readable rendering of the ClaimResponse
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.totalBenefit.code, "USD") - self.assertEqual(inst.totalBenefit.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.totalBenefit.value, 100.47) - self.assertEqual(inst.totalCost.code, "USD") - self.assertEqual(inst.totalCost.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.totalCost.value, 135.57) + self.assertEqual(inst.total[0].amount.currency, "USD") + self.assertEqual(inst.total[0].amount.value, 135.57) + self.assertEqual(inst.total[0].category.coding[0].code, "submitted") + self.assertEqual(inst.total[1].amount.currency, "USD") + self.assertEqual(inst.total[1].amount.value, 90.47) + self.assertEqual(inst.total[1].category.coding[0].code, "benefit") + self.assertEqual(inst.type.coding[0].code, "oral") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") + + def testClaimResponse4(self): + inst = self.instantiate_from("claimresponse-example-vision-3tier.json") + self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") + self.implClaimResponse4(inst) + + js = inst.as_json() + self.assertEqual("ClaimResponse", js["resourceType"]) + inst2 = claimresponse.ClaimResponse(js) + self.implClaimResponse4(inst2) + + def implClaimResponse4(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "Claim settled as per contract.") + self.assertEqual(inst.id, "R3502") + self.assertEqual(inst.identifier[0].system, "http://thebenefitcompany.com/claimresponse") + self.assertEqual(inst.identifier[0].value, "CR6532875367") + self.assertEqual(inst.item[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].adjudication[0].amount.value, 235.4) + self.assertEqual(inst.item[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].adjudication[1].amount.currency, "USD") + self.assertEqual(inst.item[0].adjudication[1].amount.value, 20.0) + self.assertEqual(inst.item[0].adjudication[1].category.coding[0].code, "copay") + self.assertEqual(inst.item[0].adjudication[2].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[0].adjudication[2].value, 80.0) + self.assertEqual(inst.item[0].adjudication[3].amount.currency, "USD") + self.assertEqual(inst.item[0].adjudication[3].amount.value, 172.32) + self.assertEqual(inst.item[0].adjudication[3].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].detail[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[0].adjudication[0].amount.value, 100.0) + self.assertEqual(inst.item[0].detail[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].detail[0].adjudication[1].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[0].adjudication[1].amount.value, 20.0) + self.assertEqual(inst.item[0].detail[0].adjudication[1].category.coding[0].code, "copay") + self.assertEqual(inst.item[0].detail[0].adjudication[2].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[0].detail[0].adjudication[2].value, 80.0) + self.assertEqual(inst.item[0].detail[0].adjudication[3].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[0].adjudication[3].amount.value, 80.0) + self.assertEqual(inst.item[0].detail[0].adjudication[3].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].detail[0].detailSequence, 1) + self.assertEqual(inst.item[0].detail[0].noteNumber[0], 1) + self.assertEqual(inst.item[0].detail[1].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].adjudication[0].amount.value, 110.0) + self.assertEqual(inst.item[0].detail[1].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].detail[1].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[0].detail[1].adjudication[1].value, 80.0) + self.assertEqual(inst.item[0].detail[1].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].adjudication[2].amount.value, 88.0) + self.assertEqual(inst.item[0].detail[1].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].detail[1].detailSequence, 2) + self.assertEqual(inst.item[0].detail[1].noteNumber[0], 1) + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[0].amount.value, 60.0) + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[1].value, 80.0) + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[2].amount.value, 48.0) + self.assertEqual(inst.item[0].detail[1].subDetail[0].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].detail[1].subDetail[0].noteNumber[0], 1) + self.assertEqual(inst.item[0].detail[1].subDetail[0].subDetailSequence, 1) + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[0].amount.value, 30.0) + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[1].value, 80.0) + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[2].amount.value, 24.0) + self.assertEqual(inst.item[0].detail[1].subDetail[1].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].detail[1].subDetail[1].subDetailSequence, 2) + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[0].amount.value, 10.0) + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[1].value, 80.0) + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[2].amount.value, 8.0) + self.assertEqual(inst.item[0].detail[1].subDetail[2].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].detail[1].subDetail[2].noteNumber[0], 1) + self.assertEqual(inst.item[0].detail[1].subDetail[2].subDetailSequence, 3) + self.assertEqual(inst.item[0].detail[2].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[2].adjudication[0].amount.value, 200.0) + self.assertEqual(inst.item[0].detail[2].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[0].detail[2].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[0].detail[2].adjudication[1].value, 80.0) + self.assertEqual(inst.item[0].detail[2].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[0].detail[2].adjudication[2].amount.value, 14.0) + self.assertEqual(inst.item[0].detail[2].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[0].detail[2].detailSequence, 3) + self.assertEqual(inst.item[0].detail[2].noteNumber[0], 1) + self.assertEqual(inst.item[0].itemSequence, 1) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.payeeType.coding[0].code, "provider") + self.assertEqual(inst.payeeType.coding[0].system, "http://terminology.hl7.org/CodeSystem/payeetype") + self.assertEqual(inst.payment.adjustment.currency, "USD") + self.assertEqual(inst.payment.adjustment.value, 75.0) + self.assertEqual(inst.payment.adjustmentReason.coding[0].code, "a002") + self.assertEqual(inst.payment.adjustmentReason.coding[0].display, "Prior Overpayment") + self.assertEqual(inst.payment.adjustmentReason.coding[0].system, "http://terminology.hl7.org/CodeSystem/payment-adjustment-reason") + self.assertEqual(inst.payment.amount.currency, "USD") + self.assertEqual(inst.payment.amount.value, 107.0) + self.assertEqual(inst.payment.date.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.payment.date.as_json(), "2014-08-16") + self.assertEqual(inst.payment.identifier.system, "http://thebenefitcompany.com/paymentidentifier") + self.assertEqual(inst.payment.identifier.value, "201416-123456") + self.assertEqual(inst.payment.type.coding[0].code, "complete") + self.assertEqual(inst.payment.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-paymenttype") + self.assertEqual(inst.processNote[0].language.coding[0].code, "en-CA") + self.assertEqual(inst.processNote[0].language.coding[0].system, "urn:ietf:bcp:47") + self.assertEqual(inst.processNote[0].number, 1) + self.assertEqual(inst.processNote[0].text, "After hours surcharge declined") + self.assertEqual(inst.processNote[0].type, "display") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the ClaimResponse
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.total[0].amount.currency, "USD") + self.assertEqual(inst.total[0].amount.value, 235.4) + self.assertEqual(inst.total[0].category.coding[0].code, "submitted") + self.assertEqual(inst.total[1].amount.currency, "USD") + self.assertEqual(inst.total[1].amount.value, 182.0) + self.assertEqual(inst.total[1].category.coding[0].code, "benefit") + self.assertEqual(inst.type.coding[0].code, "vision") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") + + def testClaimResponse5(self): + inst = self.instantiate_from("claimresponse-example-2.json") + self.assertIsNotNone(inst, "Must have instantiated a ClaimResponse instance") + self.implClaimResponse5(inst) + + js = inst.as_json() + self.assertEqual("ClaimResponse", js["resourceType"]) + inst2 = claimresponse.ClaimResponse(js) + self.implClaimResponse5(inst2) + + def implClaimResponse5(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "Claim could not be processed") + self.assertEqual(inst.error[0].code.coding[0].code, "a002") + self.assertEqual(inst.error[0].code.coding[0].system, "http://terminology.hl7.org/CodeSystem/adjudication-error") + self.assertEqual(inst.error[0].detailSequence, 2) + self.assertEqual(inst.error[0].itemSequence, 3) + self.assertEqual(inst.formCode.coding[0].code, "2") + self.assertEqual(inst.formCode.coding[0].system, "http://terminology.hl7.org/CodeSystem/forms-codes") + self.assertEqual(inst.id, "R3501") + self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/remittance") + self.assertEqual(inst.identifier[0].value, "R3501") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "error") + self.assertEqual(inst.processNote[0].language.coding[0].code, "en-CA") + self.assertEqual(inst.processNote[0].language.coding[0].system, "urn:ietf:bcp:47") + self.assertEqual(inst.processNote[0].number, 1) + self.assertEqual(inst.processNote[0].text, "Invalid claim") + self.assertEqual(inst.processNote[0].type, "display") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the ClaimResponse that demonstrates returning errors
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "oral") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") diff --git a/fhirclient/models/clinicalimpression.py b/fhirclient/models/clinicalimpression.py index 5971350a3..dbd825c4f 100644 --- a/fhirclient/models/clinicalimpression.py +++ b/fhirclient/models/clinicalimpression.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -30,22 +30,14 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.action = None - """ Action taken as part of assessment procedure. - List of `FHIRReference` items referencing `ReferralRequest, ProcedureRequest, Procedure, MedicationRequest, Appointment` (represented as `dict` in JSON). """ - self.assessor = None """ The clinician performing the assessment. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.code = None """ Kind of assessment performed. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.context = None - """ Encounter or Episode created from. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - self.date = None """ When the assessment was documented. Type `FHIRDate` (represented as `str` in JSON). """ @@ -62,6 +54,10 @@ def __init__(self, jsondict=None, strict=True): """ Time of assessment. Type `Period` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.finding = None """ Possible or likely findings and diagnoses. List of `ClinicalImpressionFinding` items (represented as `dict` in JSON). """ @@ -71,7 +67,7 @@ def __init__(self, jsondict=None, strict=True): List of `Identifier` items (represented as `dict` in JSON). """ self.investigation = None - """ One or more sets of investigations (signs, symptions, etc.). + """ One or more sets of investigations (signs, symptoms, etc.). List of `ClinicalImpressionInvestigation` items (represented as `dict` in JSON). """ self.note = None @@ -80,11 +76,11 @@ def __init__(self, jsondict=None, strict=True): self.previous = None """ Reference to last assessment. - Type `FHIRReference` referencing `ClinicalImpression` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.problem = None """ Relevant impressions of patient state. - List of `FHIRReference` items referencing `Condition, AllergyIntolerance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.prognosisCodeableConcept = None """ Estimate of likely outcome. @@ -92,7 +88,7 @@ def __init__(self, jsondict=None, strict=True): self.prognosisReference = None """ RiskAssessment expressing likely outcome. - List of `FHIRReference` items referencing `RiskAssessment` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.protocol = None """ Clinical Protocol followed. @@ -102,27 +98,34 @@ def __init__(self, jsondict=None, strict=True): """ draft | completed | entered-in-error. Type `str`. """ + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.subject = None """ Patient or group assessed. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.summary = None """ Summary of the assessment. Type `str`. """ + self.supportingInfo = None + """ Information supporting the clinical impression. + List of `FHIRReference` items (represented as `dict` in JSON). """ + super(ClinicalImpression, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ClinicalImpression, self).elementProperties() js.extend([ - ("action", "action", fhirreference.FHIRReference, True, None, False), ("assessor", "assessor", fhirreference.FHIRReference, False, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("finding", "finding", ClinicalImpressionFinding, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("investigation", "investigation", ClinicalImpressionInvestigation, True, None, False), @@ -133,8 +136,10 @@ def elementProperties(self): ("prognosisReference", "prognosisReference", fhirreference.FHIRReference, True, None, False), ("protocol", "protocol", str, True, None, False), ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), ("summary", "summary", str, False, None, False), + ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), ]) return js @@ -144,7 +149,7 @@ def elementProperties(self): class ClinicalImpressionFinding(backboneelement.BackboneElement): """ Possible or likely findings and diagnoses. - Specific findings or diagnoses that was considered likely or relevant to + Specific findings or diagnoses that were considered likely or relevant to ongoing treatment. """ @@ -168,7 +173,7 @@ def __init__(self, jsondict=None, strict=True): self.itemReference = None """ What was found. - Type `FHIRReference` referencing `Condition, Observation` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ClinicalImpressionFinding, self).__init__(jsondict=jsondict, strict=strict) @@ -176,17 +181,17 @@ def elementProperties(self): js = super(ClinicalImpressionFinding, self).elementProperties() js.extend([ ("basis", "basis", str, False, None, False), - ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", True), - ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", True), + ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, None, False), + ("itemReference", "itemReference", fhirreference.FHIRReference, False, None, False), ]) return js class ClinicalImpressionInvestigation(backboneelement.BackboneElement): - """ One or more sets of investigations (signs, symptions, etc.). + """ One or more sets of investigations (signs, symptoms, etc.). - One or more sets of investigations (signs, symptions, etc.). The actual - grouping of investigations vary greatly depending on the type and context + One or more sets of investigations (signs, symptoms, etc.). The actual + grouping of investigations varies greatly depending on the type and context of the assessment. These investigations may include data generated during the assessment process, or data previously generated and recorded that is pertinent to the outcomes. @@ -208,7 +213,7 @@ def __init__(self, jsondict=None, strict=True): self.item = None """ Record of a specific investigation. - List of `FHIRReference` items referencing `Observation, QuestionnaireResponse, FamilyMemberHistory, DiagnosticReport, RiskAssessment, ImagingStudy` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(ClinicalImpressionInvestigation, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/clinicalimpression_tests.py b/fhirclient/models/clinicalimpression_tests.py index c6188c9ab..dc097f927 100644 --- a/fhirclient/models/clinicalimpression_tests.py +++ b/fhirclient/models/clinicalimpression_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -44,6 +44,9 @@ def implClinicalImpression1(self, inst): self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].value, "12345") self.assertEqual(inst.investigation[0].code.text, "Initial Examination") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "completed") self.assertEqual(inst.summary, "provisional diagnoses of laceration of head and traumatic brain injury (TBI)") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/codeableconcept.py b/fhirclient/models/codeableconcept.py index 486886974..62b9d6207 100644 --- a/fhirclient/models/codeableconcept.py +++ b/fhirclient/models/codeableconcept.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/codesystem.py b/fhirclient/models/codesystem.py index 369f70df4..7f2a8dc11 100644 --- a/fhirclient/models/codesystem.py +++ b/fhirclient/models/codesystem.py @@ -1,17 +1,19 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/CodeSystem) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CodeSystem) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class CodeSystem(domainresource.DomainResource): - """ A set of codes drawn from one or more code systems. + """ Declares the existence of and describes a code system or code system + supplement. - A code system resource specifies a set of codes drawn from one or more code - systems. + The CodeSystem resource is used to declare the existence of and describe a + code system or code system supplement and its key properties, and + optionally define a part or all of its content. """ resource_type = "CodeSystem" @@ -29,7 +31,7 @@ def __init__(self, jsondict=None, strict=True): Type `bool`. """ self.compositional = None - """ If code system defines a post-composition grammar. + """ If code system defines a compositional grammar. Type `bool`. """ self.concept = None @@ -41,7 +43,7 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.content = None - """ not-present | example | fragment | complete. + """ not-present | example | fragment | complete | supplement. Type `str`. """ self.copyright = None @@ -53,7 +55,7 @@ def __init__(self, jsondict=None, strict=True): Type `int`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -73,8 +75,8 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.identifier = None - """ Additional identifier for the code system. - Type `Identifier` (represented as `dict` in JSON). """ + """ Additional identifier for the code system (business identifier). + List of `Identifier` items (represented as `dict` in JSON). """ self.jurisdiction = None """ Intended jurisdiction for code system (if applicable). @@ -100,21 +102,26 @@ def __init__(self, jsondict=None, strict=True): """ draft | active | retired | unknown. Type `str`. """ + self.supplements = None + """ Canonical URL of Code System this adds designations and properties + to. + Type `str`. """ + self.title = None """ Name for this code system (human friendly). Type `str`. """ self.url = None - """ Logical URI to reference this code system (globally unique) - (Coding.system). + """ Canonical identifier for this code system, represented as a URI + (globally unique) (Coding.system). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.valueSet = None - """ Canonical URL for value set with entire code system. + """ Canonical reference to the value set with entire code system. Type `str`. """ self.version = None @@ -142,13 +149,14 @@ def elementProperties(self): ("experimental", "experimental", bool, False, None, False), ("filter", "filter", CodeSystemFilter, True, None, False), ("hierarchyMeaning", "hierarchyMeaning", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("name", "name", str, False, None, False), ("property", "property", CodeSystemProperty, True, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("status", "status", str, False, None, True), + ("supplements", "supplements", str, False, None, False), ("title", "title", str, False, None, False), ("url", "url", str, False, None, False), ("useContext", "useContext", usagecontext.UsageContext, True, None, False), @@ -166,7 +174,7 @@ class CodeSystemConcept(backboneelement.BackboneElement): Concepts that are in the code system. The concept definitions are inherently hierarchical, but the definitions must be consulted to determine - what the meaning of the hierarchical relationships are. + what the meanings of the hierarchical relationships are. """ resource_type = "CodeSystemConcept" @@ -295,6 +303,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of the property for this concept. Type `FHIRDate` (represented as `str` in JSON). """ + self.valueDecimal = None + """ Value of the property for this concept. + Type `float`. """ + self.valueInteger = None """ Value of the property for this concept. Type `int`. """ @@ -313,6 +325,7 @@ def elementProperties(self): ("valueCode", "valueCode", str, False, "value", True), ("valueCoding", "valueCoding", coding.Coding, False, "value", True), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", True), + ("valueDecimal", "valueDecimal", float, False, "value", True), ("valueInteger", "valueInteger", int, False, "value", True), ("valueString", "valueString", str, False, "value", True), ]) @@ -392,7 +405,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.type = None - """ code | Coding | string | integer | boolean | dateTime. + """ code | Coding | string | integer | boolean | dateTime | decimal. Type `str`. """ self.uri = None diff --git a/fhirclient/models/codesystem_tests.py b/fhirclient/models/codesystem_tests.py index 9715349fc..523f28ab9 100644 --- a/fhirclient/models/codesystem_tests.py +++ b/fhirclient/models/codesystem_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return codesystem.CodeSystem(js) def testCodeSystem1(self): - inst = self.instantiate_from("codesystem-example-summary.json") + inst = self.instantiate_from("codesystem-example-supplement.json") self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") self.implCodeSystem1(inst) @@ -32,6 +32,157 @@ def testCodeSystem1(self): self.implCodeSystem1(inst2) def implCodeSystem1(self, inst): + self.assertEqual(inst.concept[0].code, "chol-mmol") + self.assertEqual(inst.concept[0].property[0].code, "legacy") + self.assertFalse(inst.concept[0].property[0].valueBoolean) + self.assertEqual(inst.concept[1].code, "chol-mass") + self.assertEqual(inst.concept[1].property[0].code, "legacy") + self.assertTrue(inst.concept[1].property[0].valueBoolean) + self.assertEqual(inst.concept[2].code, "chol") + self.assertEqual(inst.concept[2].property[0].code, "legacy") + self.assertTrue(inst.concept[2].property[0].valueBoolean) + self.assertEqual(inst.contact[0].name, "FHIR project team") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.content, "supplement") + self.assertEqual(inst.date.date, FHIRDate("2016-01-28").date) + self.assertEqual(inst.date.as_json(), "2016-01-28") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-supplement") + self.assertEqual(inst.name, "CholCodeLegacyStatus") + self.assertEqual(inst.property[0].code, "legacy") + self.assertEqual(inst.property[0].description, "hether the test is currently performed") + self.assertEqual(inst.property[0].type, "boolean") + self.assertEqual(inst.publisher, "ACME Co") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.supplements, "http://hl7.org/fhir/CodeSystem/example") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/CodeSystem/example-supplement") + self.assertEqual(inst.version, "201801103") + + def testCodeSystem2(self): + inst = self.instantiate_from("codesystem-list-example-codes.json") + self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") + self.implCodeSystem2(inst) + + js = inst.as_json() + self.assertEqual("CodeSystem", js["resourceType"]) + inst2 = codesystem.CodeSystem(js) + self.implCodeSystem2(inst2) + + def implCodeSystem2(self, inst): + self.assertTrue(inst.caseSensitive) + self.assertEqual(inst.concept[0].code, "alerts") + self.assertEqual(inst.concept[0].definition, "A list of alerts for the patient.") + self.assertEqual(inst.concept[0].display, "Alerts") + self.assertEqual(inst.concept[1].code, "adverserxns") + self.assertEqual(inst.concept[1].definition, "A list of part adverse reactions.") + self.assertEqual(inst.concept[1].display, "Adverse Reactions") + self.assertEqual(inst.concept[2].code, "allergies") + self.assertEqual(inst.concept[2].definition, "A list of Allergies for the patient.") + self.assertEqual(inst.concept[2].display, "Allergies") + self.assertEqual(inst.concept[3].code, "medications") + self.assertEqual(inst.concept[3].definition, "A list of medication statements for the patient.") + self.assertEqual(inst.concept[3].display, "Medication List") + self.assertEqual(inst.concept[4].code, "problems") + self.assertEqual(inst.concept[4].definition, "A list of problems that the patient is known of have (or have had in the past).") + self.assertEqual(inst.concept[4].display, "Problem List") + self.assertEqual(inst.concept[5].code, "worklist") + self.assertEqual(inst.concept[5].definition, "A list of items that constitute a set of work to be performed (typically this code would be specialized for more specific uses, such as a ward round list).") + self.assertEqual(inst.concept[5].display, "Worklist") + self.assertEqual(inst.concept[6].code, "waiting") + self.assertEqual(inst.concept[6].definition, "A list of items waiting for an event (perhaps a surgical patient waiting list).") + self.assertEqual(inst.concept[6].display, "Waiting List") + self.assertEqual(inst.concept[7].code, "protocols") + self.assertEqual(inst.concept[7].definition, "A set of protocols to be followed.") + self.assertEqual(inst.concept[7].display, "Protocols") + self.assertEqual(inst.concept[8].code, "plans") + self.assertEqual(inst.concept[8].definition, "A set of care plans that apply in a particular context of care.") + self.assertEqual(inst.concept[8].display, "Care Plans") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.content, "complete") + self.assertEqual(inst.description, "Example use codes for the List resource - typical kinds of use.") + self.assertFalse(inst.experimental) + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg") + self.assertEqual(inst.extension[0].valueCode, "fhir") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status") + self.assertEqual(inst.extension[1].valueCode, "draft") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm") + self.assertEqual(inst.extension[2].valueInteger, 1) + self.assertEqual(inst.id, "list-example-codes") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:2.16.840.1.113883.4.642.1.1105") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2018-12-27T22:37:54.724+11:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2018-12-27T22:37:54.724+11:00") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablecodesystem") + self.assertEqual(inst.name, "ExampleUseCodesForList") + self.assertEqual(inst.publisher, "FHIR Project") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Example Use Codes for List") + self.assertEqual(inst.url, "http://terminology.hl7.org/CodeSystem/list-example-use-codes") + self.assertEqual(inst.valueSet, "http://hl7.org/fhir/ValueSet/list-example-codes") + self.assertEqual(inst.version, "4.0.0") + + def testCodeSystem3(self): + inst = self.instantiate_from("codesystem-examplescenario-actor-type.json") + self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") + self.implCodeSystem3(inst) + + js = inst.as_json() + self.assertEqual("CodeSystem", js["resourceType"]) + inst2 = codesystem.CodeSystem(js) + self.implCodeSystem3(inst2) + + def implCodeSystem3(self, inst): + self.assertTrue(inst.caseSensitive) + self.assertEqual(inst.concept[0].code, "person") + self.assertEqual(inst.concept[0].definition, "A person.") + self.assertEqual(inst.concept[0].display, "Person") + self.assertEqual(inst.concept[1].code, "entity") + self.assertEqual(inst.concept[1].definition, "A system.") + self.assertEqual(inst.concept[1].display, "System") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.contact[0].telecom[1].system, "email") + self.assertEqual(inst.contact[0].telecom[1].value, "fhir@lists.hl7.org") + self.assertEqual(inst.content, "complete") + self.assertEqual(inst.date.date, FHIRDate("2018-12-27T22:37:54+11:00").date) + self.assertEqual(inst.date.as_json(), "2018-12-27T22:37:54+11:00") + self.assertEqual(inst.description, "The type of actor - system or human.") + self.assertFalse(inst.experimental) + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg") + self.assertEqual(inst.extension[0].valueCode, "fhir") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status") + self.assertEqual(inst.extension[1].valueCode, "trial-use") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm") + self.assertEqual(inst.extension[2].valueInteger, 0) + self.assertEqual(inst.id, "examplescenario-actor-type") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:2.16.840.1.113883.4.642.1.859") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2018-12-27T22:37:54.724+11:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2018-12-27T22:37:54.724+11:00") + self.assertEqual(inst.name, "ExampleScenarioActorType") + self.assertEqual(inst.publisher, "HL7 (FHIR Project)") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "ExampleScenarioActorType") + self.assertEqual(inst.url, "http://hl7.org/fhir/examplescenario-actor-type") + self.assertEqual(inst.valueSet, "http://hl7.org/fhir/ValueSet/examplescenario-actor-type") + self.assertEqual(inst.version, "4.0.0") + + def testCodeSystem4(self): + inst = self.instantiate_from("codesystem-example-summary.json") + self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") + self.implCodeSystem4(inst) + + js = inst.as_json() + self.assertEqual("CodeSystem", js["resourceType"]) + inst2 = codesystem.CodeSystem(js) + self.implCodeSystem4(inst2) + + def implCodeSystem4(self, inst): self.assertTrue(inst.caseSensitive) self.assertEqual(inst.contact[0].name, "FHIR project team") self.assertEqual(inst.contact[0].telecom[0].system, "url") @@ -53,18 +204,19 @@ def implCodeSystem1(self, inst): self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "337915000") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Homo sapiens (organism)") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.version, "4.0.0") - def testCodeSystem2(self): + def testCodeSystem5(self): inst = self.instantiate_from("codesystem-example.json") self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") - self.implCodeSystem2(inst) + self.implCodeSystem5(inst) js = inst.as_json() self.assertEqual("CodeSystem", js["resourceType"]) inst2 = codesystem.CodeSystem(js) - self.implCodeSystem2(inst2) + self.implCodeSystem5(inst2) - def implCodeSystem2(self, inst): + def implCodeSystem5(self, inst): self.assertTrue(inst.caseSensitive) self.assertEqual(inst.concept[0].code, "chol-mmol") self.assertEqual(inst.concept[0].definition, "Serum Cholesterol, in mmol/L") @@ -92,78 +244,19 @@ def implCodeSystem2(self, inst): self.assertEqual(inst.date.as_json(), "2016-01-28") self.assertEqual(inst.description, "This is an example code system that includes all the ACME codes for serum/plasma cholesterol from v2.36.") self.assertTrue(inst.experimental) + self.assertEqual(inst.filter[0].code, "acme-plasma") + self.assertEqual(inst.filter[0].description, "An internal filter used to select codes that are only used with plasma") + self.assertEqual(inst.filter[0].operator[0], "=") + self.assertEqual(inst.filter[0].value, "the value of this filter is either 'true' or 'false'") self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.system, "http://acme.com/identifiers/codesystems") - self.assertEqual(inst.identifier.value, "internal-cholesterol-inl") + self.assertEqual(inst.identifier[0].system, "http://acme.com/identifiers/codesystems") + self.assertEqual(inst.identifier[0].value, "internal-cholesterol-inl") self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablecodesystem") - self.assertEqual(inst.name, "ACME Codes for Cholesterol in Serum/Plasma") - self.assertEqual(inst.publisher, "HL7 International") + self.assertEqual(inst.name, "ACMECholCodesBlood") + self.assertEqual(inst.publisher, "Acme Co") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "ACME Codes for Cholesterol in Serum/Plasma") self.assertEqual(inst.url, "http://hl7.org/fhir/CodeSystem/example") self.assertEqual(inst.version, "20160128") - - def testCodeSystem3(self): - inst = self.instantiate_from("codesystem-list-example-codes.json") - self.assertIsNotNone(inst, "Must have instantiated a CodeSystem instance") - self.implCodeSystem3(inst) - - js = inst.as_json() - self.assertEqual("CodeSystem", js["resourceType"]) - inst2 = codesystem.CodeSystem(js) - self.implCodeSystem3(inst2) - - def implCodeSystem3(self, inst): - self.assertTrue(inst.caseSensitive) - self.assertEqual(inst.concept[0].code, "alerts") - self.assertEqual(inst.concept[0].definition, "A list of alerts for the patient.") - self.assertEqual(inst.concept[0].display, "Alerts") - self.assertEqual(inst.concept[1].code, "adverserxns") - self.assertEqual(inst.concept[1].definition, "A list of part adverse reactions.") - self.assertEqual(inst.concept[1].display, "Adverse Reactions") - self.assertEqual(inst.concept[2].code, "allergies") - self.assertEqual(inst.concept[2].definition, "A list of Allergies for the patient.") - self.assertEqual(inst.concept[2].display, "Allergies") - self.assertEqual(inst.concept[3].code, "medications") - self.assertEqual(inst.concept[3].definition, "A list of medication statements for the patient.") - self.assertEqual(inst.concept[3].display, "Medication List") - self.assertEqual(inst.concept[4].code, "problems") - self.assertEqual(inst.concept[4].definition, "A list of problems that the patient is known of have (or have had in the past).") - self.assertEqual(inst.concept[4].display, "Problem List") - self.assertEqual(inst.concept[5].code, "worklist") - self.assertEqual(inst.concept[5].definition, "A list of items that constitute a set of work to be performed (typically this code would be specialized for more specific uses, such as a ward round list).") - self.assertEqual(inst.concept[5].display, "Worklist") - self.assertEqual(inst.concept[6].code, "waiting") - self.assertEqual(inst.concept[6].definition, "A list of items waiting for an event (perhaps a surgical patient waiting list).") - self.assertEqual(inst.concept[6].display, "Waiting List") - self.assertEqual(inst.concept[7].code, "protocols") - self.assertEqual(inst.concept[7].definition, "A set of protocols to be followed.") - self.assertEqual(inst.concept[7].display, "Protocols") - self.assertEqual(inst.concept[8].code, "plans") - self.assertEqual(inst.concept[8].definition, "A set of care plans that apply in a particular context of care.") - self.assertEqual(inst.concept[8].display, "Care Plans") - self.assertEqual(inst.contact[0].telecom[0].system, "url") - self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.content, "complete") - self.assertEqual(inst.description, "Example use codes for the List resource - typical kinds of use.") - self.assertTrue(inst.experimental) - self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-ballot-status") - self.assertEqual(inst.extension[0].valueString, "Informative") - self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm") - self.assertEqual(inst.extension[1].valueInteger, 1) - self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg") - self.assertEqual(inst.extension[2].valueCode, "fhir") - self.assertEqual(inst.id, "list-example-codes") - self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier.value, "urn:oid:2.16.840.1.113883.4.642.1.308") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2017-03-21T21:41:32.180+00:00").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2017-03-21T21:41:32.180+00:00") - self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablecodesystem") - self.assertEqual(inst.name, "Example Use Codes for List") - self.assertEqual(inst.publisher, "FHIR Project") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/list-example-use-codes") - self.assertEqual(inst.valueSet, "http://hl7.org/fhir/ValueSet/list-example-codes") - self.assertEqual(inst.version, "3.0.0") diff --git a/fhirclient/models/coding.py b/fhirclient/models/coding.py index 099f6bad1..aca3bd376 100644 --- a/fhirclient/models/coding.py +++ b/fhirclient/models/coding.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Coding) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Coding) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/communication.py b/fhirclient/models/communication.py index 024d6ff3c..45ab50d5d 100644 --- a/fhirclient/models/communication.py +++ b/fhirclient/models/communication.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Communication) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Communication) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,7 +11,7 @@ class Communication(domainresource.DomainResource): """ A record of information transmitted from a sender to a receiver. An occurrence of information being transmitted; e.g. an alert that was sent - to a responsible provider, a public health agency was notified about a + to a responsible provider, a public health agency that was notified about a reportable condition. """ @@ -25,57 +25,65 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.about = None + """ Resources that pertain to this communication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.basedOn = None """ Request fulfilled by this communication. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ Message category. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.context = None - """ Encounter or episode leading to message. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - - self.definition = None - """ Instantiates protocol or definition. - List of `FHIRReference` items referencing `PlanDefinition, ActivityDefinition` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ Unique identifier. List of `Identifier` items (represented as `dict` in JSON). """ + self.inResponseTo = None + """ Reply to. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + self.medium = None """ A channel of communication. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.notDone = None - """ Communication did not occur. - Type `bool`. """ - - self.notDoneReason = None - """ Why communication did not occur. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.note = None """ Comments made about the communication. List of `Annotation` items (represented as `dict` in JSON). """ self.partOf = None """ Part of this action. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.payload = None """ Message payload. List of `CommunicationPayload` items (represented as `dict` in JSON). """ + self.priority = None + """ Message urgency. + Type `str`. """ + self.reasonCode = None """ Indication for message. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None """ Why was communication done?. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.received = None """ When received. @@ -83,45 +91,51 @@ def __init__(self, jsondict=None, strict=True): self.recipient = None """ Message recipient. - List of `FHIRReference` items referencing `Device, Organization, Patient, Practitioner, RelatedPerson, Group` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.sender = None """ Message sender. - Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.sent = None """ When sent. Type `FHIRDate` (represented as `str` in JSON). """ self.status = None - """ preparation | in-progress | suspended | aborted | completed | - entered-in-error. + """ preparation | in-progress | not-done | suspended | aborted | + completed | entered-in-error. Type `str`. """ + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.subject = None """ Focus of message. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.topic = None - """ Focal resources. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + """ Description of the purpose/content. + Type `CodeableConcept` (represented as `dict` in JSON). """ super(Communication, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Communication, self).elementProperties() js.extend([ + ("about", "about", fhirreference.FHIRReference, True, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("inResponseTo", "inResponseTo", fhirreference.FHIRReference, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), ("medium", "medium", codeableconcept.CodeableConcept, True, None, False), - ("notDone", "notDone", bool, False, None, False), - ("notDoneReason", "notDoneReason", codeableconcept.CodeableConcept, False, None, False), ("note", "note", annotation.Annotation, True, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("payload", "payload", CommunicationPayload, True, None, False), + ("priority", "priority", str, False, None, False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("received", "received", fhirdate.FHIRDate, False, None, False), @@ -129,8 +143,9 @@ def elementProperties(self): ("sender", "sender", fhirreference.FHIRReference, False, None, False), ("sent", "sent", fhirdate.FHIRDate, False, None, False), ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("topic", "topic", fhirreference.FHIRReference, True, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -159,7 +174,7 @@ def __init__(self, jsondict=None, strict=True): self.contentReference = None """ Message part content. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.contentString = None """ Message part content. diff --git a/fhirclient/models/communication_tests.py b/fhirclient/models/communication_tests.py index e9eb5aa3e..814ca2089 100644 --- a/fhirclient/models/communication_tests.py +++ b/fhirclient/models/communication_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,6 +37,9 @@ def implCommunication1(self, inst): self.assertEqual(inst.id, "fm-attachment") self.assertEqual(inst.identifier[0].system, "http://www.providerco.com/communication") self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payload[0].contentAttachment.contentType, "application/pdf") self.assertEqual(inst.payload[0].contentAttachment.creation.date, FHIRDate("2010-02-01T11:50:23-05:00").date) self.assertEqual(inst.payload[0].contentAttachment.creation.as_json(), "2010-02-01T11:50:23-05:00") @@ -47,7 +50,7 @@ def implCommunication1(self, inst): self.assertEqual(inst.payload[1].contentAttachment.creation.as_json(), "2010-02-01T10:57:34+01:00") self.assertEqual(inst.payload[1].contentAttachment.hash, "SGVsbG8gdGhlcmU=") self.assertEqual(inst.payload[1].contentAttachment.size, 104274) - self.assertEqual(inst.payload[1].contentAttachment.url, "http://happyvalley.com/docs/AB12345") + self.assertEqual(inst.payload[1].contentAttachment.url, "http://example.org/docs/AB12345") self.assertEqual(inst.sent.date, FHIRDate("2016-06-12T18:01:10-08:00").date) self.assertEqual(inst.sent.as_json(), "2016-06-12T18:01:10-08:00") self.assertEqual(inst.status, "completed") @@ -73,6 +76,9 @@ def implCommunication2(self, inst): self.assertEqual(inst.id, "fm-solicited") self.assertEqual(inst.identifier[0].system, "http://www.providerco.com/communication") self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payload[0].contentAttachment.contentType, "application/pdf") self.assertEqual(inst.payload[0].contentAttachment.creation.date, FHIRDate("2010-02-01T11:50:23-05:00").date) self.assertEqual(inst.payload[0].contentAttachment.creation.as_json(), "2010-02-01T11:50:23-05:00") @@ -108,10 +114,14 @@ def implCommunication3(self, inst): self.assertEqual(inst.identifier[0].system, "urn:oid:1.3.4.5.6.7") self.assertEqual(inst.identifier[0].type.text, "Paging System") self.assertEqual(inst.identifier[0].value, "2345678901") + self.assertEqual(inst.instantiatesUri[0], "http://example.org/hyperkalemia") self.assertEqual(inst.medium[0].coding[0].code, "WRITTEN") self.assertEqual(inst.medium[0].coding[0].display, "written") - self.assertEqual(inst.medium[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationMode") + self.assertEqual(inst.medium[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationMode") self.assertEqual(inst.medium[0].text, "written") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.payload[0].contentString, "Patient 1 has a very high serum potassium value (7.2 mmol/L on 2014-Dec-12 at 5:55 pm)") self.assertEqual(inst.received.date, FHIRDate("2014-12-12T18:01:11-08:00").date) self.assertEqual(inst.received.as_json(), "2014-12-12T18:01:11-08:00") diff --git a/fhirclient/models/communicationrequest.py b/fhirclient/models/communicationrequest.py index dd307583d..8a3920037 100644 --- a/fhirclient/models/communicationrequest.py +++ b/fhirclient/models/communicationrequest.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -25,21 +25,29 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.about = None + """ Resources that pertain to this communication request. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.authoredOn = None """ When request transitioned to being actionable. Type `FHIRDate` (represented as `str` in JSON). """ self.basedOn = None """ Fulfills plan or proposal. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ Message category. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.context = None - """ Encounter or episode leading to message. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.doNotPerform = None + """ True if request is prohibiting action. + Type `bool`. """ + + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.groupIdentifier = None """ Composite request this is part of. @@ -79,46 +87,48 @@ def __init__(self, jsondict=None, strict=True): self.reasonReference = None """ Why is communication needed?. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.recipient = None """ Message recipient. - List of `FHIRReference` items referencing `Device, Organization, Patient, Practitioner, RelatedPerson, Group, CareTeam` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.replaces = None """ Request(s) replaced by this request. - List of `FHIRReference` items referencing `CommunicationRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.requester = None """ Who/what is requesting service. - Type `CommunicationRequestRequester` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.sender = None """ Message sender. - Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ draft | active | suspended | cancelled | completed | entered-in- error | unknown. Type `str`. """ + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.subject = None """ Focus of message. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ - - self.topic = None - """ Focal resources. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(CommunicationRequest, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(CommunicationRequest, self).elementProperties() js.extend([ + ("about", "about", fhirreference.FHIRReference, True, None, False), ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), + ("doNotPerform", "doNotPerform", bool, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("medium", "medium", codeableconcept.CodeableConcept, True, None, False), @@ -131,11 +141,11 @@ def elementProperties(self): ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), - ("requester", "requester", CommunicationRequestRequester, False, None, False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), ("sender", "sender", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("topic", "topic", fhirreference.FHIRReference, True, None, False), ]) return js @@ -164,7 +174,7 @@ def __init__(self, jsondict=None, strict=True): self.contentReference = None """ Message part content. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.contentString = None """ Message part content. @@ -182,42 +192,6 @@ def elementProperties(self): return js -class CommunicationRequestRequester(backboneelement.BackboneElement): - """ Who/what is requesting service. - - The individual who initiated the request and has responsibility for its - activation. - """ - - resource_type = "CommunicationRequestRequester" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.agent = None - """ Individual making the request. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ - - self.onBehalfOf = None - """ Organization agent is acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - super(CommunicationRequestRequester, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(CommunicationRequestRequester, self).elementProperties() - js.extend([ - ("agent", "agent", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), - ]) - return js - - import sys try: from . import annotation diff --git a/fhirclient/models/communicationrequest_tests.py b/fhirclient/models/communicationrequest_tests.py index 216332321..0a1ab9495 100644 --- a/fhirclient/models/communicationrequest_tests.py +++ b/fhirclient/models/communicationrequest_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return communicationrequest.CommunicationRequest(js) def testCommunicationRequest1(self): - inst = self.instantiate_from("communicationrequest-example-fm-solicit-attachment.json") + inst = self.instantiate_from("communicationrequest-example.json") self.assertIsNotNone(inst, "Must have instantiated a CommunicationRequest instance") self.implCommunicationRequest1(inst) @@ -32,6 +32,25 @@ def testCommunicationRequest1(self): self.implCommunicationRequest1(inst2) def implCommunicationRequest1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
To be filled out at a later time
") + self.assertEqual(inst.text.status, "generated") + + def testCommunicationRequest2(self): + inst = self.instantiate_from("communicationrequest-example-fm-solicit-attachment.json") + self.assertIsNotNone(inst, "Must have instantiated a CommunicationRequest instance") + self.implCommunicationRequest2(inst) + + js = inst.as_json() + self.assertEqual("CommunicationRequest", js["resourceType"]) + inst2 = communicationrequest.CommunicationRequest(js) + self.implCommunicationRequest2(inst2) + + def implCommunicationRequest2(self, inst): self.assertEqual(inst.authoredOn.date, FHIRDate("2016-06-10T11:01:10-08:00").date) self.assertEqual(inst.authoredOn.as_json(), "2016-06-10T11:01:10-08:00") self.assertEqual(inst.category[0].coding[0].code, "SolicitedAttachmentRequest") @@ -45,8 +64,11 @@ def implCommunicationRequest1(self, inst): self.assertEqual(inst.identifier[0].value, "ABC123") self.assertEqual(inst.medium[0].coding[0].code, "WRITTEN") self.assertEqual(inst.medium[0].coding[0].display, "written") - self.assertEqual(inst.medium[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationMode") + self.assertEqual(inst.medium[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationMode") self.assertEqual(inst.medium[0].text, "written") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2016-06-10T11:01:10-08:00").date) self.assertEqual(inst.occurrenceDateTime.as_json(), "2016-06-10T11:01:10-08:00") self.assertEqual(inst.payload[0].contentString, "Please provide the accident report and any associated pictures to support your Claim# DEF5647.") @@ -54,20 +76,4 @@ def implCommunicationRequest1(self, inst): self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
Request for Accident Report
") self.assertEqual(inst.text.status, "generated") - - def testCommunicationRequest2(self): - inst = self.instantiate_from("communicationrequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a CommunicationRequest instance") - self.implCommunicationRequest2(inst) - - js = inst.as_json() - self.assertEqual("CommunicationRequest", js["resourceType"]) - inst2 = communicationrequest.CommunicationRequest(js) - self.implCommunicationRequest2(inst2) - - def implCommunicationRequest2(self, inst): - self.assertEqual(inst.id, "example") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
To be filled out at a later time
") - self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/compartmentdefinition.py b/fhirclient/models/compartmentdefinition.py index 810e64273..b3f0f8a6b 100644 --- a/fhirclient/models/compartmentdefinition.py +++ b/fhirclient/models/compartmentdefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -33,7 +33,7 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -44,10 +44,6 @@ def __init__(self, jsondict=None, strict=True): """ For testing purposes, not real usage. Type `bool`. """ - self.jurisdiction = None - """ Intended jurisdiction for compartment definition (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.name = None """ Name for this compartment definition (computer friendly). Type `str`. """ @@ -72,19 +68,19 @@ def __init__(self, jsondict=None, strict=True): """ draft | active | retired | unknown. Type `str`. """ - self.title = None - """ Name for this compartment definition (human friendly). - Type `str`. """ - self.url = None - """ Logical URI to reference this compartment definition (globally - unique). + """ Canonical identifier for this compartment definition, represented + as a URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ + self.version = None + """ Business version of the compartment definition. + Type `str`. """ + super(CompartmentDefinition, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -95,16 +91,15 @@ def elementProperties(self): ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), ("experimental", "experimental", bool, False, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("name", "name", str, False, None, True), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("resource", "resource", CompartmentDefinitionResource, True, None, False), ("search", "search", bool, False, None, True), ("status", "status", str, False, None, True), - ("title", "title", str, False, None, False), ("url", "url", str, False, None, True), ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), ]) return js @@ -152,10 +147,6 @@ def elementProperties(self): import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] try: from . import contactdetail except ImportError: diff --git a/fhirclient/models/compartmentdefinition_tests.py b/fhirclient/models/compartmentdefinition_tests.py index 6ca75ce4d..8914fb027 100644 --- a/fhirclient/models/compartmentdefinition_tests.py +++ b/fhirclient/models/compartmentdefinition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -41,9 +41,6 @@ def implCompartmentDefinition1(self, inst): self.assertEqual(inst.description, "The set of resources associated with a particular Device (example with Communication and CommunicationRequest resourses only).") self.assertTrue(inst.experimental) self.assertEqual(inst.id, "example") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") - self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") self.assertEqual(inst.name, "EXAMPLE") self.assertEqual(inst.publisher, "Health Level Seven International (FHIR Infrastructure)") self.assertEqual(inst.purpose, "Provides an example of a FHIR compartment definition based on the Device resource type.") @@ -58,10 +55,9 @@ def implCompartmentDefinition1(self, inst): self.assertTrue(inst.search) self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Base FHIR compartment definition for Device(example)") self.assertEqual(inst.url, "http://hl7.org/fhir/CompartmentDefinition/example") self.assertEqual(inst.useContext[0].code.code, "focus") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "Device") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/resource-types") diff --git a/fhirclient/models/composition.py b/fhirclient/models/composition.py index c109b1493..2b7eafba8 100644 --- a/fhirclient/models/composition.py +++ b/fhirclient/models/composition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Composition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Composition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -12,12 +12,14 @@ class Composition(domainresource.DomainResource): clinical attestation. A set of healthcare-related information that is assembled together into a - single logical document that provides a single coherent statement of + single logical package that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with - regard to who is making the statement. While a Composition defines the - structure, it does not actually contain the content: rather the full - content of a document is contained in a Bundle, of which the Composition is - the first resource contained. + regard to who is making the statement. A Composition defines the structure + and narrative content necessary for a document. However, a Composition + alone does not constitute a document. Rather, the Composition must be the + first entry in a Bundle where Bundle.type=document, and any other resources + referenced from Composition must be included as subsequent entries in the + Bundle (for example Patient, Practitioner, Encounter, etc.). """ resource_type = "Composition" @@ -36,11 +38,11 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ Who and/or what authored the composition. - List of `FHIRReference` items referencing `Practitioner, Device, Patient, RelatedPerson` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.class_fhir = None + self.category = None """ Categorization of Composition. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.confidentiality = None """ As defined by affinity domain. @@ -48,7 +50,7 @@ def __init__(self, jsondict=None, strict=True): self.custodian = None """ Organization which maintains the composition. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.date = None """ Composition editing time. @@ -56,14 +58,14 @@ def __init__(self, jsondict=None, strict=True): self.encounter = None """ Context of the Composition. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.event = None """ The clinical service(s) being documented. List of `CompositionEvent` items (represented as `dict` in JSON). """ self.identifier = None - """ Logical identifier of composition (version-independent). + """ Version-independent identifier for the Composition. Type `Identifier` (represented as `dict` in JSON). """ self.relatesTo = None @@ -80,7 +82,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Who and/or what the composition is about. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.title = None """ Human Readable name/title. @@ -97,7 +99,7 @@ def elementProperties(self): js.extend([ ("attester", "attester", CompositionAttester, True, None, False), ("author", "author", fhirreference.FHIRReference, True, None, True), - ("class_fhir", "class", codeableconcept.CodeableConcept, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("confidentiality", "confidentiality", str, False, None, False), ("custodian", "custodian", fhirreference.FHIRReference, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, True), @@ -107,7 +109,7 @@ def elementProperties(self): ("relatesTo", "relatesTo", CompositionRelatesTo, True, None, False), ("section", "section", CompositionSection, True, None, False), ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), ("title", "title", str, False, None, True), ("type", "type", codeableconcept.CodeableConcept, False, None, True), ]) @@ -134,11 +136,11 @@ def __init__(self, jsondict=None, strict=True): self.mode = None """ personal | professional | legal | official. - List of `str` items. """ + Type `str`. """ self.party = None """ Who attested the composition. - Type `FHIRReference` referencing `Patient, Practitioner, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.time = None """ When the composition was attested. @@ -149,7 +151,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(CompositionAttester, self).elementProperties() js.extend([ - ("mode", "mode", str, True, None, True), + ("mode", "mode", str, False, None, True), ("party", "party", fhirreference.FHIRReference, False, None, False), ("time", "time", fhirdate.FHIRDate, False, None, False), ]) @@ -179,7 +181,7 @@ def __init__(self, jsondict=None, strict=True): self.detail = None """ The event(s) being documented. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.period = None """ The period covered by the documentation. @@ -224,7 +226,7 @@ def __init__(self, jsondict=None, strict=True): self.targetReference = None """ Target of the relationship. - Type `FHIRReference` referencing `Composition` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(CompositionRelatesTo, self).__init__(jsondict=jsondict, strict=strict) @@ -254,6 +256,10 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.author = None + """ Who and/or what authored the section. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.code = None """ Classification of section (recommended). Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -264,7 +270,12 @@ def __init__(self, jsondict=None, strict=True): self.entry = None """ A reference to data that supports this section. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.focus = None + """ Who/what the section is about, when it is not about the subject of + composition. + Type `FHIRReference` (represented as `dict` in JSON). """ self.mode = None """ working | snapshot | changes. @@ -291,9 +302,11 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(CompositionSection, self).elementProperties() js.extend([ + ("author", "author", fhirreference.FHIRReference, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("emptyReason", "emptyReason", codeableconcept.CodeableConcept, False, None, False), ("entry", "entry", fhirreference.FHIRReference, True, None, False), + ("focus", "focus", fhirreference.FHIRReference, False, None, False), ("mode", "mode", str, False, None, False), ("orderedBy", "orderedBy", codeableconcept.CodeableConcept, False, None, False), ("section", "section", CompositionSection, True, None, False), diff --git a/fhirclient/models/composition_tests.py b/fhirclient/models/composition_tests.py index 5d4cc7b2a..f729eae91 100644 --- a/fhirclient/models/composition_tests.py +++ b/fhirclient/models/composition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return composition.Composition(js) def testComposition1(self): - inst = self.instantiate_from("composition-example.json") + inst = self.instantiate_from("composition-example-mixed.json") self.assertIsNotNone(inst, "Must have instantiated a Composition instance") self.implComposition1(inst) @@ -32,18 +32,59 @@ def testComposition1(self): self.implComposition1(inst2) def implComposition1(self, inst): - self.assertEqual(inst.attester[0].mode[0], "legal") + self.assertEqual(inst.attester[0].mode, "legal") + self.assertEqual(inst.attester[0].time.date, FHIRDate("2012-01-04T09:10:14Z").date) + self.assertEqual(inst.attester[0].time.as_json(), "2012-01-04T09:10:14Z") + self.assertEqual(inst.category[0].coding[0].code, "LP173421-1") + self.assertEqual(inst.category[0].coding[0].display, "Report") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") + self.assertEqual(inst.confidentiality, "N") + self.assertEqual(inst.date.date, FHIRDate("2018-10-30T16:56:04+11:00").date) + self.assertEqual(inst.date.as_json(), "2018-10-30T16:56:04+11:00") + self.assertEqual(inst.id, "example-mixed") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.section[0].code.coding[0].code, "newborn") + self.assertEqual(inst.section[0].code.coding[0].display, "New Born Details") + self.assertEqual(inst.section[0].code.coding[0].system, "http://acme.org/codes/SectionType") + self.assertEqual(inst.section[0].text.status, "generated") + self.assertEqual(inst.section[0].title, "Child's Details") + self.assertEqual(inst.section[1].code.coding[0].code, "mother") + self.assertEqual(inst.section[1].code.coding[0].display, "Mother's Details") + self.assertEqual(inst.section[1].code.coding[0].system, "http://acme.org/codes/SectionType") + self.assertEqual(inst.section[1].text.status, "generated") + self.assertEqual(inst.section[1].title, "Mpther's Details") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Discharge Summary (Neonatal Service)") + self.assertEqual(inst.type.coding[0].code, "78418-1") + self.assertEqual(inst.type.coding[0].display, "Neonatal perinatal medicine Discharge summary") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + + def testComposition2(self): + inst = self.instantiate_from("composition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Composition instance") + self.implComposition2(inst) + + js = inst.as_json() + self.assertEqual("Composition", js["resourceType"]) + inst2 = composition.Composition(js) + self.implComposition2(inst2) + + def implComposition2(self, inst): + self.assertEqual(inst.attester[0].mode, "legal") self.assertEqual(inst.attester[0].time.date, FHIRDate("2012-01-04T09:10:14Z").date) self.assertEqual(inst.attester[0].time.as_json(), "2012-01-04T09:10:14Z") - self.assertEqual(inst.class_fhir.coding[0].code, "LP173421-1") - self.assertEqual(inst.class_fhir.coding[0].display, "Report") - self.assertEqual(inst.class_fhir.coding[0].system, "http://loinc.org") + self.assertEqual(inst.category[0].coding[0].code, "LP173421-1") + self.assertEqual(inst.category[0].coding[0].display, "Report") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.confidentiality, "N") self.assertEqual(inst.date.date, FHIRDate("2012-01-04T09:10:14Z").date) self.assertEqual(inst.date.as_json(), "2012-01-04T09:10:14Z") self.assertEqual(inst.event[0].code[0].coding[0].code, "HEALTHREC") self.assertEqual(inst.event[0].code[0].coding[0].display, "health record") - self.assertEqual(inst.event[0].code[0].coding[0].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.event[0].code[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.event[0].period.end.date, FHIRDate("2012-11-12").date) self.assertEqual(inst.event[0].period.end.as_json(), "2012-11-12") self.assertEqual(inst.event[0].period.start.date, FHIRDate("2010-07-18").date) @@ -51,6 +92,9 @@ def implComposition1(self, inst): self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier.system, "http://healthintersections.com.au/test") self.assertEqual(inst.identifier.value, "1") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.relatesTo[0].code, "replaces") self.assertEqual(inst.relatesTo[1].code, "appends") self.assertEqual(inst.relatesTo[1].targetIdentifier.system, "http://example.org/fhir/NamingSystem/document-ids") @@ -61,7 +105,7 @@ def implComposition1(self, inst): self.assertEqual(inst.section[0].mode, "snapshot") self.assertEqual(inst.section[0].orderedBy.coding[0].code, "event-date") self.assertEqual(inst.section[0].orderedBy.coding[0].display, "Sorted by Event Date") - self.assertEqual(inst.section[0].orderedBy.coding[0].system, "http://hl7.org/fhir/list-order") + self.assertEqual(inst.section[0].orderedBy.coding[0].system, "http://terminology.hl7.org/CodeSystem/list-order") self.assertEqual(inst.section[0].text.status, "generated") self.assertEqual(inst.section[0].title, "History of present illness") self.assertEqual(inst.section[1].code.coding[0].code, "10157-6") @@ -69,7 +113,7 @@ def implComposition1(self, inst): self.assertEqual(inst.section[1].code.coding[0].system, "http://loinc.org") self.assertEqual(inst.section[1].emptyReason.coding[0].code, "withheld") self.assertEqual(inst.section[1].emptyReason.coding[0].display, "Information Withheld") - self.assertEqual(inst.section[1].emptyReason.coding[0].system, "http://hl7.org/fhir/list-empty-reason") + self.assertEqual(inst.section[1].emptyReason.coding[0].system, "http://terminology.hl7.org/CodeSystem/list-empty-reason") self.assertEqual(inst.section[1].mode, "snapshot") self.assertEqual(inst.section[1].text.status, "generated") self.assertEqual(inst.section[1].title, "History of family member diseases") diff --git a/fhirclient/models/conceptmap.py b/fhirclient/models/conceptmap.py index 2e91fae1e..8446928c1 100644 --- a/fhirclient/models/conceptmap.py +++ b/fhirclient/models/conceptmap.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,8 +11,8 @@ class ConceptMap(domainresource.DomainResource): """ A map from one set of concepts to one or more other concepts. A statement of relationships from one set of concepts to one or more other - concepts - either code systems or data elements, or classes in class - models. + concepts - either concepts in code systems, or data element/data element + concepts, or classes in class models. """ resource_type = "ConceptMap" @@ -34,7 +34,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -69,24 +69,26 @@ def __init__(self, jsondict=None, strict=True): """ Why this concept map is defined. Type `str`. """ - self.sourceReference = None - """ Identifies the source of the concepts which are being mapped. - Type `FHIRReference` referencing `ValueSet` (represented as `dict` in JSON). """ + self.sourceCanonical = None + """ The source value set that contains the concepts that are being + mapped. + Type `str`. """ self.sourceUri = None - """ Identifies the source of the concepts which are being mapped. + """ The source value set that contains the concepts that are being + mapped. Type `str`. """ self.status = None """ draft | active | retired | unknown. Type `str`. """ - self.targetReference = None - """ Provides context to the mappings. - Type `FHIRReference` referencing `ValueSet` (represented as `dict` in JSON). """ + self.targetCanonical = None + """ The target value set which provides context for the mappings. + Type `str`. """ self.targetUri = None - """ Provides context to the mappings. + """ The target value set which provides context for the mappings. Type `str`. """ self.title = None @@ -94,11 +96,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this concept map (globally unique). + """ Canonical identifier for this concept map, represented as a URI + (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -121,10 +124,10 @@ def elementProperties(self): ("name", "name", str, False, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), - ("sourceReference", "sourceReference", fhirreference.FHIRReference, False, "source", False), + ("sourceCanonical", "sourceCanonical", str, False, "source", False), ("sourceUri", "sourceUri", str, False, "source", False), ("status", "status", str, False, None, True), - ("targetReference", "targetReference", fhirreference.FHIRReference, False, "target", False), + ("targetCanonical", "targetCanonical", str, False, "target", False), ("targetUri", "targetUri", str, False, "target", False), ("title", "title", str, False, None, False), ("url", "url", str, False, None, False), @@ -157,7 +160,7 @@ def __init__(self, jsondict=None, strict=True): List of `ConceptMapGroupElement` items (represented as `dict` in JSON). """ self.source = None - """ Code System (if value set crosses code systems). + """ Source system where concepts to be mapped are defined. Type `str`. """ self.sourceVersion = None @@ -165,7 +168,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.target = None - """ System of the target (if necessary). + """ Target system that the concepts are to be mapped to. Type `str`. """ self.targetVersion = None @@ -173,7 +176,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.unmapped = None - """ When no match in the mappings. + """ What to do when there is no mapping for the source concept. Type `ConceptMapGroupUnmapped` (represented as `dict` in JSON). """ super(ConceptMapGroup, self).__init__(jsondict=jsondict, strict=strict) @@ -282,7 +285,7 @@ def elementProperties(self): ("comment", "comment", str, False, None, False), ("dependsOn", "dependsOn", ConceptMapGroupElementTargetDependsOn, True, None, False), ("display", "display", str, False, None, False), - ("equivalence", "equivalence", str, False, None, False), + ("equivalence", "equivalence", str, False, None, True), ("product", "product", ConceptMapGroupElementTargetDependsOn, True, None, False), ]) return js @@ -306,12 +309,8 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.code = None - """ Value of the referenced element. - Type `str`. """ - self.display = None - """ Display for the code. + """ Display for the code (if value is a code). Type `str`. """ self.property = None @@ -322,23 +321,29 @@ def __init__(self, jsondict=None, strict=True): """ Code System (if necessary). Type `str`. """ + self.value = None + """ Value of the referenced element. + Type `str`. """ + super(ConceptMapGroupElementTargetDependsOn, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ConceptMapGroupElementTargetDependsOn, self).elementProperties() js.extend([ - ("code", "code", str, False, None, True), ("display", "display", str, False, None, False), ("property", "property", str, False, None, True), ("system", "system", str, False, None, False), + ("value", "value", str, False, None, True), ]) return js class ConceptMapGroupUnmapped(backboneelement.BackboneElement): - """ When no match in the mappings. + """ What to do when there is no mapping for the source concept. - What to do when there is no match in the mappings in the group. + What to do when there is no mapping for the source concept. "Unmapped" does + not include codes that are unmatched, and the unmapped element is ignored + in a code is specified to have equivalence = unmatched. """ resource_type = "ConceptMapGroupUnmapped" @@ -364,7 +369,8 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Canonical URL for other concept map. + """ canonical reference to an additional ConceptMap to use for mapping + if the source concept is unmapped. Type `str`. """ super(ConceptMapGroupUnmapped, self).__init__(jsondict=jsondict, strict=strict) @@ -393,10 +399,6 @@ def elementProperties(self): from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import identifier except ImportError: diff --git a/fhirclient/models/conceptmap_tests.py b/fhirclient/models/conceptmap_tests.py index 028e54bdb..fb58e8078 100644 --- a/fhirclient/models/conceptmap_tests.py +++ b/fhirclient/models/conceptmap_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return conceptmap.ConceptMap(js) def testConceptMap1(self): - inst = self.instantiate_from("conceptmap-example-2.json") + inst = self.instantiate_from("conceptmap-example.json") self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") self.implConceptMap1(inst) @@ -32,6 +32,70 @@ def testConceptMap1(self): self.implConceptMap1(inst2) def implConceptMap1(self, inst): + self.assertEqual(inst.contact[0].name, "FHIR project team (example)") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.copyright, "Creative Commons 0") + self.assertEqual(inst.date.date, FHIRDate("2012-06-13").date) + self.assertEqual(inst.date.as_json(), "2012-06-13") + self.assertEqual(inst.description, "A mapping between the FHIR and HL7 v3 AddressUse Code systems") + self.assertTrue(inst.experimental) + self.assertEqual(inst.group[0].element[0].code, "home") + self.assertEqual(inst.group[0].element[0].display, "home") + self.assertEqual(inst.group[0].element[0].target[0].code, "H") + self.assertEqual(inst.group[0].element[0].target[0].display, "home") + self.assertEqual(inst.group[0].element[0].target[0].equivalence, "equivalent") + self.assertEqual(inst.group[0].element[1].code, "work") + self.assertEqual(inst.group[0].element[1].display, "work") + self.assertEqual(inst.group[0].element[1].target[0].code, "WP") + self.assertEqual(inst.group[0].element[1].target[0].display, "work place") + self.assertEqual(inst.group[0].element[1].target[0].equivalence, "equivalent") + self.assertEqual(inst.group[0].element[2].code, "temp") + self.assertEqual(inst.group[0].element[2].display, "temp") + self.assertEqual(inst.group[0].element[2].target[0].code, "TMP") + self.assertEqual(inst.group[0].element[2].target[0].display, "temporary address") + self.assertEqual(inst.group[0].element[2].target[0].equivalence, "equivalent") + self.assertEqual(inst.group[0].element[3].code, "old") + self.assertEqual(inst.group[0].element[3].display, "old") + self.assertEqual(inst.group[0].element[3].target[0].code, "BAD") + self.assertEqual(inst.group[0].element[3].target[0].comment, "In the HL7 v3 AD, old is handled by the usablePeriod element, but you have to provide a time, there's no simple equivalent of flagging an address as old") + self.assertEqual(inst.group[0].element[3].target[0].display, "bad address") + self.assertEqual(inst.group[0].element[3].target[0].equivalence, "disjoint") + self.assertEqual(inst.group[0].source, "http://hl7.org/fhir/address-use") + self.assertEqual(inst.group[0].target, "http://terminology.hl7.org/CodeSystem/v3-AddressUse") + self.assertEqual(inst.group[0].unmapped.code, "temp") + self.assertEqual(inst.group[0].unmapped.display, "temp") + self.assertEqual(inst.group[0].unmapped.mode, "fixed") + self.assertEqual(inst.id, "101") + self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier.value, "urn:uuid:53cd62ee-033e-414c-9f58-3ca97b5ffc3b") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.name, "FHIR-v3-Address-Use") + self.assertEqual(inst.publisher, "HL7, Inc") + self.assertEqual(inst.purpose, "To help implementers map from HL7 v3/CDA to FHIR") + self.assertEqual(inst.sourceUri, "http://hl7.org/fhir/ValueSet/address-use") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.targetUri, "http://terminology.hl7.org/ValueSet/v3-AddressUse") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "FHIR/v3 Address Use Mapping") + self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/101") + self.assertEqual(inst.useContext[0].code.code, "venue") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") + self.assertEqual(inst.useContext[0].valueCodeableConcept.text, "for CCDA Usage") + self.assertEqual(inst.version, "4.0.0") + + def testConceptMap2(self): + inst = self.instantiate_from("conceptmap-example-2.json") + self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") + self.implConceptMap2(inst) + + js = inst.as_json() + self.assertEqual("ConceptMap", js["resourceType"]) + inst2 = conceptmap.ConceptMap(js) + self.implConceptMap2(inst2) + + def implConceptMap2(self, inst): self.assertEqual(inst.contact[0].name, "FHIR project team (example)") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") @@ -42,10 +106,10 @@ def implConceptMap1(self, inst): self.assertEqual(inst.group[0].element[0].code, "code") self.assertEqual(inst.group[0].element[0].display, "Example Code") self.assertEqual(inst.group[0].element[0].target[0].code, "code2") - self.assertEqual(inst.group[0].element[0].target[0].dependsOn[0].code, "some-code") self.assertEqual(inst.group[0].element[0].target[0].dependsOn[0].display, "Something Coded") - self.assertEqual(inst.group[0].element[0].target[0].dependsOn[0].property, "http://example.org/fhir/DataElement/example") + self.assertEqual(inst.group[0].element[0].target[0].dependsOn[0].property, "http://example.org/fhir/property-value/example") self.assertEqual(inst.group[0].element[0].target[0].dependsOn[0].system, "http://example.org/fhir/example3") + self.assertEqual(inst.group[0].element[0].target[0].dependsOn[0].value, "some-code") self.assertEqual(inst.group[0].element[0].target[0].display, "Some Example Code") self.assertEqual(inst.group[0].element[0].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].source, "http://example.org/fhir/example1") @@ -62,18 +126,19 @@ def implConceptMap1(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.title, "FHIR Example 2") self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/example2") + self.assertEqual(inst.version, "4.0.0") - def testConceptMap2(self): + def testConceptMap3(self): inst = self.instantiate_from("conceptmap-example-specimen-type.json") self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") - self.implConceptMap2(inst) + self.implConceptMap3(inst) js = inst.as_json() self.assertEqual("ConceptMap", js["resourceType"]) inst2 = conceptmap.ConceptMap(js) - self.implConceptMap2(inst2) + self.implConceptMap3(inst2) - def implConceptMap2(self, inst): + def implConceptMap3(self, inst): self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") self.assertEqual(inst.contact[1].telecom[0].system, "url") @@ -83,107 +148,58 @@ def implConceptMap2(self, inst): self.assertFalse(inst.experimental) self.assertEqual(inst.group[0].element[0].code, "ACNE") self.assertEqual(inst.group[0].element[0].target[0].code, "309068002") + self.assertEqual(inst.group[0].element[0].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[1].code, "ACNFLD") self.assertEqual(inst.group[0].element[1].target[0].code, "119323008") self.assertEqual(inst.group[0].element[1].target[0].comment, "HL7 term is a historical term. mapped to Pus") - self.assertEqual(inst.group[0].element[1].target[0].product[0].code, "47002008") + self.assertEqual(inst.group[0].element[1].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[1].target[0].product[0].property, "TypeModifier") self.assertEqual(inst.group[0].element[1].target[0].product[0].system, "http://snomed.info/sct") + self.assertEqual(inst.group[0].element[1].target[0].product[0].value, "47002008") self.assertEqual(inst.group[0].element[2].code, "AIRS") self.assertEqual(inst.group[0].element[2].target[0].code, "446302006") + self.assertEqual(inst.group[0].element[2].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[3].code, "ALL") self.assertEqual(inst.group[0].element[3].target[0].code, "119376003") - self.assertEqual(inst.group[0].element[3].target[0].product[0].code, "7970006") + self.assertEqual(inst.group[0].element[3].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[3].target[0].product[0].property, "TypeModifier") self.assertEqual(inst.group[0].element[3].target[0].product[0].system, "http://snomed.info/sct") + self.assertEqual(inst.group[0].element[3].target[0].product[0].value, "7970006") self.assertEqual(inst.group[0].element[4].code, "AMP") self.assertEqual(inst.group[0].element[4].target[0].code, "408654003") - self.assertEqual(inst.group[0].element[4].target[0].product[0].code, "81723002") + self.assertEqual(inst.group[0].element[4].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[4].target[0].product[0].property, "http://snomed.info/id/246380002") self.assertEqual(inst.group[0].element[4].target[0].product[0].system, "http://snomed.info/sct") + self.assertEqual(inst.group[0].element[4].target[0].product[0].value, "81723002") self.assertEqual(inst.group[0].element[5].code, "ANGI") self.assertEqual(inst.group[0].element[5].target[0].code, "119312009") self.assertEqual(inst.group[0].element[5].target[0].comment, "TBD in detail") + self.assertEqual(inst.group[0].element[5].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[6].code, "ARTC") self.assertEqual(inst.group[0].element[6].target[0].code, "119312009") self.assertEqual(inst.group[0].element[6].target[0].comment, "TBD in detail") + self.assertEqual(inst.group[0].element[6].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[7].code, "ASERU") self.assertEqual(inst.group[0].element[7].target[0].comment, "pending") self.assertEqual(inst.group[0].element[7].target[0].equivalence, "unmatched") self.assertEqual(inst.group[0].element[8].code, "ASP") self.assertEqual(inst.group[0].element[8].target[0].code, "119295008") - self.assertEqual(inst.group[0].element[8].target[0].product[0].code, "14766002") + self.assertEqual(inst.group[0].element[8].target[0].equivalence, "equivalent") self.assertEqual(inst.group[0].element[8].target[0].product[0].property, "http://snomed.info/id/246380002") self.assertEqual(inst.group[0].element[8].target[0].product[0].system, "http://snomed.info/sct") + self.assertEqual(inst.group[0].element[8].target[0].product[0].value, "14766002") self.assertEqual(inst.group[0].element[9].code, "ATTE") self.assertEqual(inst.group[0].element[9].target[0].comment, "TBD") self.assertEqual(inst.group[0].element[9].target[0].equivalence, "unmatched") - self.assertEqual(inst.group[0].source, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.group[0].source, "http://terminology.hl7.org/CodeSystem/v2-0487") self.assertEqual(inst.group[0].target, "http://snomed.info/sct") self.assertEqual(inst.id, "102") self.assertEqual(inst.name, "Specimen mapping from v2 table 0487 to SNOMED CT") self.assertEqual(inst.publisher, "FHIR project team (original source: LabMCoP)") + self.assertEqual(inst.sourceCanonical, "http://terminology.hl7.org/ValueSet/v2-0487") self.assertEqual(inst.status, "draft") + self.assertEqual(inst.targetCanonical, "http://snomed.info/id?fhir_vs") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/102") - self.assertEqual(inst.version, "20130725") - - def testConceptMap3(self): - inst = self.instantiate_from("conceptmap-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ConceptMap instance") - self.implConceptMap3(inst) - - js = inst.as_json() - self.assertEqual("ConceptMap", js["resourceType"]) - inst2 = conceptmap.ConceptMap(js) - self.implConceptMap3(inst2) - - def implConceptMap3(self, inst): - self.assertEqual(inst.contact[0].name, "FHIR project team (example)") - self.assertEqual(inst.contact[0].telecom[0].system, "url") - self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.copyright, "Creative Commons 0") - self.assertEqual(inst.date.date, FHIRDate("2012-06-13").date) - self.assertEqual(inst.date.as_json(), "2012-06-13") - self.assertEqual(inst.description, "A mapping between the FHIR and HL7 v3 AddressUse Code systems") - self.assertTrue(inst.experimental) - self.assertEqual(inst.group[0].element[0].code, "home") - self.assertEqual(inst.group[0].element[0].display, "home") - self.assertEqual(inst.group[0].element[0].target[0].code, "H") - self.assertEqual(inst.group[0].element[0].target[0].display, "home") - self.assertEqual(inst.group[0].element[1].code, "work") - self.assertEqual(inst.group[0].element[1].display, "work") - self.assertEqual(inst.group[0].element[1].target[0].code, "WP") - self.assertEqual(inst.group[0].element[1].target[0].display, "work place") - self.assertEqual(inst.group[0].element[2].code, "temp") - self.assertEqual(inst.group[0].element[2].display, "temp") - self.assertEqual(inst.group[0].element[2].target[0].code, "TMP") - self.assertEqual(inst.group[0].element[2].target[0].display, "temporary address") - self.assertEqual(inst.group[0].element[3].code, "old") - self.assertEqual(inst.group[0].element[3].display, "old") - self.assertEqual(inst.group[0].element[3].target[0].code, "BAD") - self.assertEqual(inst.group[0].element[3].target[0].comment, "In the HL7 v3 AD, old is handled by the usablePeriod element, but you have to provide a time, there's no simple equivalent of flagging an address as old") - self.assertEqual(inst.group[0].element[3].target[0].display, "bad address") - self.assertEqual(inst.group[0].element[3].target[0].equivalence, "disjoint") - self.assertEqual(inst.group[0].source, "http://hl7.org/fhir/address-use") - self.assertEqual(inst.group[0].target, "http://hl7.org/fhir/v3/AddressUse") - self.assertEqual(inst.group[0].unmapped.code, "temp") - self.assertEqual(inst.group[0].unmapped.display, "temp") - self.assertEqual(inst.group[0].unmapped.mode, "fixed") - self.assertEqual(inst.id, "101") - self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier.value, "urn:uuid:53cd62ee-033e-414c-9f58-3ca97b5ffc3b") - self.assertEqual(inst.name, "FHIR-v3-Address-Use") - self.assertEqual(inst.publisher, "HL7, Inc") - self.assertEqual(inst.purpose, "To help implementers map from HL7 v3/CDA to FHIR") - self.assertEqual(inst.sourceUri, "http://hl7.org/fhir/ValueSet/address-use") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.targetUri, "http://hl7.org/fhir/ValueSet/v3-AddressUse") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "FHIR/v3 Address Use Mapping") - self.assertEqual(inst.url, "http://hl7.org/fhir/ConceptMap/101") - self.assertEqual(inst.useContext[0].code.code, "venue") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") - self.assertEqual(inst.useContext[0].valueCodeableConcept.text, "for CDA Usage") - self.assertEqual(inst.version, "20120613") + self.assertEqual(inst.version, "4.0.0") diff --git a/fhirclient/models/condition.py b/fhirclient/models/condition.py index b7a90e31d..e83180207 100644 --- a/fhirclient/models/condition.py +++ b/fhirclient/models/condition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Condition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Condition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -25,36 +25,28 @@ def __init__(self, jsondict=None, strict=True): """ self.abatementAge = None - """ If/when in resolution/remission. + """ When in resolution/remission. Type `Age` (represented as `dict` in JSON). """ - self.abatementBoolean = None - """ If/when in resolution/remission. - Type `bool`. """ - self.abatementDateTime = None - """ If/when in resolution/remission. + """ When in resolution/remission. Type `FHIRDate` (represented as `str` in JSON). """ self.abatementPeriod = None - """ If/when in resolution/remission. + """ When in resolution/remission. Type `Period` (represented as `dict` in JSON). """ self.abatementRange = None - """ If/when in resolution/remission. + """ When in resolution/remission. Type `Range` (represented as `dict` in JSON). """ self.abatementString = None - """ If/when in resolution/remission. + """ When in resolution/remission. Type `str`. """ - self.assertedDate = None - """ Date record was believed accurate. - Type `FHIRDate` (represented as `str` in JSON). """ - self.asserter = None """ Person who asserts this condition. - Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.bodySite = None """ Anatomical location, if relevant. @@ -65,16 +57,16 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.clinicalStatus = None - """ active | recurrence | inactive | remission | resolved. - Type `str`. """ + """ active | recurrence | relapse | inactive | remission | resolved. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.code = None """ Identification of the condition, problem or diagnosis. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.context = None - """ Encounter or episode when condition first asserted. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.evidence = None """ Supporting evidence. @@ -108,22 +100,30 @@ def __init__(self, jsondict=None, strict=True): """ Estimated or actual date, date-time, or age. Type `str`. """ + self.recordedDate = None + """ Date record was first recorded. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.recorder = None + """ Who recorded the condition. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.severity = None """ Subjective severity of condition. Type `CodeableConcept` (represented as `dict` in JSON). """ self.stage = None """ Stage/grade, usually assessed formally. - Type `ConditionStage` (represented as `dict` in JSON). """ + List of `ConditionStage` items (represented as `dict` in JSON). """ self.subject = None """ Who has the condition?. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.verificationStatus = None - """ provisional | differential | confirmed | refuted | entered-in-error - | unknown. - Type `str`. """ + """ unconfirmed | provisional | differential | confirmed | refuted | + entered-in-error. + Type `CodeableConcept` (represented as `dict` in JSON). """ super(Condition, self).__init__(jsondict=jsondict, strict=strict) @@ -131,18 +131,16 @@ def elementProperties(self): js = super(Condition, self).elementProperties() js.extend([ ("abatementAge", "abatementAge", age.Age, False, "abatement", False), - ("abatementBoolean", "abatementBoolean", bool, False, "abatement", False), ("abatementDateTime", "abatementDateTime", fhirdate.FHIRDate, False, "abatement", False), ("abatementPeriod", "abatementPeriod", period.Period, False, "abatement", False), ("abatementRange", "abatementRange", range.Range, False, "abatement", False), ("abatementString", "abatementString", str, False, "abatement", False), - ("assertedDate", "assertedDate", fhirdate.FHIRDate, False, None, False), ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("clinicalStatus", "clinicalStatus", str, False, None, False), + ("clinicalStatus", "clinicalStatus", codeableconcept.CodeableConcept, False, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("evidence", "evidence", ConditionEvidence, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("note", "note", annotation.Annotation, True, None, False), @@ -151,10 +149,12 @@ def elementProperties(self): ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), ("onsetRange", "onsetRange", range.Range, False, "onset", False), ("onsetString", "onsetString", str, False, "onset", False), + ("recordedDate", "recordedDate", fhirdate.FHIRDate, False, None, False), + ("recorder", "recorder", fhirreference.FHIRReference, False, None, False), ("severity", "severity", codeableconcept.CodeableConcept, False, None, False), - ("stage", "stage", ConditionStage, False, None, False), + ("stage", "stage", ConditionStage, True, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("verificationStatus", "verificationStatus", str, False, None, False), + ("verificationStatus", "verificationStatus", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -164,8 +164,9 @@ def elementProperties(self): class ConditionEvidence(backboneelement.BackboneElement): """ Supporting evidence. - Supporting Evidence / manifestations that are the basis on which this - condition is suspected or confirmed. + Supporting evidence / manifestations that are the basis of the Condition's + verification status, such as evidence that confirmed or refuted the + condition. """ resource_type = "ConditionEvidence" @@ -184,7 +185,7 @@ def __init__(self, jsondict=None, strict=True): self.detail = None """ Supporting information found elsewhere. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(ConditionEvidence, self).__init__(jsondict=jsondict, strict=strict) @@ -216,12 +217,16 @@ def __init__(self, jsondict=None, strict=True): self.assessment = None """ Formal record of assessment. - List of `FHIRReference` items referencing `ClinicalImpression, DiagnosticReport, Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.summary = None """ Simple summary (disease specific). Type `CodeableConcept` (represented as `dict` in JSON). """ + self.type = None + """ Kind of staging. + Type `CodeableConcept` (represented as `dict` in JSON). """ + super(ConditionStage, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -229,6 +234,7 @@ def elementProperties(self): js.extend([ ("assessment", "assessment", fhirreference.FHIRReference, True, None, False), ("summary", "summary", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js diff --git a/fhirclient/models/condition_tests.py b/fhirclient/models/condition_tests.py index c7d1d4b44..bf95c622f 100644 --- a/fhirclient/models/condition_tests.py +++ b/fhirclient/models/condition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return condition.Condition(js) def testCondition1(self): - inst = self.instantiate_from("condition-example-f001-heart.json") + inst = self.instantiate_from("condition-example-f003-abscess.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition1(inst) @@ -32,33 +32,37 @@ def testCondition1(self): self.implCondition1(inst2) def implCondition1(self, inst): - self.assertEqual(inst.assertedDate.date, FHIRDate("2011-10-05").date) - self.assertEqual(inst.assertedDate.as_json(), "2011-10-05") - self.assertEqual(inst.bodySite[0].coding[0].code, "40768004") - self.assertEqual(inst.bodySite[0].coding[0].display, "Left thorax") + self.assertEqual(inst.bodySite[0].coding[0].code, "280193007") + self.assertEqual(inst.bodySite[0].coding[0].display, "Entire retropharyngeal area") self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.bodySite[0].text, "heart structure") self.assertEqual(inst.category[0].coding[0].code, "439401001") self.assertEqual(inst.category[0].coding[0].display, "diagnosis") self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.clinicalStatus, "active") - self.assertEqual(inst.code.coding[0].code, "368009") - self.assertEqual(inst.code.coding[0].display, "Heart valve disorder") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "18099001") + self.assertEqual(inst.code.coding[0].display, "Retropharyngeal abscess") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.evidence[0].code[0].coding[0].code, "426396005") - self.assertEqual(inst.evidence[0].code[0].coding[0].display, "Cardiac chest pain") + self.assertEqual(inst.evidence[0].code[0].coding[0].code, "169068008") + self.assertEqual(inst.evidence[0].code[0].coding[0].display, "CT of neck") self.assertEqual(inst.evidence[0].code[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f001") - self.assertEqual(inst.onsetDateTime.date, FHIRDate("2011-08-05").date) - self.assertEqual(inst.onsetDateTime.as_json(), "2011-08-05") - self.assertEqual(inst.severity.coding[0].code, "6736007") - self.assertEqual(inst.severity.coding[0].display, "Moderate") + self.assertEqual(inst.id, "f003") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2012-02-27").date) + self.assertEqual(inst.onsetDateTime.as_json(), "2012-02-27") + self.assertEqual(inst.recordedDate.date, FHIRDate("2012-02-20").date) + self.assertEqual(inst.recordedDate.as_json(), "2012-02-20") + self.assertEqual(inst.severity.coding[0].code, "371923003") + self.assertEqual(inst.severity.coding[0].display, "Mild to moderate") self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition2(self): - inst = self.instantiate_from("condition-example-f002-lung.json") + inst = self.instantiate_from("condition-example-f203-sepsis.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition2(inst) @@ -68,35 +72,36 @@ def testCondition2(self): self.implCondition2(inst2) def implCondition2(self, inst): - self.assertEqual(inst.assertedDate.date, FHIRDate("2012-06-03").date) - self.assertEqual(inst.assertedDate.as_json(), "2012-06-03") - self.assertEqual(inst.bodySite[0].coding[0].code, "51185008") - self.assertEqual(inst.bodySite[0].coding[0].display, "Thorax") + self.assertEqual(inst.bodySite[0].coding[0].code, "281158006") + self.assertEqual(inst.bodySite[0].coding[0].display, "Pulmonary vascular structure") self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[0].code, "439401001") - self.assertEqual(inst.category[0].coding[0].display, "diagnosis") + self.assertEqual(inst.category[0].coding[0].code, "55607006") + self.assertEqual(inst.category[0].coding[0].display, "Problem") self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.clinicalStatus, "active") - self.assertEqual(inst.code.coding[0].code, "254637007") - self.assertEqual(inst.code.coding[0].display, "NSCLC - Non-small cell lung cancer") + self.assertEqual(inst.category[0].coding[1].code, "problem-list-item") + self.assertEqual(inst.category[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/condition-category") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "10001005") + self.assertEqual(inst.code.coding[0].display, "Bacterial sepsis") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.evidence[0].code[0].coding[0].code, "169069000") - self.assertEqual(inst.evidence[0].code[0].coding[0].display, "CT of thorax") - self.assertEqual(inst.evidence[0].code[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f002") - self.assertEqual(inst.onsetDateTime.date, FHIRDate("2011-05-05").date) - self.assertEqual(inst.onsetDateTime.as_json(), "2011-05-05") - self.assertEqual(inst.severity.coding[0].code, "24484000") - self.assertEqual(inst.severity.coding[0].display, "Severe") + self.assertEqual(inst.id, "f203") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2013-03-08").date) + self.assertEqual(inst.onsetDateTime.as_json(), "2013-03-08") + self.assertEqual(inst.recordedDate.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.recordedDate.as_json(), "2013-03-11") + self.assertEqual(inst.severity.coding[0].code, "371924009") + self.assertEqual(inst.severity.coding[0].display, "Moderate to severe") self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.stage.summary.coding[0].code, "258219007") - self.assertEqual(inst.stage.summary.coding[0].display, "stage II") - self.assertEqual(inst.stage.summary.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition3(self): - inst = self.instantiate_from("condition-example-f003-abscess.json") + inst = self.instantiate_from("condition-example-stroke.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition3(inst) @@ -106,32 +111,28 @@ def testCondition3(self): self.implCondition3(inst2) def implCondition3(self, inst): - self.assertEqual(inst.assertedDate.date, FHIRDate("2012-02-20").date) - self.assertEqual(inst.assertedDate.as_json(), "2012-02-20") - self.assertEqual(inst.bodySite[0].coding[0].code, "280193007") - self.assertEqual(inst.bodySite[0].coding[0].display, "Entire retropharyngeal area") - self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[0].code, "439401001") - self.assertEqual(inst.category[0].coding[0].display, "diagnosis") - self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.clinicalStatus, "active") - self.assertEqual(inst.code.coding[0].code, "18099001") - self.assertEqual(inst.code.coding[0].display, "Retropharyngeal abscess") + self.assertEqual(inst.category[0].coding[0].code, "encounter-diagnosis") + self.assertEqual(inst.category[0].coding[0].display, "Encounter Diagnosis") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-category") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "422504002") + self.assertEqual(inst.code.coding[0].display, "Ischemic stroke (disorder)") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.evidence[0].code[0].coding[0].code, "169068008") - self.assertEqual(inst.evidence[0].code[0].coding[0].display, "CT of neck") - self.assertEqual(inst.evidence[0].code[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f003") - self.assertEqual(inst.onsetDateTime.date, FHIRDate("2012-02-27").date) - self.assertEqual(inst.onsetDateTime.as_json(), "2012-02-27") - self.assertEqual(inst.severity.coding[0].code, "371923003") - self.assertEqual(inst.severity.coding[0].display, "Mild to moderate") - self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Stroke") + self.assertEqual(inst.id, "stroke") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2010-07-18").date) + self.assertEqual(inst.onsetDateTime.as_json(), "2010-07-18") + self.assertEqual(inst.text.div, "
Ischemic stroke, July 18, 2010
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition4(self): - inst = self.instantiate_from("condition-example-f201-fever.json") + inst = self.instantiate_from("condition-example-family-history.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition4(inst) @@ -141,36 +142,23 @@ def testCondition4(self): self.implCondition4(inst2) def implCondition4(self, inst): - self.assertEqual(inst.abatementString, "around April 9, 2013") - self.assertEqual(inst.assertedDate.date, FHIRDate("2013-04-04").date) - self.assertEqual(inst.assertedDate.as_json(), "2013-04-04") - self.assertEqual(inst.bodySite[0].coding[0].code, "38266002") - self.assertEqual(inst.bodySite[0].coding[0].display, "Entire body as a whole") - self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[0].code, "55607006") - self.assertEqual(inst.category[0].coding[0].display, "Problem") - self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[1].code, "problem-list-item") - self.assertEqual(inst.category[0].coding[1].system, "http://hl7.org/fhir/condition-category") - self.assertEqual(inst.clinicalStatus, "resolved") - self.assertEqual(inst.code.coding[0].code, "386661006") - self.assertEqual(inst.code.coding[0].display, "Fever") + self.assertEqual(inst.category[0].coding[0].code, "problem-list-item") + self.assertEqual(inst.category[0].coding[0].display, "Problem List Item") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-category") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "312824007") + self.assertEqual(inst.code.coding[0].display, "Family history of cancer of colon") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.evidence[0].code[0].coding[0].code, "258710007") - self.assertEqual(inst.evidence[0].code[0].coding[0].display, "degrees C") - self.assertEqual(inst.evidence[0].code[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f201") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertEqual(inst.onsetDateTime.date, FHIRDate("2013-04-02").date) - self.assertEqual(inst.onsetDateTime.as_json(), "2013-04-02") - self.assertEqual(inst.severity.coding[0].code, "255604002") - self.assertEqual(inst.severity.coding[0].display, "Mild") - self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "family-history") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "
Family history of cancer of colon
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "confirmed") def testCondition5(self): - inst = self.instantiate_from("condition-example-f202-malignancy.json") + inst = self.instantiate_from("condition-example-f002-lung.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition5(inst) @@ -180,37 +168,43 @@ def testCondition5(self): self.implCondition5(inst2) def implCondition5(self, inst): - self.assertEqual(inst.abatementAge.code, "a") - self.assertEqual(inst.abatementAge.system, "http://unitsofmeasure.org") - self.assertEqual(inst.abatementAge.unit, "years") - self.assertEqual(inst.abatementAge.value, 54) - self.assertEqual(inst.assertedDate.date, FHIRDate("2012-12-01").date) - self.assertEqual(inst.assertedDate.as_json(), "2012-12-01") - self.assertEqual(inst.bodySite[0].coding[0].code, "361355005") - self.assertEqual(inst.bodySite[0].coding[0].display, "Entire head and neck") + self.assertEqual(inst.bodySite[0].coding[0].code, "51185008") + self.assertEqual(inst.bodySite[0].coding[0].display, "Thorax") self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[0].code, "encounter-diagnosis") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/condition-category") - self.assertEqual(inst.clinicalStatus, "resolved") - self.assertEqual(inst.code.coding[0].code, "363346000") - self.assertEqual(inst.code.coding[0].display, "Malignant neoplastic disease") + self.assertEqual(inst.category[0].coding[0].code, "439401001") + self.assertEqual(inst.category[0].coding[0].display, "diagnosis") + self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "254637007") + self.assertEqual(inst.code.coding[0].display, "NSCLC - Non-small cell lung cancer") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f202") - self.assertEqual(inst.meta.security[0].code, "TBOO") - self.assertEqual(inst.meta.security[0].display, "taboo") - self.assertEqual(inst.meta.security[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.onsetAge.code, "a") - self.assertEqual(inst.onsetAge.system, "http://unitsofmeasure.org") - self.assertEqual(inst.onsetAge.unit, "years") - self.assertEqual(inst.onsetAge.value, 52) + self.assertEqual(inst.evidence[0].code[0].coding[0].code, "169069000") + self.assertEqual(inst.evidence[0].code[0].coding[0].display, "CT of thorax") + self.assertEqual(inst.evidence[0].code[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f002") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2011-05-05").date) + self.assertEqual(inst.onsetDateTime.as_json(), "2011-05-05") + self.assertEqual(inst.recordedDate.date, FHIRDate("2012-06-03").date) + self.assertEqual(inst.recordedDate.as_json(), "2012-06-03") self.assertEqual(inst.severity.coding[0].code, "24484000") self.assertEqual(inst.severity.coding[0].display, "Severe") self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.stage[0].summary.coding[0].code, "258219007") + self.assertEqual(inst.stage[0].summary.coding[0].display, "stage II") + self.assertEqual(inst.stage[0].summary.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.stage[0].type.coding[0].code, "260998006") + self.assertEqual(inst.stage[0].type.coding[0].display, "Clinical staging (qualifier value)") + self.assertEqual(inst.stage[0].type.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition6(self): - inst = self.instantiate_from("condition-example-f203-sepsis.json") + inst = self.instantiate_from("condition-example-f205-infection.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition6(inst) @@ -220,28 +214,20 @@ def testCondition6(self): self.implCondition6(inst2) def implCondition6(self, inst): - self.assertEqual(inst.assertedDate.date, FHIRDate("2013-03-11").date) - self.assertEqual(inst.assertedDate.as_json(), "2013-03-11") - self.assertEqual(inst.bodySite[0].coding[0].code, "281158006") - self.assertEqual(inst.bodySite[0].coding[0].display, "Pulmonary vascular structure") - self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[0].code, "55607006") - self.assertEqual(inst.category[0].coding[0].display, "Problem") - self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[1].code, "problem-list-item") - self.assertEqual(inst.category[0].coding[1].system, "http://hl7.org/fhir/condition-category") - self.assertEqual(inst.clinicalStatus, "active") - self.assertEqual(inst.code.coding[0].code, "10001005") - self.assertEqual(inst.code.coding[0].display, "Bacterial sepsis") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "87628006") + self.assertEqual(inst.code.coding[0].display, "Bacterial infectious disease") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f203") - self.assertEqual(inst.onsetDateTime.date, FHIRDate("2013-03-08").date) - self.assertEqual(inst.onsetDateTime.as_json(), "2013-03-08") - self.assertEqual(inst.severity.coding[0].code, "371924009") - self.assertEqual(inst.severity.coding[0].display, "Moderate to severe") - self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f205") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.recordedDate.date, FHIRDate("2013-04-04").date) + self.assertEqual(inst.recordedDate.as_json(), "2013-04-04") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].code, "differential") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition7(self): inst = self.instantiate_from("condition-example-f204-renal.json") @@ -256,8 +242,6 @@ def testCondition7(self): def implCondition7(self, inst): self.assertEqual(inst.abatementDateTime.date, FHIRDate("2013-03-20").date) self.assertEqual(inst.abatementDateTime.as_json(), "2013-03-20") - self.assertEqual(inst.assertedDate.date, FHIRDate("2013-03-11").date) - self.assertEqual(inst.assertedDate.as_json(), "2013-03-11") self.assertEqual(inst.bodySite[0].coding[0].code, "181414000") self.assertEqual(inst.bodySite[0].coding[0].display, "Kidney") self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") @@ -265,26 +249,33 @@ def implCondition7(self, inst): self.assertEqual(inst.category[0].coding[0].display, "Problem") self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.category[0].coding[1].code, "problem-list-item") - self.assertEqual(inst.category[0].coding[1].system, "http://hl7.org/fhir/condition-category") - self.assertEqual(inst.clinicalStatus, "active") + self.assertEqual(inst.category[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/condition-category") + self.assertEqual(inst.clinicalStatus.coding[0].code, "inactive") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") self.assertEqual(inst.code.coding[0].code, "36225005") self.assertEqual(inst.code.coding[0].display, "Acute renal insufficiency specified as due to procedure") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.id, "f204") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "The patient is anuric.") self.assertEqual(inst.onsetDateTime.date, FHIRDate("2013-03-11").date) self.assertEqual(inst.onsetDateTime.as_json(), "2013-03-11") + self.assertEqual(inst.recordedDate.date, FHIRDate("2013-03-11").date) + self.assertEqual(inst.recordedDate.as_json(), "2013-03-11") self.assertEqual(inst.severity.coding[0].code, "24484000") self.assertEqual(inst.severity.coding[0].display, "Severe") self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.stage.summary.coding[0].code, "14803004") - self.assertEqual(inst.stage.summary.coding[0].display, "Temporary") - self.assertEqual(inst.stage.summary.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.stage[0].summary.coding[0].code, "14803004") + self.assertEqual(inst.stage[0].summary.coding[0].display, "Temporary") + self.assertEqual(inst.stage[0].summary.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "differential") + self.assertEqual(inst.verificationStatus.coding[0].code, "differential") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition8(self): - inst = self.instantiate_from("condition-example-f205-infection.json") + inst = self.instantiate_from("condition-example2.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition8(inst) @@ -294,18 +285,27 @@ def testCondition8(self): self.implCondition8(inst2) def implCondition8(self, inst): - self.assertEqual(inst.assertedDate.date, FHIRDate("2013-04-04").date) - self.assertEqual(inst.assertedDate.as_json(), "2013-04-04") - self.assertEqual(inst.clinicalStatus, "active") - self.assertEqual(inst.code.coding[0].code, "87628006") - self.assertEqual(inst.code.coding[0].display, "Bacterial infectious disease") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f205") + self.assertEqual(inst.category[0].coding[0].code, "problem-list-item") + self.assertEqual(inst.category[0].coding[0].display, "Problem List Item") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-category") + self.assertEqual(inst.clinicalStatus.coding[0].code, "active") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.text, "Asthma") + self.assertEqual(inst.id, "example2") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.onsetString, "approximately November 2012") + self.assertEqual(inst.severity.coding[0].code, "255604002") + self.assertEqual(inst.severity.coding[0].display, "Mild") + self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.div, "
Mild Asthma (Date: 12-Nov 2012)
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "differential") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition9(self): - inst = self.instantiate_from("condition-example-family-history.json") + inst = self.instantiate_from("condition-example-f202-malignancy.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition9(inst) @@ -315,19 +315,42 @@ def testCondition9(self): self.implCondition9(inst2) def implCondition9(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "problem-list-item") - self.assertEqual(inst.category[0].coding[0].display, "Problem List Item") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/condition-category") - self.assertEqual(inst.clinicalStatus, "active") - self.assertEqual(inst.code.coding[0].code, "312824007") - self.assertEqual(inst.code.coding[0].display, "Family history of cancer of colon") + self.assertEqual(inst.abatementAge.code, "a") + self.assertEqual(inst.abatementAge.system, "http://unitsofmeasure.org") + self.assertEqual(inst.abatementAge.unit, "years") + self.assertEqual(inst.abatementAge.value, 54) + self.assertEqual(inst.bodySite[0].coding[0].code, "361355005") + self.assertEqual(inst.bodySite[0].coding[0].display, "Entire head and neck") + self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].coding[0].code, "encounter-diagnosis") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-category") + self.assertEqual(inst.clinicalStatus.coding[0].code, "resolved") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "363346000") + self.assertEqual(inst.code.coding[0].display, "Malignant neoplastic disease") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "family-history") - self.assertEqual(inst.text.div, "
Family history of cancer of colon
") + self.assertEqual(inst.id, "f202") + self.assertEqual(inst.meta.security[0].code, "TBOO") + self.assertEqual(inst.meta.security[0].display, "taboo") + self.assertEqual(inst.meta.security[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.onsetAge.code, "a") + self.assertEqual(inst.onsetAge.system, "http://unitsofmeasure.org") + self.assertEqual(inst.onsetAge.unit, "years") + self.assertEqual(inst.onsetAge.value, 52) + self.assertEqual(inst.recordedDate.date, FHIRDate("2012-12-01").date) + self.assertEqual(inst.recordedDate.as_json(), "2012-12-01") + self.assertEqual(inst.severity.coding[0].code, "24484000") + self.assertEqual(inst.severity.coding[0].display, "Severe") + self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") def testCondition10(self): - inst = self.instantiate_from("condition-example-stroke.json") + inst = self.instantiate_from("condition-example-f201-fever.json") self.assertIsNotNone(inst, "Must have instantiated a Condition instance") self.implCondition10(inst) @@ -337,18 +360,36 @@ def testCondition10(self): self.implCondition10(inst2) def implCondition10(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "encounter-diagnosis") - self.assertEqual(inst.category[0].coding[0].display, "Encounter Diagnosis") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/condition-category") - self.assertEqual(inst.clinicalStatus, "active") - self.assertEqual(inst.code.coding[0].code, "422504002") - self.assertEqual(inst.code.coding[0].display, "Ischemic stroke (disorder)") + self.assertEqual(inst.abatementString, "around April 9, 2013") + self.assertEqual(inst.bodySite[0].coding[0].code, "38266002") + self.assertEqual(inst.bodySite[0].coding[0].display, "Entire body as a whole") + self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].coding[0].code, "55607006") + self.assertEqual(inst.category[0].coding[0].display, "Problem") + self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].coding[1].code, "problem-list-item") + self.assertEqual(inst.category[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/condition-category") + self.assertEqual(inst.clinicalStatus.coding[0].code, "resolved") + self.assertEqual(inst.clinicalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-clinical") + self.assertEqual(inst.code.coding[0].code, "386661006") + self.assertEqual(inst.code.coding[0].display, "Fever") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Stroke") - self.assertEqual(inst.id, "stroke") - self.assertEqual(inst.onsetDateTime.date, FHIRDate("2010-07-18").date) - self.assertEqual(inst.onsetDateTime.as_json(), "2010-07-18") - self.assertEqual(inst.text.div, "
Ischemic stroke, July 18, 2010
") + self.assertEqual(inst.evidence[0].code[0].coding[0].code, "258710007") + self.assertEqual(inst.evidence[0].code[0].coding[0].display, "degrees C") + self.assertEqual(inst.evidence[0].code[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.onsetDateTime.date, FHIRDate("2013-04-02").date) + self.assertEqual(inst.onsetDateTime.as_json(), "2013-04-02") + self.assertEqual(inst.recordedDate.date, FHIRDate("2013-04-04").date) + self.assertEqual(inst.recordedDate.as_json(), "2013-04-04") + self.assertEqual(inst.severity.coding[0].code, "255604002") + self.assertEqual(inst.severity.coding[0].display, "Mild") + self.assertEqual(inst.severity.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.verificationStatus, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].code, "confirmed") + self.assertEqual(inst.verificationStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/condition-ver-status") diff --git a/fhirclient/models/consent.py b/fhirclient/models/consent.py index 23190440e..215ae6b28 100644 --- a/fhirclient/models/consent.py +++ b/fhirclient/models/consent.py @@ -1,17 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Consent) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Consent) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class Consent(domainresource.DomainResource): - """ A healthcare consumer's policy choices to permits or denies recipients or - roles to perform actions for specific purposes and periods of time. + """ A healthcare consumer's choices to permit or deny recipients or roles to + perform actions for specific purposes and periods of time. - A record of a healthcare consumer’s policy choices, which permits or denies + A record of a healthcare consumer’s choices, which permits or denies identified recipient(s) or recipient role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time. """ @@ -26,161 +26,96 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.action = None - """ Actions controlled by this consent. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.actor = None - """ Who|what controlled by this consent (or group, by role). - List of `ConsentActor` items (represented as `dict` in JSON). """ - self.category = None """ Classification of the consent statement - for indexing/retrieval. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.consentingParty = None - """ Who is agreeing to the policy and exceptions. - List of `FHIRReference` items referencing `Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ - - self.data = None - """ Data controlled by this consent. - List of `ConsentData` items (represented as `dict` in JSON). """ - - self.dataPeriod = None - """ Timeframe for data controlled by this consent. - Type `Period` (represented as `dict` in JSON). """ - self.dateTime = None """ When this Consent was created or indexed. Type `FHIRDate` (represented as `str` in JSON). """ - self.except_fhir = None - """ Additional rule - addition or removal of permissions. - List of `ConsentExcept` items (represented as `dict` in JSON). """ - self.identifier = None """ Identifier for this record (external references). - Type `Identifier` (represented as `dict` in JSON). """ + List of `Identifier` items (represented as `dict` in JSON). """ self.organization = None """ Custodian of the consent. - List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.patient = None """ Who the consent applies to. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.period = None - """ Period that this consent applies. - Type `Period` (represented as `dict` in JSON). """ + self.performer = None + """ Who is agreeing to the policy and rules. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.policy = None """ Policies covered by this consent. List of `ConsentPolicy` items (represented as `dict` in JSON). """ self.policyRule = None - """ Policy that this consents to. - Type `str`. """ + """ Regulation that this consents to. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.purpose = None - """ Context of activities for which the agreement is made. - List of `Coding` items (represented as `dict` in JSON). """ + self.provision = None + """ Constraints to the base Consent.policyRule. + Type `ConsentProvision` (represented as `dict` in JSON). """ - self.securityLabel = None - """ Security Labels that define affected resources. - List of `Coding` items (represented as `dict` in JSON). """ + self.scope = None + """ Which of the four areas this resource covers (extensible). + Type `CodeableConcept` (represented as `dict` in JSON). """ self.sourceAttachment = None """ Source from which this consent is taken. Type `Attachment` (represented as `dict` in JSON). """ - self.sourceIdentifier = None - """ Source from which this consent is taken. - Type `Identifier` (represented as `dict` in JSON). """ - self.sourceReference = None """ Source from which this consent is taken. - Type `FHIRReference` referencing `Consent, DocumentReference, Contract, QuestionnaireResponse` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ draft | proposed | active | rejected | inactive | entered-in-error. Type `str`. """ + self.verification = None + """ Consent Verified by patient or family. + List of `ConsentVerification` items (represented as `dict` in JSON). """ + super(Consent, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Consent, self).elementProperties() js.extend([ - ("action", "action", codeableconcept.CodeableConcept, True, None, False), - ("actor", "actor", ConsentActor, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("consentingParty", "consentingParty", fhirreference.FHIRReference, True, None, False), - ("data", "data", ConsentData, True, None, False), - ("dataPeriod", "dataPeriod", period.Period, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, True), ("dateTime", "dateTime", fhirdate.FHIRDate, False, None, False), - ("except_fhir", "except", ConsentExcept, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("organization", "organization", fhirreference.FHIRReference, True, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, True), - ("period", "period", period.Period, False, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("performer", "performer", fhirreference.FHIRReference, True, None, False), ("policy", "policy", ConsentPolicy, True, None, False), - ("policyRule", "policyRule", str, False, None, False), - ("purpose", "purpose", coding.Coding, True, None, False), - ("securityLabel", "securityLabel", coding.Coding, True, None, False), + ("policyRule", "policyRule", codeableconcept.CodeableConcept, False, None, False), + ("provision", "provision", ConsentProvision, False, None, False), + ("scope", "scope", codeableconcept.CodeableConcept, False, None, True), ("sourceAttachment", "sourceAttachment", attachment.Attachment, False, "source", False), - ("sourceIdentifier", "sourceIdentifier", identifier.Identifier, False, "source", False), ("sourceReference", "sourceReference", fhirreference.FHIRReference, False, "source", False), ("status", "status", str, False, None, True), + ("verification", "verification", ConsentVerification, True, None, False), ]) return js from . import backboneelement -class ConsentActor(backboneelement.BackboneElement): - """ Who|what controlled by this consent (or group, by role). - - Who or what is controlled by this consent. Use group to identify a set of - actors by some property they share (e.g. 'admitting officers'). - """ - - resource_type = "ConsentActor" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.reference = None - """ Resource for the actor (or group, by role). - Type `FHIRReference` referencing `Device, Group, CareTeam, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ - - self.role = None - """ How the actor is involved. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ConsentActor, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ConsentActor, self).elementProperties() - js.extend([ - ("reference", "reference", fhirreference.FHIRReference, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, False, None, True), - ]) - return js - - -class ConsentData(backboneelement.BackboneElement): - """ Data controlled by this consent. +class ConsentPolicy(backboneelement.BackboneElement): + """ Policies covered by this consent. - The resources controlled by this consent, if specific resources are - referenced. + The references to the policies that are included in this consent scope. + Policies may be organizational, but are often defined jurisdictionally, or + in law. """ - resource_type = "ConsentData" + resource_type = "ConsentPolicy" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -190,33 +125,33 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.meaning = None - """ instance | related | dependents | authoredby. + self.authority = None + """ Enforcement source for policy. Type `str`. """ - self.reference = None - """ The actual data reference. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + self.uri = None + """ Specific policy covered by this consent. + Type `str`. """ - super(ConsentData, self).__init__(jsondict=jsondict, strict=strict) + super(ConsentPolicy, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ConsentData, self).elementProperties() + js = super(ConsentPolicy, self).elementProperties() js.extend([ - ("meaning", "meaning", str, False, None, True), - ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ("authority", "authority", str, False, None, False), + ("uri", "uri", str, False, None, False), ]) return js -class ConsentExcept(backboneelement.BackboneElement): - """ Additional rule - addition or removal of permissions. +class ConsentProvision(backboneelement.BackboneElement): + """ Constraints to the base Consent.policyRule. An exception to the base policy of this consent. An exception can be an addition or removal of access permissions. """ - resource_type = "ConsentExcept" + resource_type = "ConsentProvision" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -227,35 +162,39 @@ def __init__(self, jsondict=None, strict=True): """ self.action = None - """ Actions controlled by this exception. + """ Actions controlled by this rule. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.actor = None - """ Who|what controlled by this exception (or group, by role). - List of `ConsentExceptActor` items (represented as `dict` in JSON). """ + """ Who|what controlled by this rule (or group, by role). + List of `ConsentProvisionActor` items (represented as `dict` in JSON). """ self.class_fhir = None - """ e.g. Resource Type, Profile, or CDA etc. + """ e.g. Resource Type, Profile, CDA, etc.. List of `Coding` items (represented as `dict` in JSON). """ self.code = None - """ e.g. LOINC or SNOMED CT code, etc in the content. - List of `Coding` items (represented as `dict` in JSON). """ + """ e.g. LOINC or SNOMED CT code, etc. in the content. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.data = None - """ Data controlled by this exception. - List of `ConsentExceptData` items (represented as `dict` in JSON). """ + """ Data controlled by this rule. + List of `ConsentProvisionData` items (represented as `dict` in JSON). """ self.dataPeriod = None - """ Timeframe for data controlled by this exception. + """ Timeframe for data controlled by this rule. Type `Period` (represented as `dict` in JSON). """ self.period = None - """ Timeframe for this exception. + """ Timeframe for this rule. Type `Period` (represented as `dict` in JSON). """ + self.provision = None + """ Nested Exception Rules. + List of `ConsentProvision` items (represented as `dict` in JSON). """ + self.purpose = None - """ Context of activities covered by this exception. + """ Context of activities covered by this rule. List of `Coding` items (represented as `dict` in JSON). """ self.securityLabel = None @@ -266,33 +205,34 @@ def __init__(self, jsondict=None, strict=True): """ deny | permit. Type `str`. """ - super(ConsentExcept, self).__init__(jsondict=jsondict, strict=strict) + super(ConsentProvision, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ConsentExcept, self).elementProperties() + js = super(ConsentProvision, self).elementProperties() js.extend([ ("action", "action", codeableconcept.CodeableConcept, True, None, False), - ("actor", "actor", ConsentExceptActor, True, None, False), + ("actor", "actor", ConsentProvisionActor, True, None, False), ("class_fhir", "class", coding.Coding, True, None, False), - ("code", "code", coding.Coding, True, None, False), - ("data", "data", ConsentExceptData, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("data", "data", ConsentProvisionData, True, None, False), ("dataPeriod", "dataPeriod", period.Period, False, None, False), ("period", "period", period.Period, False, None, False), + ("provision", "provision", ConsentProvision, True, None, False), ("purpose", "purpose", coding.Coding, True, None, False), ("securityLabel", "securityLabel", coding.Coding, True, None, False), - ("type", "type", str, False, None, True), + ("type", "type", str, False, None, False), ]) return js -class ConsentExceptActor(backboneelement.BackboneElement): - """ Who|what controlled by this exception (or group, by role). +class ConsentProvisionActor(backboneelement.BackboneElement): + """ Who|what controlled by this rule (or group, by role). - Who or what is controlled by this Exception. Use group to identify a set of + Who or what is controlled by this rule. Use group to identify a set of actors by some property they share (e.g. 'admitting officers'). """ - resource_type = "ConsentExceptActor" + resource_type = "ConsentProvisionActor" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -304,16 +244,16 @@ def __init__(self, jsondict=None, strict=True): self.reference = None """ Resource for the actor (or group, by role). - Type `FHIRReference` referencing `Device, Group, CareTeam, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.role = None """ How the actor is involved. Type `CodeableConcept` (represented as `dict` in JSON). """ - super(ConsentExceptActor, self).__init__(jsondict=jsondict, strict=strict) + super(ConsentProvisionActor, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ConsentExceptActor, self).elementProperties() + js = super(ConsentProvisionActor, self).elementProperties() js.extend([ ("reference", "reference", fhirreference.FHIRReference, False, None, True), ("role", "role", codeableconcept.CodeableConcept, False, None, True), @@ -321,14 +261,13 @@ def elementProperties(self): return js -class ConsentExceptData(backboneelement.BackboneElement): - """ Data controlled by this exception. +class ConsentProvisionData(backboneelement.BackboneElement): + """ Data controlled by this rule. - The resources controlled by this exception, if specific resources are - referenced. + The resources controlled by this rule if specific resources are referenced. """ - resource_type = "ConsentExceptData" + resource_type = "ConsentProvisionData" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -344,12 +283,12 @@ def __init__(self, jsondict=None, strict=True): self.reference = None """ The actual data reference. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - super(ConsentExceptData, self).__init__(jsondict=jsondict, strict=strict) + super(ConsentProvisionData, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ConsentExceptData, self).elementProperties() + js = super(ConsentProvisionData, self).elementProperties() js.extend([ ("meaning", "meaning", str, False, None, True), ("reference", "reference", fhirreference.FHIRReference, False, None, True), @@ -357,15 +296,14 @@ def elementProperties(self): return js -class ConsentPolicy(backboneelement.BackboneElement): - """ Policies covered by this consent. +class ConsentVerification(backboneelement.BackboneElement): + """ Consent Verified by patient or family. - The references to the policies that are included in this consent scope. - Policies may be organizational, but are often defined jurisdictionally, or - in law. + Whether a treatment instruction (e.g. artificial respiration yes or no) was + verified with the patient, his/her family or another authorized person. """ - resource_type = "ConsentPolicy" + resource_type = "ConsentVerification" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -375,21 +313,26 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.authority = None - """ Enforcement source for policy. - Type `str`. """ + self.verificationDate = None + """ When consent verified. + Type `FHIRDate` (represented as `str` in JSON). """ - self.uri = None - """ Specific policy covered by this consent. - Type `str`. """ + self.verified = None + """ Has been verified. + Type `bool`. """ - super(ConsentPolicy, self).__init__(jsondict=jsondict, strict=strict) + self.verifiedWith = None + """ Person who verified. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ConsentVerification, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ConsentPolicy, self).elementProperties() + js = super(ConsentVerification, self).elementProperties() js.extend([ - ("authority", "authority", str, False, None, False), - ("uri", "uri", str, False, None, False), + ("verificationDate", "verificationDate", fhirdate.FHIRDate, False, None, False), + ("verified", "verified", bool, False, None, True), + ("verifiedWith", "verifiedWith", fhirreference.FHIRReference, False, None, False), ]) return js diff --git a/fhirclient/models/consent_tests.py b/fhirclient/models/consent_tests.py index fef38174f..d8157f5b4 100644 --- a/fhirclient/models/consent_tests.py +++ b/fhirclient/models/consent_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return consent.Consent(js) def testConsent1(self): - inst = self.instantiate_from("consent-example-Emergency.json") + inst = self.instantiate_from("consent-example-notThis.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent1(inst) @@ -32,24 +32,25 @@ def testConsent1(self): self.implConsent1(inst2) def implConsent1(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].code, "CST") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].purpose[0].code, "ETREAT") - self.assertEqual(inst.except_fhir[0].purpose[0].system, "http://hl7.org/fhir/v3/ActReason") - self.assertEqual(inst.except_fhir[0].type, "permit") - self.assertEqual(inst.except_fhir[1].actor[0].role.coding[0].code, "CST") - self.assertEqual(inst.except_fhir[1].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[1].type, "deny") - self.assertEqual(inst.id, "consent-example-Emergency") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-out") + self.assertEqual(inst.id, "consent-example-notThis") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.data[0].meaning, "related") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testConsent2(self): - inst = self.instantiate_from("consent-example-grantor.json") + inst = self.instantiate_from("consent-example-smartonfhir.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent2(inst) @@ -59,18 +60,27 @@ def testConsent2(self): self.implConsent2(inst2) def implConsent2(self, inst): - self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) - self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].code, "CST") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].actor[1].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[0].actor[1].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].type, "permit") - self.assertEqual(inst.id, "consent-example-grantor") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-out") - self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") + self.assertEqual(inst.dateTime.date, FHIRDate("2016-06-23T17:02:33+10:00").date) + self.assertEqual(inst.dateTime.as_json(), "2016-06-23T17:02:33+10:00") + self.assertEqual(inst.id, "consent-example-smartonfhir") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.period.end.date, FHIRDate("2016-06-23T17:32:33+10:00").date) + self.assertEqual(inst.provision.period.end.as_json(), "2016-06-23T17:32:33+10:00") + self.assertEqual(inst.provision.period.start.date, FHIRDate("2016-06-23T17:02:33+10:00").date) + self.assertEqual(inst.provision.period.start.as_json(), "2016-06-23T17:02:33+10:00") + self.assertEqual(inst.provision.provision[0].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[0].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[0].class_fhir[0].code, "MedicationRequest") + self.assertEqual(inst.provision.provision[0].class_fhir[0].system, "http://hl7.org/fhir/resource-types") + self.assertEqual(inst.provision.provision[0].type, "permit") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") @@ -85,19 +95,26 @@ def testConsent3(self): self.implConsent3(inst2) def implConsent3(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].code, "CST") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].type, "deny") self.assertEqual(inst.id, "consent-example-notAuthor") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-in") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.actor[0].role.coding[0].code, "CST") + self.assertEqual(inst.provision.actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testConsent4(self): - inst = self.instantiate_from("consent-example-notOrg.json") + inst = self.instantiate_from("consent-example-notTime.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent4(inst) @@ -107,23 +124,28 @@ def testConsent4(self): self.implConsent4(inst2) def implConsent4(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[0].action[1].coding[0].code, "correct") - self.assertEqual(inst.except_fhir[0].action[1].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].type, "deny") - self.assertEqual(inst.id, "consent-example-notOrg") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-in") + self.assertEqual(inst.id, "consent-example-notTime") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.period.end.date, FHIRDate("2015-02-01").date) + self.assertEqual(inst.provision.period.end.as_json(), "2015-02-01") + self.assertEqual(inst.provision.period.start.date, FHIRDate("2015-01-01").date) + self.assertEqual(inst.provision.period.start.as_json(), "2015-01-01") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testConsent5(self): - inst = self.instantiate_from("consent-example-notThem.json") + inst = self.instantiate_from("consent-example-signature.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent5(inst) @@ -133,23 +155,40 @@ def testConsent5(self): self.implConsent5(inst2) def implConsent5(self, inst): - self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) - self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[0].action[1].coding[0].code, "correct") - self.assertEqual(inst.except_fhir[0].action[1].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].type, "deny") - self.assertEqual(inst.id, "consent-example-notThem") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-in") - self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") + self.assertEqual(inst.category[0].coding[0].code, "npp") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentcategorycodes") + self.assertEqual(inst.dateTime.date, FHIRDate("2016-05-26T00:41:10-04:00").date) + self.assertEqual(inst.dateTime.as_json(), "2016-05-26T00:41:10-04:00") + self.assertEqual(inst.id, "consent-example-signature") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.3.72.5.9.1") + self.assertEqual(inst.identifier[0].value, "494e0c7a-a69e-4fb4-9d02-6aae747790d7") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.period.end.date, FHIRDate("2016-10-10").date) + self.assertEqual(inst.provision.period.end.as_json(), "2016-10-10") + self.assertEqual(inst.provision.period.start.date, FHIRDate("2015-10-10").date) + self.assertEqual(inst.provision.period.start.as_json(), "2015-10-10") + self.assertEqual(inst.provision.provision[0].actor[0].role.coding[0].code, "AUT") + self.assertEqual(inst.provision.provision[0].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[0].class_fhir[0].code, "application/hl7-cda+xml") + self.assertEqual(inst.provision.provision[0].class_fhir[0].system, "urn:ietf:bcp:13") + self.assertEqual(inst.provision.provision[0].code[0].coding[0].code, "34133-9") + self.assertEqual(inst.provision.provision[0].code[0].coding[0].system, "http://loinc.org") + self.assertEqual(inst.provision.provision[0].code[1].coding[0].code, "18842-5") + self.assertEqual(inst.provision.provision[0].code[1].coding[0].system, "http://loinc.org") + self.assertEqual(inst.provision.provision[0].type, "permit") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testConsent6(self): - inst = self.instantiate_from("consent-example-notThis.json") + inst = self.instantiate_from("consent-example-notThem.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent6(inst) @@ -159,18 +198,30 @@ def testConsent6(self): self.implConsent6(inst2) def implConsent6(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.except_fhir[0].data[0].meaning, "related") - self.assertEqual(inst.except_fhir[0].type, "deny") - self.assertEqual(inst.id, "consent-example-notThis") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-in") + self.assertEqual(inst.id, "consent-example-notThem") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.action[0].coding[0].code, "access") + self.assertEqual(inst.provision.action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.action[1].coding[0].code, "correct") + self.assertEqual(inst.provision.action[1].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testConsent7(self): - inst = self.instantiate_from("consent-example-notTime.json") + inst = self.instantiate_from("consent-example-grantor.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent7(inst) @@ -180,21 +231,30 @@ def testConsent7(self): self.implConsent7(inst2) def implConsent7(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "INFAO") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.except_fhir[0].period.end.date, FHIRDate("2015-02-01").date) - self.assertEqual(inst.except_fhir[0].period.end.as_json(), "2015-02-01") - self.assertEqual(inst.except_fhir[0].period.start.date, FHIRDate("2015-01-01").date) - self.assertEqual(inst.except_fhir[0].period.start.as_json(), "2015-01-01") - self.assertEqual(inst.except_fhir[0].type, "deny") - self.assertEqual(inst.id, "consent-example-notTime") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-in") + self.assertEqual(inst.id, "consent-example-grantor") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTOUT") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.action[0].coding[0].code, "access") + self.assertEqual(inst.provision.action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.actor[0].role.coding[0].code, "CST") + self.assertEqual(inst.provision.actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.actor[1].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.actor[1].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testConsent8(self): - inst = self.instantiate_from("consent-example-Out.json") + inst = self.instantiate_from("consent-example-notOrg.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent8(inst) @@ -204,12 +264,25 @@ def testConsent8(self): self.implConsent8(inst2) def implConsent8(self, inst): - self.assertEqual(inst.actor[0].role.coding[0].code, "CST") - self.assertEqual(inst.actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.dateTime.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.dateTime.as_json(), "2015-11-18") - self.assertEqual(inst.id, "consent-example-Out") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-out") + self.assertEqual(inst.id, "consent-example-notOrg") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.action[0].coding[0].code, "access") + self.assertEqual(inst.provision.action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.action[1].coding[0].code, "correct") + self.assertEqual(inst.provision.action[1].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.type, "deny") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") @@ -225,85 +298,89 @@ def testConsent9(self): self.implConsent9(inst2) def implConsent9(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.dateTime.date, FHIRDate("2016-06-16").date) self.assertEqual(inst.dateTime.as_json(), "2016-06-16") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[0].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].securityLabel[0].code, "N") - self.assertEqual(inst.except_fhir[0].securityLabel[0].system, "http://hl7.org/fhir/v3/Confidentiality") - self.assertEqual(inst.except_fhir[0].type, "permit") - self.assertEqual(inst.except_fhir[1].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[1].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[1].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[1].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[1].securityLabel[0].code, "PSY") - self.assertEqual(inst.except_fhir[1].securityLabel[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.except_fhir[1].type, "permit") - self.assertEqual(inst.except_fhir[2].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[2].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[2].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[2].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[2].securityLabel[0].code, "SOC") - self.assertEqual(inst.except_fhir[2].securityLabel[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.except_fhir[2].type, "permit") - self.assertEqual(inst.except_fhir[3].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[3].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[3].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[3].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[3].securityLabel[0].code, "N") - self.assertEqual(inst.except_fhir[3].securityLabel[0].system, "http://hl7.org/fhir/v3/Confidentiality") - self.assertEqual(inst.except_fhir[3].type, "permit") - self.assertEqual(inst.except_fhir[4].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[4].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[4].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[4].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[4].securityLabel[0].code, "PSY") - self.assertEqual(inst.except_fhir[4].securityLabel[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.except_fhir[4].type, "permit") - self.assertEqual(inst.except_fhir[5].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[5].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[5].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[5].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[5].securityLabel[0].code, "SOC") - self.assertEqual(inst.except_fhir[5].securityLabel[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.except_fhir[5].type, "permit") - self.assertEqual(inst.except_fhir[6].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[6].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[6].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[6].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[6].securityLabel[0].code, "SEX") - self.assertEqual(inst.except_fhir[6].securityLabel[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.except_fhir[6].type, "permit") - self.assertEqual(inst.except_fhir[7].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[7].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[7].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[7].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[7].securityLabel[0].code, "N") - self.assertEqual(inst.except_fhir[7].securityLabel[0].system, "http://hl7.org/fhir/v3/Confidentiality") - self.assertEqual(inst.except_fhir[7].type, "permit") - self.assertEqual(inst.except_fhir[8].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[8].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[8].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[8].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[8].securityLabel[0].code, "PSY") - self.assertEqual(inst.except_fhir[8].securityLabel[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.except_fhir[8].type, "permit") - self.assertEqual(inst.except_fhir[9].action[0].coding[0].code, "access") - self.assertEqual(inst.except_fhir[9].action[0].coding[0].system, "http://hl7.org/fhir/consentaction") - self.assertEqual(inst.except_fhir[9].actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.except_fhir[9].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[9].securityLabel[0].code, "SOC") - self.assertEqual(inst.except_fhir[9].securityLabel[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.except_fhir[9].type, "permit") self.assertEqual(inst.id, "consent-example-pkb") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-out") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTOUT") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.action[0].coding[0].code, "access") + self.assertEqual(inst.provision.action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[0].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[0].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[0].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[0].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[0].securityLabel[0].code, "PSY") + self.assertEqual(inst.provision.provision[0].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.provision[1].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[1].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[1].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[1].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[1].securityLabel[0].code, "SPI") + self.assertEqual(inst.provision.provision[1].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.provision[2].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[2].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[2].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[2].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[2].securityLabel[0].code, "N") + self.assertEqual(inst.provision.provision[2].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-Confidentiality") + self.assertEqual(inst.provision.provision[3].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[3].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[3].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[3].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[3].securityLabel[0].code, "PSY") + self.assertEqual(inst.provision.provision[3].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.provision[4].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[4].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[4].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[4].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[4].securityLabel[0].code, "SPI") + self.assertEqual(inst.provision.provision[4].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.provision[5].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[5].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[5].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[5].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[5].securityLabel[0].code, "SEX") + self.assertEqual(inst.provision.provision[5].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.provision[6].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[6].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[6].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[6].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[6].securityLabel[0].code, "N") + self.assertEqual(inst.provision.provision[6].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-Confidentiality") + self.assertEqual(inst.provision.provision[7].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[7].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[7].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[7].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[7].securityLabel[0].code, "PSY") + self.assertEqual(inst.provision.provision[7].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.provision[8].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[8].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[8].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[8].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[8].securityLabel[0].code, "SPI") + self.assertEqual(inst.provision.provision[8].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.provision[9].action[0].coding[0].code, "access") + self.assertEqual(inst.provision.provision[9].action[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentaction") + self.assertEqual(inst.provision.provision[9].actor[0].role.coding[0].code, "PRCP") + self.assertEqual(inst.provision.provision[9].actor[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.provision.provision[9].securityLabel[0].code, "SEX") + self.assertEqual(inst.provision.provision[9].securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.securityLabel[0].code, "N") + self.assertEqual(inst.provision.securityLabel[0].system, "http://terminology.hl7.org/CodeSystem/v3-Confidentiality") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testConsent10(self): - inst = self.instantiate_from("consent-example-signature.json") + inst = self.instantiate_from("consent-example.json") self.assertIsNotNone(inst, "Must have instantiated a Consent instance") self.implConsent10(inst) @@ -313,29 +390,23 @@ def testConsent10(self): self.implConsent10(inst2) def implConsent10(self, inst): - self.assertEqual(inst.actor[0].role.coding[0].code, "PRCP") - self.assertEqual(inst.actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.category[0].coding[0].code, "HIPAA-Auth") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/consentcategorycodes") - self.assertEqual(inst.dateTime.date, FHIRDate("2016-05-26T00:41:10-04:00").date) - self.assertEqual(inst.dateTime.as_json(), "2016-05-26T00:41:10-04:00") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].code, "AUT") - self.assertEqual(inst.except_fhir[0].actor[0].role.coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.except_fhir[0].class_fhir[0].code, "application/hl7-cda+xml") - self.assertEqual(inst.except_fhir[0].class_fhir[0].system, "urn:ietf:bcp:13") - self.assertEqual(inst.except_fhir[0].code[0].code, "34133-9") - self.assertEqual(inst.except_fhir[0].code[0].system, "http://loinc.org") - self.assertEqual(inst.except_fhir[0].code[1].code, "18842-5") - self.assertEqual(inst.except_fhir[0].code[1].system, "http://loinc.org") - self.assertEqual(inst.except_fhir[0].type, "permit") - self.assertEqual(inst.id, "consent-example-signature") - self.assertEqual(inst.identifier.system, "urn:oid:2.16.840.1.113883.3.72.5.9.1") - self.assertEqual(inst.identifier.value, "494e0c7a-a69e-4fb4-9d02-6aae747790d7") - self.assertEqual(inst.period.end.date, FHIRDate("2016-10-10").date) - self.assertEqual(inst.period.end.as_json(), "2016-10-10") - self.assertEqual(inst.period.start.date, FHIRDate("2015-10-10").date) - self.assertEqual(inst.period.start.as_json(), "2015-10-10") - self.assertEqual(inst.policyRule, "http://hl7.org/fhir/ConsentPolicy/opt-in") + self.assertEqual(inst.category[0].coding[0].code, "59284-0") + self.assertEqual(inst.category[0].coding[0].system, "http://loinc.org") + self.assertEqual(inst.dateTime.date, FHIRDate("2016-05-11").date) + self.assertEqual(inst.dateTime.as_json(), "2016-05-11") + self.assertEqual(inst.id, "consent-example-basic") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.policyRule.coding[0].code, "OPTIN") + self.assertEqual(inst.policyRule.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.provision.period.end.date, FHIRDate("2016-01-01").date) + self.assertEqual(inst.provision.period.end.as_json(), "2016-01-01") + self.assertEqual(inst.provision.period.start.date, FHIRDate("1964-01-01").date) + self.assertEqual(inst.provision.period.start.as_json(), "1964-01-01") + self.assertEqual(inst.scope.coding[0].code, "patient-privacy") + self.assertEqual(inst.scope.coding[0].system, "http://terminology.hl7.org/CodeSystem/consentscope") + self.assertEqual(inst.sourceAttachment.title, "The terms of the consent in lawyer speak.") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/contactdetail.py b/fhirclient/models/contactdetail.py index c8d41d094..6b631a575 100644 --- a/fhirclient/models/contactdetail.py +++ b/fhirclient/models/contactdetail.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ContactDetail) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactDetail) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/contactpoint.py b/fhirclient/models/contactpoint.py index eb3e63ee1..7e5084e67 100644 --- a/fhirclient/models/contactpoint.py +++ b/fhirclient/models/contactpoint.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/contract.py b/fhirclient/models/contract.py index 9e48c0de2..7553a5912 100644 --- a/fhirclient/models/contract.py +++ b/fhirclient/models/contract.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Contract) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Contract) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,8 +10,8 @@ class Contract(domainresource.DomainResource): """ Legal Agreement. - A formal agreement between parties regarding the conduct of business, - exchange of information or other matters. + Legally enforceable, formally recorded unilateral or bilateral directive + i.e., a policy or agreement. """ resource_type = "Contract" @@ -24,45 +24,38 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.action = None - """ Action stipulated by this Contract. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.actionReason = None - """ Rationale for the stiplulated action. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.agent = None - """ Entity being ascribed responsibility. - List of `ContractAgent` items (represented as `dict` in JSON). """ + self.alias = None + """ Acronym or short name. + List of `str` items. """ self.applies = None """ Effective time. Type `Period` (represented as `dict` in JSON). """ + self.author = None + """ Source of Contract. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.authority = None """ Authority under which this Contract has standing. - List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.bindingAttachment = None - """ Binding Contract. - Type `Attachment` (represented as `dict` in JSON). """ - - self.bindingReference = None - """ Binding Contract. - Type `FHIRReference` referencing `Composition, DocumentReference, QuestionnaireResponse` (represented as `dict` in JSON). """ + self.contentDefinition = None + """ Contract precursor content. + Type `ContractContentDefinition` (represented as `dict` in JSON). """ self.contentDerivative = None """ Content derived from the basal information. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.decisionType = None - """ Decision by Grantor. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.domain = None - """ Domain in which this Contract applies. - List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + """ A sphere of control governed by an authoritative jurisdiction, + organization, or person. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.expirationType = None + """ Contract cessation cause. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.friendly = None """ Contract Friendly Language. @@ -70,7 +63,15 @@ def __init__(self, jsondict=None, strict=True): self.identifier = None """ Contract number. - Type `Identifier` (represented as `dict` in JSON). """ + List of `Identifier` items (represented as `dict` in JSON). """ + + self.instantiatesCanonical = None + """ Source Contract Definition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.instantiatesUri = None + """ External Contract Definition. + Type `str`. """ self.issued = None """ When this Contract was issued. @@ -80,22 +81,45 @@ def __init__(self, jsondict=None, strict=True): """ Contract Legal Language. List of `ContractLegal` items (represented as `dict` in JSON). """ + self.legalState = None + """ Negotiation status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.legallyBindingAttachment = None + """ Binding Contract. + Type `Attachment` (represented as `dict` in JSON). """ + + self.legallyBindingReference = None + """ Binding Contract. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.name = None + """ Computer friendly designation. + Type `str`. """ + + self.relevantHistory = None + """ Key event in Contract History. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.rule = None """ Computable Contract Language. List of `ContractRule` items (represented as `dict` in JSON). """ - self.securityLabel = None - """ Security Labels that define affected resources. - List of `Coding` items (represented as `dict` in JSON). """ + self.scope = None + """ Range of Legal Concerns. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.signer = None """ Contract Signatory. List of `ContractSigner` items (represented as `dict` in JSON). """ + self.site = None + """ Specific Location. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.status = None - """ amended | appended | cancelled | disputed | entered-in-error | - executable | executed | negotiable | offered | policy | rejected | - renewed | revoked | resolved | terminated. + """ draft | active | suspended | cancelled | completed | entered-in- + error | unknown. Type `str`. """ self.subType = None @@ -104,67 +128,99 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Contract Target Entity. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate Friendly name. + Type `str`. """ + + self.supportingInfo = None + """ Extra Information. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.term = None """ Contract Term List. List of `ContractTerm` items (represented as `dict` in JSON). """ - self.topic = None - """ Context of the Contract. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + self.title = None + """ Human Friendly name. + Type `str`. """ + + self.topicCodeableConcept = None + """ Focus of contract interest. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.topicReference = None + """ Focus of contract interest. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None - """ Type or form. + """ Legal instrument category. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.valuedItem = None - """ Contract Valued Item List. - List of `ContractValuedItem` items (represented as `dict` in JSON). """ + self.url = None + """ Basal definition. + Type `str`. """ + + self.version = None + """ Business edition. + Type `str`. """ super(Contract, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Contract, self).elementProperties() js.extend([ - ("action", "action", codeableconcept.CodeableConcept, True, None, False), - ("actionReason", "actionReason", codeableconcept.CodeableConcept, True, None, False), - ("agent", "agent", ContractAgent, True, None, False), + ("alias", "alias", str, True, None, False), ("applies", "applies", period.Period, False, None, False), + ("author", "author", fhirreference.FHIRReference, False, None, False), ("authority", "authority", fhirreference.FHIRReference, True, None, False), - ("bindingAttachment", "bindingAttachment", attachment.Attachment, False, "binding", False), - ("bindingReference", "bindingReference", fhirreference.FHIRReference, False, "binding", False), + ("contentDefinition", "contentDefinition", ContractContentDefinition, False, None, False), ("contentDerivative", "contentDerivative", codeableconcept.CodeableConcept, False, None, False), - ("decisionType", "decisionType", codeableconcept.CodeableConcept, False, None, False), ("domain", "domain", fhirreference.FHIRReference, True, None, False), + ("expirationType", "expirationType", codeableconcept.CodeableConcept, False, None, False), ("friendly", "friendly", ContractFriendly, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", fhirreference.FHIRReference, False, None, False), + ("instantiatesUri", "instantiatesUri", str, False, None, False), ("issued", "issued", fhirdate.FHIRDate, False, None, False), ("legal", "legal", ContractLegal, True, None, False), + ("legalState", "legalState", codeableconcept.CodeableConcept, False, None, False), + ("legallyBindingAttachment", "legallyBindingAttachment", attachment.Attachment, False, "legallyBinding", False), + ("legallyBindingReference", "legallyBindingReference", fhirreference.FHIRReference, False, "legallyBinding", False), + ("name", "name", str, False, None, False), + ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, None, False), ("rule", "rule", ContractRule, True, None, False), - ("securityLabel", "securityLabel", coding.Coding, True, None, False), + ("scope", "scope", codeableconcept.CodeableConcept, False, None, False), ("signer", "signer", ContractSigner, True, None, False), + ("site", "site", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, False), ("subType", "subType", codeableconcept.CodeableConcept, True, None, False), ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ("subtitle", "subtitle", str, False, None, False), + ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), ("term", "term", ContractTerm, True, None, False), - ("topic", "topic", fhirreference.FHIRReference, True, None, False), + ("title", "title", str, False, None, False), + ("topicCodeableConcept", "topicCodeableConcept", codeableconcept.CodeableConcept, False, "topic", False), + ("topicReference", "topicReference", fhirreference.FHIRReference, False, "topic", False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("valuedItem", "valuedItem", ContractValuedItem, True, None, False), + ("url", "url", str, False, None, False), + ("version", "version", str, False, None, False), ]) return js from . import backboneelement -class ContractAgent(backboneelement.BackboneElement): - """ Entity being ascribed responsibility. +class ContractContentDefinition(backboneelement.BackboneElement): + """ Contract precursor content. - An actor taking a role in an activity for which it can be assigned some - degree of responsibility for the activity taking place. + Precusory content developed with a focus and intent of supporting the + formation a Contract instance, which may be associated with and + transformable into a Contract. """ - resource_type = "ContractAgent" + resource_type = "ContractContentDefinition" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -174,21 +230,41 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.actor = None - """ Contract Agent Type. - Type `FHIRReference` referencing `Contract, Device, Group, Location, Organization, Patient, Practitioner, RelatedPerson, Substance` (represented as `dict` in JSON). """ + self.copyright = None + """ Publication Ownership. + Type `str`. """ - self.role = None - """ Role type of the agent. - List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.publicationDate = None + """ When published. + Type `FHIRDate` (represented as `str` in JSON). """ - super(ContractAgent, self).__init__(jsondict=jsondict, strict=strict) + self.publicationStatus = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.publisher = None + """ Publisher Entity. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subType = None + """ Detailed Content Type Definition. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ Content structure and use. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ContractContentDefinition, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ContractAgent, self).elementProperties() + js = super(ContractContentDefinition, self).elementProperties() js.extend([ - ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("publicationDate", "publicationDate", fhirdate.FHIRDate, False, None, False), + ("publicationStatus", "publicationStatus", str, False, None, True), + ("publisher", "publisher", fhirreference.FHIRReference, False, None, False), + ("subType", "subType", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), ]) return js @@ -221,7 +297,7 @@ def __init__(self, jsondict=None, strict=True): self.contentReference = None """ Easily comprehended representation of this Contract. - Type `FHIRReference` referencing `Composition, DocumentReference, QuestionnaireResponse` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ContractFriendly, self).__init__(jsondict=jsondict, strict=strict) @@ -256,7 +332,7 @@ def __init__(self, jsondict=None, strict=True): self.contentReference = None """ Contract Legal Text. - Type `FHIRReference` referencing `Composition, DocumentReference, QuestionnaireResponse` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ContractLegal, self).__init__(jsondict=jsondict, strict=strict) @@ -291,7 +367,7 @@ def __init__(self, jsondict=None, strict=True): self.contentReference = None """ Computable Contract Rules. - Type `FHIRReference` referencing `DocumentReference` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ContractRule, self).__init__(jsondict=jsondict, strict=strict) @@ -325,7 +401,7 @@ def __init__(self, jsondict=None, strict=True): self.party = None """ Contract Signatory Party. - Type `FHIRReference` referencing `Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.signature = None """ Contract Documentation Signature. @@ -365,21 +441,17 @@ def __init__(self, jsondict=None, strict=True): """ self.action = None - """ Contract Term Activity. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.actionReason = None - """ Purpose for the Contract Term Action. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.agent = None - """ Contract Term Agent List. - List of `ContractTermAgent` items (represented as `dict` in JSON). """ + """ Entity being ascribed responsibility. + List of `ContractTermAction` items (represented as `dict` in JSON). """ self.applies = None """ Contract Term Effective Time. Type `Period` (represented as `dict` in JSON). """ + self.asset = None + """ Contract Term Asset List. + List of `ContractTermAsset` items (represented as `dict` in JSON). """ + self.group = None """ Nested Contract Term Group. List of `ContractTerm` items (represented as `dict` in JSON). """ @@ -392,60 +464,64 @@ def __init__(self, jsondict=None, strict=True): """ Contract Term Issue Date Time. Type `FHIRDate` (represented as `str` in JSON). """ + self.offer = None + """ Context of the Contract term. + Type `ContractTermOffer` (represented as `dict` in JSON). """ + self.securityLabel = None - """ Security Labels that define affected terms. - List of `Coding` items (represented as `dict` in JSON). """ + """ Protection for the Term. + List of `ContractTermSecurityLabel` items (represented as `dict` in JSON). """ self.subType = None """ Contract Term Type specific classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.text = None - """ Human readable Contract term text. + """ Term Statement. Type `str`. """ - self.topic = None - """ Context of the Contract term. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + self.topicCodeableConcept = None + """ Term Concern. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.topicReference = None + """ Term Concern. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ Contract Term Type or Form. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.valuedItem = None - """ Contract Term Valued Item List. - List of `ContractTermValuedItem` items (represented as `dict` in JSON). """ - super(ContractTerm, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ContractTerm, self).elementProperties() js.extend([ - ("action", "action", codeableconcept.CodeableConcept, True, None, False), - ("actionReason", "actionReason", codeableconcept.CodeableConcept, True, None, False), - ("agent", "agent", ContractTermAgent, True, None, False), + ("action", "action", ContractTermAction, True, None, False), ("applies", "applies", period.Period, False, None, False), + ("asset", "asset", ContractTermAsset, True, None, False), ("group", "group", ContractTerm, True, None, False), ("identifier", "identifier", identifier.Identifier, False, None, False), ("issued", "issued", fhirdate.FHIRDate, False, None, False), - ("securityLabel", "securityLabel", coding.Coding, True, None, False), + ("offer", "offer", ContractTermOffer, False, None, True), + ("securityLabel", "securityLabel", ContractTermSecurityLabel, True, None, False), ("subType", "subType", codeableconcept.CodeableConcept, False, None, False), ("text", "text", str, False, None, False), - ("topic", "topic", fhirreference.FHIRReference, True, None, False), + ("topicCodeableConcept", "topicCodeableConcept", codeableconcept.CodeableConcept, False, "topic", False), + ("topicReference", "topicReference", fhirreference.FHIRReference, False, "topic", False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("valuedItem", "valuedItem", ContractTermValuedItem, True, None, False), ]) return js -class ContractTermAgent(backboneelement.BackboneElement): - """ Contract Term Agent List. +class ContractTermAction(backboneelement.BackboneElement): + """ Entity being ascribed responsibility. An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place. """ - resource_type = "ContractTermAgent" + resource_type = "ContractTermAction" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -455,32 +531,168 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.actor = None - """ Contract Term Agent Subject. - Type `FHIRReference` referencing `Contract, Device, Group, Location, Organization, Patient, Practitioner, RelatedPerson, Substance` (represented as `dict` in JSON). """ + self.context = None + """ Episode associated with action. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.role = None - """ Type of the Contract Term Agent. + self.contextLinkId = None + """ Pointer to specific item. + List of `str` items. """ + + self.doNotPerform = None + """ True if the term prohibits the action. + Type `bool`. """ + + self.intent = None + """ Purpose for the Contract Term Action. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.linkId = None + """ Pointer to specific item. + List of `str` items. """ + + self.note = None + """ Comments about the action. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.occurrenceDateTime = None + """ When action happens. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrencePeriod = None + """ When action happens. + Type `Period` (represented as `dict` in JSON). """ + + self.occurrenceTiming = None + """ When action happens. + Type `Timing` (represented as `dict` in JSON). """ + + self.performer = None + """ Actor that wil execute (or not) the action. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.performerLinkId = None + """ Pointer to specific item. + List of `str` items. """ + + self.performerRole = None + """ Competency of the performer. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.performerType = None + """ Kind of service performer. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reason = None + """ Why action is to be performed. + List of `str` items. """ + + self.reasonCode = None + """ Why is action (not) needed?. List of `CodeableConcept` items (represented as `dict` in JSON). """ - super(ContractTermAgent, self).__init__(jsondict=jsondict, strict=strict) + self.reasonLinkId = None + """ Pointer to specific item. + List of `str` items. """ + + self.reasonReference = None + """ Why is action (not) needed?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.requester = None + """ Who asked for action. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.requesterLinkId = None + """ Pointer to specific item. + List of `str` items. """ + + self.securityLabelNumber = None + """ Action restriction numbers. + List of `int` items. """ + + self.status = None + """ State of the action. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subject = None + """ Entity of the action. + List of `ContractTermActionSubject` items (represented as `dict` in JSON). """ + + self.type = None + """ Type or form of the action. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ContractTermAction, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ContractTermAgent, self).elementProperties() + js = super(ContractTermAction, self).elementProperties() js.extend([ - ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, True, None, False), + ("context", "context", fhirreference.FHIRReference, False, None, False), + ("contextLinkId", "contextLinkId", str, True, None, False), + ("doNotPerform", "doNotPerform", bool, False, None, False), + ("intent", "intent", codeableconcept.CodeableConcept, False, None, True), + ("linkId", "linkId", str, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), + ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), + ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("performerLinkId", "performerLinkId", str, True, None, False), + ("performerRole", "performerRole", codeableconcept.CodeableConcept, False, None, False), + ("performerType", "performerType", codeableconcept.CodeableConcept, True, None, False), + ("reason", "reason", str, True, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonLinkId", "reasonLinkId", str, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("requester", "requester", fhirreference.FHIRReference, True, None, False), + ("requesterLinkId", "requesterLinkId", str, True, None, False), + ("securityLabelNumber", "securityLabelNumber", int, True, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, True), + ("subject", "subject", ContractTermActionSubject, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), ]) return js -class ContractTermValuedItem(backboneelement.BackboneElement): - """ Contract Term Valued Item List. +class ContractTermActionSubject(backboneelement.BackboneElement): + """ Entity of the action. + """ + + resource_type = "ContractTermActionSubject" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.reference = None + """ Entity of the action. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.role = None + """ Role type of the agent. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ContractTermActionSubject, self).__init__(jsondict=jsondict, strict=strict) - Contract Provision Valued Item List. + def elementProperties(self): + js = super(ContractTermActionSubject, self).elementProperties() + js.extend([ + ("reference", "reference", fhirreference.FHIRReference, True, None, True), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ContractTermAsset(backboneelement.BackboneElement): + """ Contract Term Asset List. """ - resource_type = "ContractTermValuedItem" + resource_type = "ContractTermAsset" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -490,65 +702,133 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.effectiveTime = None - """ Contract Term Valued Item Effective Tiem. - Type `FHIRDate` (represented as `str` in JSON). """ + self.answer = None + """ Response to assets. + List of `ContractTermOfferAnswer` items (represented as `dict` in JSON). """ - self.entityCodeableConcept = None - """ Contract Term Valued Item Type. + self.condition = None + """ Quality desctiption of asset. + Type `str`. """ + + self.context = None + """ Circumstance of the asset. + List of `ContractTermAssetContext` items (represented as `dict` in JSON). """ + + self.linkId = None + """ Pointer to asset text. + List of `str` items. """ + + self.period = None + """ Time period of the asset. + List of `Period` items (represented as `dict` in JSON). """ + + self.periodType = None + """ Asset availability types. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.relationship = None + """ Kinship of the asset. + Type `Coding` (represented as `dict` in JSON). """ + + self.scope = None + """ Range of asset. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.entityReference = None - """ Contract Term Valued Item Type. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + self.securityLabelNumber = None + """ Asset restriction numbers. + List of `int` items. """ - self.factor = None - """ Contract Term Valued Item Price Scaling Factor. - Type `float`. """ + self.subtype = None + """ Asset sub-category. + List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.identifier = None - """ Contract Term Valued Item Number. - Type `Identifier` (represented as `dict` in JSON). """ + self.text = None + """ Asset clause or question text. + Type `str`. """ - self.net = None - """ Total Contract Term Valued Item Value. - Type `Money` (represented as `dict` in JSON). """ + self.type = None + """ Asset category. + List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.points = None - """ Contract Term Valued Item Difficulty Scaling Factor. - Type `float`. """ + self.typeReference = None + """ Associated entities. + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.quantity = None - """ Contract Term Valued Item Count. - Type `Quantity` (represented as `dict` in JSON). """ + self.usePeriod = None + """ Time period. + List of `Period` items (represented as `dict` in JSON). """ - self.unitPrice = None - """ Contract Term Valued Item fee, charge, or cost. - Type `Money` (represented as `dict` in JSON). """ + self.valuedItem = None + """ Contract Valued Item List. + List of `ContractTermAssetValuedItem` items (represented as `dict` in JSON). """ - super(ContractTermValuedItem, self).__init__(jsondict=jsondict, strict=strict) + super(ContractTermAsset, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ContractTermValuedItem, self).elementProperties() + js = super(ContractTermAsset, self).elementProperties() js.extend([ - ("effectiveTime", "effectiveTime", fhirdate.FHIRDate, False, None, False), - ("entityCodeableConcept", "entityCodeableConcept", codeableconcept.CodeableConcept, False, "entity", False), - ("entityReference", "entityReference", fhirreference.FHIRReference, False, "entity", False), - ("factor", "factor", float, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("net", "net", money.Money, False, None, False), - ("points", "points", float, False, None, False), - ("quantity", "quantity", quantity.Quantity, False, None, False), - ("unitPrice", "unitPrice", money.Money, False, None, False), + ("answer", "answer", ContractTermOfferAnswer, True, None, False), + ("condition", "condition", str, False, None, False), + ("context", "context", ContractTermAssetContext, True, None, False), + ("linkId", "linkId", str, True, None, False), + ("period", "period", period.Period, True, None, False), + ("periodType", "periodType", codeableconcept.CodeableConcept, True, None, False), + ("relationship", "relationship", coding.Coding, False, None, False), + ("scope", "scope", codeableconcept.CodeableConcept, False, None, False), + ("securityLabelNumber", "securityLabelNumber", int, True, None, False), + ("subtype", "subtype", codeableconcept.CodeableConcept, True, None, False), + ("text", "text", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ("typeReference", "typeReference", fhirreference.FHIRReference, True, None, False), + ("usePeriod", "usePeriod", period.Period, True, None, False), + ("valuedItem", "valuedItem", ContractTermAssetValuedItem, True, None, False), ]) return js -class ContractValuedItem(backboneelement.BackboneElement): +class ContractTermAssetContext(backboneelement.BackboneElement): + """ Circumstance of the asset. + """ + + resource_type = "ContractTermAssetContext" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Codeable asset context. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reference = None + """ Creator,custodian or owner. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.text = None + """ Context description. + Type `str`. """ + + super(ContractTermAssetContext, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermAssetContext, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("reference", "reference", fhirreference.FHIRReference, False, None, False), + ("text", "text", str, False, None, False), + ]) + return js + + +class ContractTermAssetValuedItem(backboneelement.BackboneElement): """ Contract Valued Item List. """ - resource_type = "ContractValuedItem" + resource_type = "ContractTermAssetValuedItem" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -568,7 +848,7 @@ def __init__(self, jsondict=None, strict=True): self.entityReference = None """ Contract Valued Item Type. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.factor = None """ Contract Valued Item Price Scaling Factor. @@ -578,10 +858,22 @@ def __init__(self, jsondict=None, strict=True): """ Contract Valued Item Number. Type `Identifier` (represented as `dict` in JSON). """ + self.linkId = None + """ Pointer to specific item. + List of `str` items. """ + self.net = None """ Total Contract Valued Item Value. Type `Money` (represented as `dict` in JSON). """ + self.payment = None + """ Terms of valuation. + Type `str`. """ + + self.paymentDate = None + """ When payment is due. + Type `FHIRDate` (represented as `str` in JSON). """ + self.points = None """ Contract Valued Item Difficulty Scaling Factor. Type `float`. """ @@ -590,29 +882,288 @@ def __init__(self, jsondict=None, strict=True): """ Count of Contract Valued Items. Type `Quantity` (represented as `dict` in JSON). """ + self.recipient = None + """ Who will receive payment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.responsible = None + """ Who will make payment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.securityLabelNumber = None + """ Security Labels that define affected terms. + List of `int` items. """ + self.unitPrice = None """ Contract Valued Item fee, charge, or cost. Type `Money` (represented as `dict` in JSON). """ - super(ContractValuedItem, self).__init__(jsondict=jsondict, strict=strict) + super(ContractTermAssetValuedItem, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ContractValuedItem, self).elementProperties() + js = super(ContractTermAssetValuedItem, self).elementProperties() js.extend([ ("effectiveTime", "effectiveTime", fhirdate.FHIRDate, False, None, False), ("entityCodeableConcept", "entityCodeableConcept", codeableconcept.CodeableConcept, False, "entity", False), ("entityReference", "entityReference", fhirreference.FHIRReference, False, "entity", False), ("factor", "factor", float, False, None, False), ("identifier", "identifier", identifier.Identifier, False, None, False), + ("linkId", "linkId", str, True, None, False), ("net", "net", money.Money, False, None, False), + ("payment", "payment", str, False, None, False), + ("paymentDate", "paymentDate", fhirdate.FHIRDate, False, None, False), ("points", "points", float, False, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, False, None, False), + ("responsible", "responsible", fhirreference.FHIRReference, False, None, False), + ("securityLabelNumber", "securityLabelNumber", int, True, None, False), ("unitPrice", "unitPrice", money.Money, False, None, False), ]) return js +class ContractTermOffer(backboneelement.BackboneElement): + """ Context of the Contract term. + + The matter of concern in the context of this provision of the agrement. + """ + + resource_type = "ContractTermOffer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.answer = None + """ Response to offer text. + List of `ContractTermOfferAnswer` items (represented as `dict` in JSON). """ + + self.decision = None + """ Accepting party choice. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.decisionMode = None + """ How decision is conveyed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Offer business ID. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.linkId = None + """ Pointer to text. + List of `str` items. """ + + self.party = None + """ Offer Recipient. + List of `ContractTermOfferParty` items (represented as `dict` in JSON). """ + + self.securityLabelNumber = None + """ Offer restriction numbers. + List of `int` items. """ + + self.text = None + """ Human readable offer text. + Type `str`. """ + + self.topic = None + """ Negotiable offer asset. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ Contract Offer Type or Form. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ContractTermOffer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermOffer, self).elementProperties() + js.extend([ + ("answer", "answer", ContractTermOfferAnswer, True, None, False), + ("decision", "decision", codeableconcept.CodeableConcept, False, None, False), + ("decisionMode", "decisionMode", codeableconcept.CodeableConcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("linkId", "linkId", str, True, None, False), + ("party", "party", ContractTermOfferParty, True, None, False), + ("securityLabelNumber", "securityLabelNumber", int, True, None, False), + ("text", "text", str, False, None, False), + ("topic", "topic", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ContractTermOfferAnswer(backboneelement.BackboneElement): + """ Response to offer text. + """ + + resource_type = "ContractTermOfferAnswer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.valueAttachment = None + """ The actual answer response. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ The actual answer response. + Type `bool`. """ + + self.valueCoding = None + """ The actual answer response. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDate = None + """ The actual answer response. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ The actual answer response. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDecimal = None + """ The actual answer response. + Type `float`. """ + + self.valueInteger = None + """ The actual answer response. + Type `int`. """ + + self.valueQuantity = None + """ The actual answer response. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueReference = None + """ The actual answer response. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueString = None + """ The actual answer response. + Type `str`. """ + + self.valueTime = None + """ The actual answer response. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueUri = None + """ The actual answer response. + Type `str`. """ + + super(ContractTermOfferAnswer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermOfferAnswer, self).elementProperties() + js.extend([ + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), + ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", True), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", True), + ("valueDecimal", "valueDecimal", float, False, "value", True), + ("valueInteger", "valueInteger", int, False, "value", True), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), + ("valueString", "valueString", str, False, "value", True), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", True), + ("valueUri", "valueUri", str, False, "value", True), + ]) + return js + + +class ContractTermOfferParty(backboneelement.BackboneElement): + """ Offer Recipient. + """ + + resource_type = "ContractTermOfferParty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.reference = None + """ Referenced entity. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.role = None + """ Participant engagement type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ContractTermOfferParty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermOfferParty, self).elementProperties() + js.extend([ + ("reference", "reference", fhirreference.FHIRReference, True, None, True), + ("role", "role", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class ContractTermSecurityLabel(backboneelement.BackboneElement): + """ Protection for the Term. + + Security labels that protect the handling of information about the term and + its elements, which may be specifically identified.. + """ + + resource_type = "ContractTermSecurityLabel" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.category = None + """ Applicable Policy. + List of `Coding` items (represented as `dict` in JSON). """ + + self.classification = None + """ Confidentiality Protection. + Type `Coding` (represented as `dict` in JSON). """ + + self.control = None + """ Handling Instructions. + List of `Coding` items (represented as `dict` in JSON). """ + + self.number = None + """ Link to Security Labels. + List of `int` items. """ + + super(ContractTermSecurityLabel, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ContractTermSecurityLabel, self).elementProperties() + js.extend([ + ("category", "category", coding.Coding, True, None, False), + ("classification", "classification", coding.Coding, False, None, True), + ("control", "control", coding.Coding, True, None, False), + ("number", "number", int, True, None, False), + ]) + return js + + import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] try: from . import attachment except ImportError: @@ -653,3 +1204,7 @@ def elementProperties(self): from . import signature except ImportError: signature = sys.modules[__package__ + '.signature'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/contract_tests.py b/fhirclient/models/contract_tests.py index f85d22640..5be488d1a 100644 --- a/fhirclient/models/contract_tests.py +++ b/fhirclient/models/contract_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return contract.Contract(js) def testContract1(self): - inst = self.instantiate_from("contract-example-42cfr-part2.json") + inst = self.instantiate_from("pcd-example-notOrg.json") self.assertIsNotNone(inst, "Must have instantiated a Contract instance") self.implContract1(inst) @@ -32,66 +32,27 @@ def testContract1(self): self.implContract1(inst2) def implContract1(self, inst): - self.assertEqual(inst.agent[0].role[0].coding[0].code, "IR") - self.assertEqual(inst.agent[0].role[0].coding[0].display, "Recipient") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://org.mdhhs.fhir.consent-actor-type") - self.assertEqual(inst.agent[0].role[0].text, "Recipient of restricted health information") - self.assertEqual(inst.agent[1].role[0].coding[0].code, "IS") - self.assertEqual(inst.agent[1].role[0].coding[0].display, "Sender") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://org.mdhhs.fhir.consent-actor-type") - self.assertEqual(inst.agent[1].role[0].text, "Sender of restricted health information") - self.assertEqual(inst.id, "C-2121") - self.assertEqual(inst.issued.date, FHIRDate("2031-11-01T21:18:27-04:00").date) - self.assertEqual(inst.issued.as_json(), "2031-11-01T21:18:27-04:00") - self.assertEqual(inst.legal[0].contentAttachment.contentType, "application/pdf") - self.assertEqual(inst.legal[0].contentAttachment.language, "en-US") - self.assertEqual(inst.legal[0].contentAttachment.title, "MDHHS-5515 Consent To Share Your Health Information") - self.assertEqual(inst.legal[0].contentAttachment.url, "http://org.mihin.ecms/ConsentDirective-2121") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2016-07-19T18:18:42.108-04:00").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2016-07-19T18:18:42.108-04:00") - self.assertEqual(inst.meta.versionId, "1") - self.assertEqual(inst.securityLabel[0].code, "R") - self.assertEqual(inst.securityLabel[0].display, "Restricted") - self.assertEqual(inst.securityLabel[0].system, "http://hl7.org/fhir/v3/Confidentiality") - self.assertEqual(inst.securityLabel[1].code, "ETH") - self.assertEqual(inst.securityLabel[1].display, "substance abuse information sensitivity") - self.assertEqual(inst.securityLabel[1].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.securityLabel[2].code, "42CFRPart2") - self.assertEqual(inst.securityLabel[2].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.securityLabel[3].code, "TREAT") - self.assertEqual(inst.securityLabel[3].display, "treatment") - self.assertEqual(inst.securityLabel[3].system, "http://hl7.org/fhir/v3/ActReason") - self.assertEqual(inst.securityLabel[4].code, "HPAYMT") - self.assertEqual(inst.securityLabel[4].display, "healthcare payment") - self.assertEqual(inst.securityLabel[4].system, "http://hl7.org/fhir/v3/ActReason") - self.assertEqual(inst.securityLabel[5].code, "HOPERAT") - self.assertEqual(inst.securityLabel[5].display, "healthcare operations") - self.assertEqual(inst.securityLabel[5].system, "http://hl7.org/fhir/v3/ActReason") - self.assertEqual(inst.securityLabel[6].code, "PERSISTLABEL") - self.assertEqual(inst.securityLabel[6].display, "persist security label") - self.assertEqual(inst.securityLabel[6].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.securityLabel[7].code, "PRIVMARK") - self.assertEqual(inst.securityLabel[7].display, "privacy mark") - self.assertEqual(inst.securityLabel[7].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.securityLabel[8].code, "NORDSCLCD") - self.assertEqual(inst.securityLabel[8].display, "no redisclosure without consent directive") - self.assertEqual(inst.securityLabel[8].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.signer[0].signature[0].type[0].code, "1.2.840.10065.1.12.1.1") - self.assertEqual(inst.signer[0].signature[0].type[0].system, "urn:iso-astm:E1762-95:2013") - self.assertEqual(inst.signer[0].signature[0].when.date, FHIRDate("2017-02-08T10:57:34+01:00").date) - self.assertEqual(inst.signer[0].signature[0].when.as_json(), "2017-02-08T10:57:34+01:00") - self.assertEqual(inst.signer[0].type.code, "SELF") - self.assertEqual(inst.signer[0].type.system, "http://org.mdhhs.fhir.consent-signer-type") - self.assertEqual(inst.subType[0].coding[0].code, "MDHHS-5515") - self.assertEqual(inst.subType[0].coding[0].display, "Michigan MDHHS-5515 Consent to Share Behavioral Health Information for Care Coordination Purposes") - self.assertEqual(inst.subType[0].coding[0].system, "http://hl7.org/fhir/consentcategorycodes") + self.assertEqual(inst.friendly[0].contentAttachment.title, "The terms of the consent in friendly consumer speak.") + self.assertEqual(inst.id, "pcd-example-notOrg") + self.assertEqual(inst.issued.date, FHIRDate("2015-11-18").date) + self.assertEqual(inst.issued.as_json(), "2015-11-18") + self.assertEqual(inst.legal[0].contentAttachment.title, "The terms of the consent in lawyer speak.") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.subType[0].coding[0].code, "Opt-In") + self.assertEqual(inst.subType[0].coding[0].display, "Default Authorization with exceptions.") + self.assertEqual(inst.subType[0].coding[0].system, "http://www.infoway-inforoute.ca.org/Consent-subtype-codes") + self.assertEqual(inst.term[0].offer.text, "Withhold this order and any results or related objects from any provider.") + self.assertEqual(inst.term[0].type.coding[0].code, "withhold-from") + self.assertEqual(inst.term[0].type.coding[0].display, "Withhold all data from specified actor entity.") + self.assertEqual(inst.term[0].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "OPTIN") - self.assertEqual(inst.type.coding[0].system, "http://org.mdhhs.fhir.consentdirective-type") - self.assertEqual(inst.type.text, "Opt-in consent directive") + self.assertEqual(inst.type.coding[0].code, "57016-8") + self.assertEqual(inst.type.coding[0].system, "http://loinc.org") def testContract2(self): - inst = self.instantiate_from("contract-example.json") + inst = self.instantiate_from("contract-example-ins-policy.json") self.assertIsNotNone(inst, "Must have instantiated a Contract instance") self.implContract2(inst) @@ -101,14 +62,52 @@ def testContract2(self): self.implContract2(inst2) def implContract2(self, inst): - self.assertEqual(inst.id, "C-123") - self.assertEqual(inst.identifier.system, "http://happyvalley.com/contract") - self.assertEqual(inst.identifier.value, "12347") - self.assertEqual(inst.text.div, "
A human-readable rendering of the contract
") + self.assertEqual(inst.applies.start.date, FHIRDate("2017-01-01").date) + self.assertEqual(inst.applies.start.as_json(), "2017-01-01") + self.assertEqual(inst.id, "INS-101") + self.assertEqual(inst.identifier[0].system, "http://xyz-insurance.com/forms") + self.assertEqual(inst.identifier[0].value, "YCSCWLN(01-2017)") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.term[0].asset[0].period[0].start.date, FHIRDate("2017-06-01").date) + self.assertEqual(inst.term[0].asset[0].period[0].start.as_json(), "2017-06-01") + self.assertEqual(inst.term[0].asset[0].subtype[0].text, "sample") + self.assertEqual(inst.term[0].asset[0].type[0].coding[0].code, "RicardianContract") + self.assertEqual(inst.term[0].asset[0].type[0].coding[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].effectiveTime.date, FHIRDate("1995").date) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].effectiveTime.as_json(), "1995") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].entityCodeableConcept.text, "Ford Bobcat") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].factor, 1.0) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].identifier.system, "http://somewhere.motor-vehicle.com/vin") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].identifier.value, "XXSVT34-7665t952236") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].net.currency, "CAD") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].net.value, 200.0) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].points, 1.0) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].quantity.value, 1) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].unitPrice.currency, "CAD") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].unitPrice.value, 200.0) + self.assertEqual(inst.term[0].group[0].offer.text, "Eligible Providers") + self.assertEqual(inst.term[0].group[1].offer.text, "Responsibility for Payment") + self.assertEqual(inst.term[0].group[2].group[0].group[0].offer.text, "Emergency Room Copay") + self.assertEqual(inst.term[0].group[2].group[0].group[1].offer.text, "Professional Visit Copay") + self.assertEqual(inst.term[0].group[2].group[0].offer.text, "Copays") + self.assertEqual(inst.term[0].group[2].group[1].offer.text, "Calendar Year Deductible") + self.assertEqual(inst.term[0].group[2].group[2].offer.text, "Out-Of-Pocket Maximum") + self.assertEqual(inst.term[0].group[2].group[3].group[0].offer.text, "Ambulance Services") + self.assertEqual(inst.term[0].group[2].group[3].group[1].offer.text, "Dental Services") + self.assertEqual(inst.term[0].group[2].group[3].group[2].offer.text, "Diagnostic Services") + self.assertEqual(inst.term[0].group[2].group[3].group[3].offer.text, "Emergency Room Services") + self.assertEqual(inst.term[0].group[2].group[3].group[4].offer.text, "Hospital Inpatient Care") + self.assertEqual(inst.term[0].group[2].group[3].offer.text, "Medical Services") + self.assertEqual(inst.term[0].group[2].offer.text, "List of Benefits") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "healthinsurance") + self.assertEqual(inst.type.coding[0].display, "Health Insurance") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/contract-type") def testContract3(self): - inst = self.instantiate_from("pcd-example-notAuthor.json") + inst = self.instantiate_from("contract-example-42cfr-part2.json") self.assertIsNotNone(inst, "Must have instantiated a Contract instance") self.implContract3(inst) @@ -118,21 +117,58 @@ def testContract3(self): self.implContract3(inst2) def implContract3(self, inst): - self.assertEqual(inst.friendly[0].contentAttachment.title, "The terms of the consent in friendly consumer speak.") - self.assertEqual(inst.id, "pcd-example-notAuthor") - self.assertEqual(inst.issued.date, FHIRDate("2015-11-18").date) - self.assertEqual(inst.issued.as_json(), "2015-11-18") - self.assertEqual(inst.legal[0].contentAttachment.title, "The terms of the consent in lawyer speak.") - self.assertEqual(inst.subType[0].coding[0].code, "Opt-In") - self.assertEqual(inst.subType[0].coding[0].display, "Default Authorization with exceptions.") - self.assertEqual(inst.subType[0].coding[0].system, "http://www.infoway-inforoute.ca.org/Consent-subtype-codes") - self.assertEqual(inst.term[0].text, "Withhold all data authored by Good Health provider.") - self.assertEqual(inst.term[0].type.coding[0].code, "withhold-authored-by") - self.assertEqual(inst.term[0].type.coding[0].display, "Withhold all data authored by specified actor entity.") - self.assertEqual(inst.term[0].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") + self.assertEqual(inst.applies.start.date, FHIRDate("2013-11-01T21:18:27-04:00").date) + self.assertEqual(inst.applies.start.as_json(), "2013-11-01T21:18:27-04:00") + self.assertEqual(inst.contentDerivative.coding[0].code, "registration") + self.assertEqual(inst.contentDerivative.coding[0].system, "http://terminology.hl7.org/CodeSystem/contract-content-derivative") + self.assertEqual(inst.id, "C-2121") + self.assertEqual(inst.issued.date, FHIRDate("2013-11-01T21:18:27-04:00").date) + self.assertEqual(inst.issued.as_json(), "2013-11-01T21:18:27-04:00") + self.assertEqual(inst.legal[0].contentAttachment.contentType, "application/pdf") + self.assertEqual(inst.legal[0].contentAttachment.language, "en-US") + self.assertEqual(inst.legal[0].contentAttachment.title, "MDHHS-5515 Consent To Share Your Health Information") + self.assertEqual(inst.legal[0].contentAttachment.url, "http://org.mihin.ecms/ConsentDirective-2121") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2016-07-19T18:18:42.108-04:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2016-07-19T18:18:42.108-04:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.meta.versionId, "1") + self.assertEqual(inst.signer[0].signature[0].type[0].code, "1.2.840.10065.1.12.1.1") + self.assertEqual(inst.signer[0].signature[0].type[0].system, "urn:iso-astm:E1762-95:2013") + self.assertEqual(inst.signer[0].signature[0].when.date, FHIRDate("2017-02-08T10:57:34+01:00").date) + self.assertEqual(inst.signer[0].signature[0].when.as_json(), "2017-02-08T10:57:34+01:00") + self.assertEqual(inst.signer[0].type.code, "SELF") + self.assertEqual(inst.signer[0].type.system, "http://mdhhs.org/fhir/consent-signer-type") + self.assertEqual(inst.status, "executed") + self.assertEqual(inst.subType[0].coding[0].code, "hcd") + self.assertEqual(inst.subType[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/consentcategorycodes") + self.assertEqual(inst.term[0].action[0].intent.coding[0].code, "HPRGRP") + self.assertEqual(inst.term[0].action[0].intent.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.term[0].action[0].status.text, "Sample") + self.assertEqual(inst.term[0].action[0].subject[0].role.coding[0].code, "IR") + self.assertEqual(inst.term[0].action[0].subject[0].role.coding[0].display, "Recipient") + self.assertEqual(inst.term[0].action[0].subject[0].role.coding[0].system, "http://mdhhs.org/fhir/consent-actor-type") + self.assertEqual(inst.term[0].action[0].subject[0].role.text, "Recipient of restricted health information") + self.assertEqual(inst.term[0].action[0].subject[1].role.coding[0].code, "IS") + self.assertEqual(inst.term[0].action[0].subject[1].role.coding[0].display, "Sender") + self.assertEqual(inst.term[0].action[0].subject[1].role.coding[0].system, "http://mdhhs.org/fhir/consent-actor-type") + self.assertEqual(inst.term[0].action[0].subject[1].role.text, "Sender of restricted health information") + self.assertEqual(inst.term[0].action[0].type.coding[0].code, "action-a") + self.assertEqual(inst.term[0].action[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/contractaction") + self.assertEqual(inst.term[0].asset[0].period[0].end.date, FHIRDate("2019-11-01T21:18:27-04:00").date) + self.assertEqual(inst.term[0].asset[0].period[0].end.as_json(), "2019-11-01T21:18:27-04:00") + self.assertEqual(inst.term[0].asset[0].period[0].start.date, FHIRDate("2013-11-01T21:18:27-04:00").date) + self.assertEqual(inst.term[0].asset[0].period[0].start.as_json(), "2013-11-01T21:18:27-04:00") + self.assertEqual(inst.term[0].offer.decision.coding[0].code, "OPTIN") + self.assertEqual(inst.term[0].offer.decision.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.term[0].offer.text, "Can't refuse") + self.assertEqual(inst.term[0].offer.type.coding[0].code, "statutory") + self.assertEqual(inst.term[0].offer.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/contracttermtypecodes") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "57016-8") - self.assertEqual(inst.type.coding[0].system, "http://loinc.org") + self.assertEqual(inst.type.coding[0].code, "OPTIN") + self.assertEqual(inst.type.coding[0].system, "http://mdhhs.org/fhir/consentdirective-type") + self.assertEqual(inst.type.text, "Opt-in consent directive") def testContract4(self): inst = self.instantiate_from("pcd-example-notLabs.json") @@ -150,25 +186,29 @@ def implContract4(self, inst): self.assertEqual(inst.issued.date, FHIRDate("2014-08-17").date) self.assertEqual(inst.issued.as_json(), "2014-08-17") self.assertEqual(inst.legal[0].contentAttachment.title, "The terms of the consent in lawyer speak.") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.subType[0].coding[0].code, "Opt-In") self.assertEqual(inst.subType[0].coding[0].display, "Default Authorization with exceptions.") self.assertEqual(inst.subType[0].coding[0].system, "http://www.infoway-inforoute.ca.org/Consent-subtype-codes") - self.assertEqual(inst.term[0].subType.coding[0].code, "ProcedureRequest") - self.assertEqual(inst.term[0].subType.coding[0].system, "http://hl7.org/fhir/resource-types") - self.assertEqual(inst.term[0].text, "Withhold orders from any provider.") - self.assertEqual(inst.term[0].type.coding[0].code, "withhold-object-type") - self.assertEqual(inst.term[0].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") - self.assertEqual(inst.term[1].subType.coding[0].code, "DiagnosticReport") - self.assertEqual(inst.term[1].subType.coding[0].system, "http://hl7.org/fhir/resource-types") - self.assertEqual(inst.term[1].text, "Withhold order results from any provider.") - self.assertEqual(inst.term[1].type.coding[0].code, "withhold-object-type") - self.assertEqual(inst.term[1].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") + self.assertEqual(inst.term[0].group[0].offer.text, "Withhold orders from any provider.") + self.assertEqual(inst.term[0].group[0].subType.coding[0].code, "ServiceRequest") + self.assertEqual(inst.term[0].group[0].subType.coding[0].system, "http://hl7.org/fhir/resource-types") + self.assertEqual(inst.term[0].group[0].type.coding[0].code, "withhold-object-type") + self.assertEqual(inst.term[0].group[0].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") + self.assertEqual(inst.term[0].group[1].offer.text, "Withhold order results from any provider.") + self.assertEqual(inst.term[0].group[1].subType.coding[0].code, "DiagnosticReport") + self.assertEqual(inst.term[0].group[1].subType.coding[0].system, "http://hl7.org/fhir/resource-types") + self.assertEqual(inst.term[0].group[1].type.coding[0].code, "withhold-object-type") + self.assertEqual(inst.term[0].group[1].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") + self.assertEqual(inst.term[0].offer.text, "sample") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "57016-8") self.assertEqual(inst.type.coding[0].system, "http://loinc.org") def testContract5(self): - inst = self.instantiate_from("pcd-example-notOrg.json") + inst = self.instantiate_from("pcd-example-notThem.json") self.assertIsNotNone(inst, "Must have instantiated a Contract instance") self.implContract5(inst) @@ -179,14 +219,23 @@ def testContract5(self): def implContract5(self, inst): self.assertEqual(inst.friendly[0].contentAttachment.title, "The terms of the consent in friendly consumer speak.") - self.assertEqual(inst.id, "pcd-example-notOrg") + self.assertEqual(inst.id, "pcd-example-notThem") self.assertEqual(inst.issued.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.issued.as_json(), "2015-11-18") self.assertEqual(inst.legal[0].contentAttachment.title, "The terms of the consent in lawyer speak.") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.signer[0].signature[0].type[0].code, "1.2.840.10065.1.12.1.1") + self.assertEqual(inst.signer[0].signature[0].type[0].system, "urn:iso-astm:E1762-95:2013") + self.assertEqual(inst.signer[0].signature[0].when.date, FHIRDate("2013-06-08T10:57:34-07:00").date) + self.assertEqual(inst.signer[0].signature[0].when.as_json(), "2013-06-08T10:57:34-07:00") + self.assertEqual(inst.signer[0].type.code, "COVPTY") + self.assertEqual(inst.signer[0].type.system, "http://terminology.hl7.org/CodeSystem/contractsignertypecodes") self.assertEqual(inst.subType[0].coding[0].code, "Opt-In") self.assertEqual(inst.subType[0].coding[0].display, "Default Authorization with exceptions.") self.assertEqual(inst.subType[0].coding[0].system, "http://www.infoway-inforoute.ca.org/Consent-subtype-codes") - self.assertEqual(inst.term[0].text, "Withhold this order and any results or related objects from any provider.") + self.assertEqual(inst.term[0].offer.text, "Withhold this order and any results or related objects from specified nurse provider.") self.assertEqual(inst.term[0].type.coding[0].code, "withhold-from") self.assertEqual(inst.term[0].type.coding[0].display, "Withhold all data from specified actor entity.") self.assertEqual(inst.term[0].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") @@ -195,7 +244,7 @@ def implContract5(self, inst): self.assertEqual(inst.type.coding[0].system, "http://loinc.org") def testContract6(self): - inst = self.instantiate_from("pcd-example-notThem.json") + inst = self.instantiate_from("pcd-example-notAuthor.json") self.assertIsNotNone(inst, "Must have instantiated a Contract instance") self.implContract6(inst) @@ -206,29 +255,26 @@ def testContract6(self): def implContract6(self, inst): self.assertEqual(inst.friendly[0].contentAttachment.title, "The terms of the consent in friendly consumer speak.") - self.assertEqual(inst.id, "pcd-example-notThem") + self.assertEqual(inst.id, "pcd-example-notAuthor") self.assertEqual(inst.issued.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.issued.as_json(), "2015-11-18") self.assertEqual(inst.legal[0].contentAttachment.title, "The terms of the consent in lawyer speak.") - self.assertEqual(inst.signer[0].signature[0].type[0].code, "1.2.840.10065.1.12.1.1") - self.assertEqual(inst.signer[0].signature[0].type[0].system, "urn:iso-astm:E1762-95:2013") - self.assertEqual(inst.signer[0].signature[0].when.date, FHIRDate("2013-06-08T10:57:34-07:00").date) - self.assertEqual(inst.signer[0].signature[0].when.as_json(), "2013-06-08T10:57:34-07:00") - self.assertEqual(inst.signer[0].type.code, "COVPTY") - self.assertEqual(inst.signer[0].type.system, "http://www.hl7.org/fhir/contractsignertypecodes") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.subType[0].coding[0].code, "Opt-In") self.assertEqual(inst.subType[0].coding[0].display, "Default Authorization with exceptions.") self.assertEqual(inst.subType[0].coding[0].system, "http://www.infoway-inforoute.ca.org/Consent-subtype-codes") - self.assertEqual(inst.term[0].text, "Withhold this order and any results or related objects from specified nurse provider.") - self.assertEqual(inst.term[0].type.coding[0].code, "withhold-from") - self.assertEqual(inst.term[0].type.coding[0].display, "Withhold all data from specified actor entity.") + self.assertEqual(inst.term[0].offer.text, "Withhold all data authored by Good Health provider.") + self.assertEqual(inst.term[0].type.coding[0].code, "withhold-authored-by") + self.assertEqual(inst.term[0].type.coding[0].display, "Withhold all data authored by specified actor entity.") self.assertEqual(inst.term[0].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "57016-8") self.assertEqual(inst.type.coding[0].system, "http://loinc.org") def testContract7(self): - inst = self.instantiate_from("pcd-example-notThis.json") + inst = self.instantiate_from("contract-example.json") self.assertIsNotNone(inst, "Must have instantiated a Contract instance") self.implContract7(inst) @@ -238,15 +284,66 @@ def testContract7(self): self.implContract7(inst2) def implContract7(self, inst): + self.assertEqual(inst.id, "C-123") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/contract") + self.assertEqual(inst.identifier[0].value, "12347") + self.assertEqual(inst.legallyBindingAttachment.contentType, "application/pdf") + self.assertEqual(inst.legallyBindingAttachment.url, "http://www.aws3.com/storage/doc.pdf") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.rule[0].contentAttachment.contentType, "application/txt") + self.assertEqual(inst.rule[0].contentAttachment.url, "http://www.rfc-editor.org/bcp/bcp13.txt") + self.assertEqual(inst.term[0].asset[0].period[0].start.date, FHIRDate("2017-06-01").date) + self.assertEqual(inst.term[0].asset[0].period[0].start.as_json(), "2017-06-01") + self.assertEqual(inst.term[0].asset[0].subtype[0].text, "sample") + self.assertEqual(inst.term[0].asset[0].type[0].coding[0].code, "RicardianContract") + self.assertEqual(inst.term[0].asset[0].type[0].coding[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].effectiveTime.date, FHIRDate("1995").date) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].effectiveTime.as_json(), "1995") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].entityCodeableConcept.text, "Ford Bobcat") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].factor, 1.0) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].identifier.system, "http://somewhere.motor-vehicle.com/vin") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].identifier.value, "XXSVT34-7665t952236") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].net.currency, "CAD") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].net.value, 200.0) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].points, 1.0) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].quantity.value, 1) + self.assertEqual(inst.term[0].asset[0].valuedItem[0].unitPrice.currency, "CAD") + self.assertEqual(inst.term[0].asset[0].valuedItem[0].unitPrice.value, 200.0) + self.assertEqual(inst.term[0].offer.text, "Can't refuse") + self.assertEqual(inst.text.div, "
A human-readable rendering of the contract
") + self.assertEqual(inst.text.status, "generated") + + def testContract8(self): + inst = self.instantiate_from("pcd-example-notThis.json") + self.assertIsNotNone(inst, "Must have instantiated a Contract instance") + self.implContract8(inst) + + js = inst.as_json() + self.assertEqual("Contract", js["resourceType"]) + inst2 = contract.Contract(js) + self.implContract8(inst2) + + def implContract8(self, inst): self.assertEqual(inst.friendly[0].contentAttachment.title, "The terms of the consent in friendly consumer speak.") self.assertEqual(inst.id, "pcd-example-notThis") self.assertEqual(inst.issued.date, FHIRDate("2015-11-18").date) self.assertEqual(inst.issued.as_json(), "2015-11-18") self.assertEqual(inst.legal[0].contentAttachment.title, "The terms of the consent in lawyer speak.") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.subType[0].coding[0].code, "Opt-In") self.assertEqual(inst.subType[0].coding[0].display, "Default Authorization with exceptions.") self.assertEqual(inst.subType[0].coding[0].system, "http://www.infoway-inforoute.ca.org/Consent-subtype-codes") - self.assertEqual(inst.term[0].text, "Withhold this order and any results or related objects from any provider.") + self.assertEqual(inst.term[0].applies.start.date, FHIRDate("2015-11-18").date) + self.assertEqual(inst.term[0].applies.start.as_json(), "2015-11-18") + self.assertEqual(inst.term[0].identifier.system, "http://example.org/fhir/term-items") + self.assertEqual(inst.term[0].identifier.value, "3347689") + self.assertEqual(inst.term[0].issued.date, FHIRDate("2015-11-01").date) + self.assertEqual(inst.term[0].issued.as_json(), "2015-11-01") + self.assertEqual(inst.term[0].offer.text, "Withhold this order and any results or related objects from any provider.") self.assertEqual(inst.term[0].type.coding[0].code, "withhold-identified-object-and-related") self.assertEqual(inst.term[0].type.coding[0].display, "Withhold the identified object and any other resources that are related to this object.") self.assertEqual(inst.term[0].type.coding[0].system, "http://example.org/fhir/consent-term-type-codes") diff --git a/fhirclient/models/contributor.py b/fhirclient/models/contributor.py index a157be2f3..138f636c2 100644 --- a/fhirclient/models/contributor.py +++ b/fhirclient/models/contributor.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Contributor) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Contributor) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/count.py b/fhirclient/models/count.py index b70872a9e..28e8a9336 100644 --- a/fhirclient/models/count.py +++ b/fhirclient/models/count.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Count) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Count) on 2019-05-07. +# 2019, SMART Health IT. from . import quantity diff --git a/fhirclient/models/coverage.py b/fhirclient/models/coverage.py index 3fcd96613..f061e64dd 100644 --- a/fhirclient/models/coverage.py +++ b/fhirclient/models/coverage.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Coverage) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Coverage) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,7 +11,7 @@ class Coverage(domainresource.DomainResource): """ Insurance or medical plan or a payment agreement. Financial instrument which may be used to reimburse or pay for health care - products and services. + products and services. Includes both insurance and self-payment. """ resource_type = "Coverage" @@ -25,23 +25,27 @@ def __init__(self, jsondict=None, strict=True): """ self.beneficiary = None - """ Plan Beneficiary. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + """ Plan beneficiary. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.class_fhir = None + """ Additional coverage classifications. + List of `CoverageClass` items (represented as `dict` in JSON). """ self.contract = None """ Contract details. - List of `FHIRReference` items referencing `Contract` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.costToBeneficiary = None + """ Patient payments for services/products. + List of `CoverageCostToBeneficiary` items (represented as `dict` in JSON). """ self.dependent = None """ Dependent number. Type `str`. """ - self.grouping = None - """ Additional coverage classifications. - Type `CoverageGrouping` (represented as `dict` in JSON). """ - self.identifier = None - """ The primary coverage ID. + """ Business Identifier for the coverage. List of `Identifier` items (represented as `dict` in JSON). """ self.network = None @@ -53,8 +57,8 @@ def __init__(self, jsondict=None, strict=True): Type `int`. """ self.payor = None - """ Identifier for the plan or agreement issuer. - List of `FHIRReference` items referencing `Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ + """ Issuer of the policy. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.period = None """ Coverage start and end dates. @@ -62,30 +66,30 @@ def __init__(self, jsondict=None, strict=True): self.policyHolder = None """ Owner of the policy. - Type `FHIRReference` referencing `Patient, RelatedPerson, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.relationship = None - """ Beneficiary relationship to the Subscriber. + """ Beneficiary relationship to the subscriber. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.sequence = None - """ The plan instance or sequence counter. - Type `str`. """ - self.status = None """ active | cancelled | draft | entered-in-error. Type `str`. """ + self.subrogation = None + """ Reimbursement to insurer. + Type `bool`. """ + self.subscriber = None """ Subscriber to the policy. - Type `FHIRReference` referencing `Patient, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.subscriberId = None - """ ID assigned to the Subscriber. + """ ID assigned to the subscriber. Type `str`. """ self.type = None - """ Type of coverage such as medical or accident. + """ Coverage category such as medical or accident. Type `CodeableConcept` (represented as `dict` in JSON). """ super(Coverage, self).__init__(jsondict=jsondict, strict=strict) @@ -93,19 +97,20 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(Coverage, self).elementProperties() js.extend([ - ("beneficiary", "beneficiary", fhirreference.FHIRReference, False, None, False), + ("beneficiary", "beneficiary", fhirreference.FHIRReference, False, None, True), + ("class_fhir", "class", CoverageClass, True, None, False), ("contract", "contract", fhirreference.FHIRReference, True, None, False), + ("costToBeneficiary", "costToBeneficiary", CoverageCostToBeneficiary, True, None, False), ("dependent", "dependent", str, False, None, False), - ("grouping", "grouping", CoverageGrouping, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("network", "network", str, False, None, False), ("order", "order", int, False, None, False), - ("payor", "payor", fhirreference.FHIRReference, True, None, False), + ("payor", "payor", fhirreference.FHIRReference, True, None, True), ("period", "period", period.Period, False, None, False), ("policyHolder", "policyHolder", fhirreference.FHIRReference, False, None, False), ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), - ("sequence", "sequence", str, False, None, False), - ("status", "status", str, False, None, False), + ("status", "status", str, False, None, True), + ("subrogation", "subrogation", bool, False, None, False), ("subscriber", "subscriber", fhirreference.FHIRReference, False, None, False), ("subscriberId", "subscriberId", str, False, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), @@ -115,14 +120,13 @@ def elementProperties(self): from . import backboneelement -class CoverageGrouping(backboneelement.BackboneElement): +class CoverageClass(backboneelement.BackboneElement): """ Additional coverage classifications. - A suite of underwrite specific classifiers, for example may be used to - identify a class of coverage or employer group, Policy, Plan. + A suite of underwriter specific classifiers. """ - resource_type = "CoverageGrouping" + resource_type = "CoverageClass" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -132,71 +136,109 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.classDisplay = None - """ Display text for the class. + self.name = None + """ Human readable description of the type and value. Type `str`. """ - self.class_fhir = None - """ An identifier for the class. - Type `str`. """ + self.type = None + """ Type of class such as 'group' or 'plan'. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.group = None - """ An identifier for the group. + self.value = None + """ Value associated with the type. Type `str`. """ - self.groupDisplay = None - """ Display text for an identifier for the group. - Type `str`. """ + super(CoverageClass, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageClass, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("value", "value", str, False, None, True), + ]) + return js + + +class CoverageCostToBeneficiary(backboneelement.BackboneElement): + """ Patient payments for services/products. + + A suite of codes indicating the cost category and associated amount which + have been detailed in the policy and may have been included on the health + card. + """ + + resource_type = "CoverageCostToBeneficiary" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. - self.plan = None - """ An identifier for the plan. - Type `str`. """ + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ - self.planDisplay = None - """ Display text for the plan. - Type `str`. """ + self.exception = None + """ Exceptions for patient payments. + List of `CoverageCostToBeneficiaryException` items (represented as `dict` in JSON). """ - self.subClass = None - """ An identifier for the subsection of the class. - Type `str`. """ + self.type = None + """ Cost category. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.subClassDisplay = None - """ Display text for the subsection of the subclass. - Type `str`. """ + self.valueMoney = None + """ The amount or percentage due from the beneficiary. + Type `Money` (represented as `dict` in JSON). """ - self.subGroup = None - """ An identifier for the subsection of the group. - Type `str`. """ + self.valueQuantity = None + """ The amount or percentage due from the beneficiary. + Type `Quantity` (represented as `dict` in JSON). """ - self.subGroupDisplay = None - """ Display text for the subsection of the group. - Type `str`. """ + super(CoverageCostToBeneficiary, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageCostToBeneficiary, self).elementProperties() + js.extend([ + ("exception", "exception", CoverageCostToBeneficiaryException, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("valueMoney", "valueMoney", money.Money, False, "value", True), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), + ]) + return js + + +class CoverageCostToBeneficiaryException(backboneelement.BackboneElement): + """ Exceptions for patient payments. + + A suite of codes indicating exceptions or reductions to patient costs and + their effective periods. + """ + + resource_type = "CoverageCostToBeneficiaryException" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. - self.subPlan = None - """ An identifier for the subsection of the plan. - Type `str`. """ + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ - self.subPlanDisplay = None - """ Display text for the subsection of the plan. - Type `str`. """ + self.period = None + """ The effective period of the exception. + Type `Period` (represented as `dict` in JSON). """ - super(CoverageGrouping, self).__init__(jsondict=jsondict, strict=strict) + self.type = None + """ Exception category. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(CoverageCostToBeneficiaryException, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(CoverageGrouping, self).elementProperties() + js = super(CoverageCostToBeneficiaryException, self).elementProperties() js.extend([ - ("classDisplay", "classDisplay", str, False, None, False), - ("class_fhir", "class", str, False, None, False), - ("group", "group", str, False, None, False), - ("groupDisplay", "groupDisplay", str, False, None, False), - ("plan", "plan", str, False, None, False), - ("planDisplay", "planDisplay", str, False, None, False), - ("subClass", "subClass", str, False, None, False), - ("subClassDisplay", "subClassDisplay", str, False, None, False), - ("subGroup", "subGroup", str, False, None, False), - ("subGroupDisplay", "subGroupDisplay", str, False, None, False), - ("subPlan", "subPlan", str, False, None, False), - ("subPlanDisplay", "subPlanDisplay", str, False, None, False), + ("period", "period", period.Period, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), ]) return js @@ -214,7 +256,15 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] +try: + from . import money +except ImportError: + money = sys.modules[__package__ + '.money'] try: from . import period except ImportError: period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/coverage_tests.py b/fhirclient/models/coverage_tests.py index 94f2d377d..28fdf27ca 100644 --- a/fhirclient/models/coverage_tests.py +++ b/fhirclient/models/coverage_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,16 +32,35 @@ def testCoverage1(self): self.implCoverage1(inst2) def implCoverage1(self, inst): + self.assertEqual(inst.class_fhir[0].name, "Western Airlines") + self.assertEqual(inst.class_fhir[0].type.coding[0].code, "group") + self.assertEqual(inst.class_fhir[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[0].value, "WESTAIR") + self.assertEqual(inst.class_fhir[1].name, "Full Coverage: Medical, Dental, Pharmacy, Vision, EHC") + self.assertEqual(inst.class_fhir[1].type.coding[0].code, "plan") + self.assertEqual(inst.class_fhir[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[1].value, "BG4352") + self.assertEqual(inst.class_fhir[2].name, "Platinum") + self.assertEqual(inst.class_fhir[2].type.coding[0].code, "subplan") + self.assertEqual(inst.class_fhir[2].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[2].value, "D15C9") + self.assertEqual(inst.costToBeneficiary[0].exception[0].period.end.date, FHIRDate("2018-12-31").date) + self.assertEqual(inst.costToBeneficiary[0].exception[0].period.end.as_json(), "2018-12-31") + self.assertEqual(inst.costToBeneficiary[0].exception[0].period.start.date, FHIRDate("2018-01-01").date) + self.assertEqual(inst.costToBeneficiary[0].exception[0].period.start.as_json(), "2018-01-01") + self.assertEqual(inst.costToBeneficiary[0].exception[0].type.coding[0].code, "retired") + self.assertEqual(inst.costToBeneficiary[0].exception[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-coverage-financial-exception") + self.assertEqual(inst.costToBeneficiary[0].type.coding[0].code, "gpvisit") + self.assertEqual(inst.costToBeneficiary[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-copay-type") + self.assertEqual(inst.costToBeneficiary[0].valueMoney.currency, "USD") + self.assertEqual(inst.costToBeneficiary[0].valueMoney.value, 20.0) self.assertEqual(inst.dependent, "1") - self.assertEqual(inst.grouping.group, "WESTAIR") - self.assertEqual(inst.grouping.groupDisplay, "Western Airlines") - self.assertEqual(inst.grouping.plan, "WESTAIR") - self.assertEqual(inst.grouping.planDisplay, "Western Airlines") - self.assertEqual(inst.grouping.subPlan, "D15C9") - self.assertEqual(inst.grouping.subPlanDisplay, "Platinum") self.assertEqual(inst.id, "7546D") self.assertEqual(inst.identifier[0].system, "http://xyz.com/codes/identifier") self.assertEqual(inst.identifier[0].value, "AB98761") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.network, "5") self.assertEqual(inst.order, 2) self.assertEqual(inst.period.end.date, FHIRDate("2012-03-17").date) @@ -55,10 +74,10 @@ def implCoverage1(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "EHCPOL") self.assertEqual(inst.type.coding[0].display, "extended healthcare") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") def testCoverage2(self): - inst = self.instantiate_from("coverage-example-ehic.json") + inst = self.instantiate_from("coverage-example-selfpay.json") self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") self.implCoverage2(inst) @@ -68,21 +87,24 @@ def testCoverage2(self): self.implCoverage2(inst2) def implCoverage2(self, inst): - self.assertEqual(inst.id, "7547E") - self.assertEqual(inst.identifier[0].system, "http://ehic.com/insurer/123456789/member") - self.assertEqual(inst.identifier[0].value, "A123456780") + self.assertEqual(inst.id, "SP1234") + self.assertEqual(inst.identifier[0].system, "http://hospitalx.com/selfpayagreement") + self.assertEqual(inst.identifier[0].value, "SP12345678") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2012-03-17").date) self.assertEqual(inst.period.end.as_json(), "2012-03-17") self.assertEqual(inst.relationship.coding[0].code, "self") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the European Health Insurance Card
") + self.assertEqual(inst.text.div, "
A human-readable rendering of a Self Pay Agreement.
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "EHCPOL") - self.assertEqual(inst.type.coding[0].display, "extended healthcare") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.type.coding[0].code, "pay") + self.assertEqual(inst.type.coding[0].display, "PAY") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-selfpay") def testCoverage3(self): - inst = self.instantiate_from("coverage-example-selfpay.json") + inst = self.instantiate_from("coverage-example-ehic.json") self.assertIsNotNone(inst, "Must have instantiated a Coverage instance") self.implCoverage3(inst) @@ -92,18 +114,21 @@ def testCoverage3(self): self.implCoverage3(inst2) def implCoverage3(self, inst): - self.assertEqual(inst.id, "SP1234") - self.assertEqual(inst.identifier[0].system, "http://hospitalx.com/selfpayagreement") - self.assertEqual(inst.identifier[0].value, "SP12345678") + self.assertEqual(inst.id, "7547E") + self.assertEqual(inst.identifier[0].system, "http://ehic.com/insurer/123456789/member") + self.assertEqual(inst.identifier[0].value, "A123456780") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2012-03-17").date) self.assertEqual(inst.period.end.as_json(), "2012-03-17") self.assertEqual(inst.relationship.coding[0].code, "self") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of a Self Pay Agreement.
") + self.assertEqual(inst.text.div, "
A human-readable rendering of the European Health Insurance Card
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "pay") - self.assertEqual(inst.type.coding[0].display, "PAY") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/coverage-selfpay") + self.assertEqual(inst.type.coding[0].code, "EHCPOL") + self.assertEqual(inst.type.coding[0].display, "extended healthcare") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") def testCoverage4(self): inst = self.instantiate_from("coverage-example.json") @@ -116,32 +141,58 @@ def testCoverage4(self): self.implCoverage4(inst2) def implCoverage4(self, inst): + self.assertEqual(inst.class_fhir[0].name, "Corporate Baker's Inc. Local #35") + self.assertEqual(inst.class_fhir[0].type.coding[0].code, "group") + self.assertEqual(inst.class_fhir[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[0].value, "CB135") + self.assertEqual(inst.class_fhir[1].name, "Trainee Part-time Benefits") + self.assertEqual(inst.class_fhir[1].type.coding[0].code, "subgroup") + self.assertEqual(inst.class_fhir[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[1].value, "123") + self.assertEqual(inst.class_fhir[2].name, "Full Coverage: Medical, Dental, Pharmacy, Vision, EHC") + self.assertEqual(inst.class_fhir[2].type.coding[0].code, "plan") + self.assertEqual(inst.class_fhir[2].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[2].value, "B37FC") + self.assertEqual(inst.class_fhir[3].name, "Includes afterlife benefits") + self.assertEqual(inst.class_fhir[3].type.coding[0].code, "subplan") + self.assertEqual(inst.class_fhir[3].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[3].value, "P7") + self.assertEqual(inst.class_fhir[4].name, "Silver: Family Plan spouse only") + self.assertEqual(inst.class_fhir[4].type.coding[0].code, "class") + self.assertEqual(inst.class_fhir[4].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[4].value, "SILVER") + self.assertEqual(inst.class_fhir[5].name, "Low deductable, max $20 copay") + self.assertEqual(inst.class_fhir[5].type.coding[0].code, "subclass") + self.assertEqual(inst.class_fhir[5].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[5].value, "Tier2") + self.assertEqual(inst.class_fhir[6].type.coding[0].code, "sequence") + self.assertEqual(inst.class_fhir[6].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[6].value, "9") + self.assertEqual(inst.class_fhir[7].type.coding[0].code, "rxid") + self.assertEqual(inst.class_fhir[7].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[7].value, "MDF12345") + self.assertEqual(inst.class_fhir[8].type.coding[0].code, "rxbin") + self.assertEqual(inst.class_fhir[8].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[8].value, "987654") + self.assertEqual(inst.class_fhir[9].type.coding[0].code, "rxgroup") + self.assertEqual(inst.class_fhir[9].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/coverage-class") + self.assertEqual(inst.class_fhir[9].value, "M35PT") self.assertEqual(inst.dependent, "0") - self.assertEqual(inst.grouping.classDisplay, "Silver: Family Plan spouse only") - self.assertEqual(inst.grouping.class_fhir, "SILVER") - self.assertEqual(inst.grouping.group, "CBI35") - self.assertEqual(inst.grouping.groupDisplay, "Corporate Baker's Inc. Local #35") - self.assertEqual(inst.grouping.plan, "B37FC") - self.assertEqual(inst.grouping.planDisplay, "Full Coverage: Medical, Dental, Pharmacy, Vision, EHC") - self.assertEqual(inst.grouping.subClass, "Tier2") - self.assertEqual(inst.grouping.subClassDisplay, "Low deductable, max $20 copay") - self.assertEqual(inst.grouping.subGroup, "123") - self.assertEqual(inst.grouping.subGroupDisplay, "Trainee Part-time Benefits") - self.assertEqual(inst.grouping.subPlan, "P7") - self.assertEqual(inst.grouping.subPlanDisplay, "Includes afterlife benefits") self.assertEqual(inst.id, "9876B1") self.assertEqual(inst.identifier[0].system, "http://benefitsinc.com/certificate") self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2012-05-23").date) self.assertEqual(inst.period.end.as_json(), "2012-05-23") self.assertEqual(inst.period.start.date, FHIRDate("2011-05-23").date) self.assertEqual(inst.period.start.as_json(), "2011-05-23") self.assertEqual(inst.relationship.coding[0].code, "self") - self.assertEqual(inst.sequence, "9") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
A human-readable rendering of the coverage
") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "EHCPOL") self.assertEqual(inst.type.coding[0].display, "extended healthcare") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") diff --git a/fhirclient/models/coverageeligibilityrequest.py b/fhirclient/models/coverageeligibilityrequest.py new file mode 100644 index 000000000..f0a0fd213 --- /dev/null +++ b/fhirclient/models/coverageeligibilityrequest.py @@ -0,0 +1,337 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CoverageEligibilityRequest) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class CoverageEligibilityRequest(domainresource.DomainResource): + """ CoverageEligibilityRequest resource. + + The CoverageEligibilityRequest provides patient and insurance coverage + information to an insurer for them to respond, in the form of an + CoverageEligibilityResponse, with information regarding whether the stated + coverage is valid and in-force and optionally to provide the insurance + details of the policy. + """ + + resource_type = "CoverageEligibilityRequest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.created = None + """ Creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.enterer = None + """ Author. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.facility = None + """ Servicing facility. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier for coverage eligiblity request. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.insurance = None + """ Patient insurance information. + List of `CoverageEligibilityRequestInsurance` items (represented as `dict` in JSON). """ + + self.insurer = None + """ Coverage issuer. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.item = None + """ Item to be evaluated for eligibiity. + List of `CoverageEligibilityRequestItem` items (represented as `dict` in JSON). """ + + self.patient = None + """ Intended recipient of products and services. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.priority = None + """ Desired processing priority. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.provider = None + """ Party responsible for the request. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.purpose = None + """ auth-requirements | benefits | discovery | validation. + List of `str` items. """ + + self.servicedDate = None + """ Estimated date or dates of service. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.servicedPeriod = None + """ Estimated date or dates of service. + Type `Period` (represented as `dict` in JSON). """ + + self.status = None + """ active | cancelled | draft | entered-in-error. + Type `str`. """ + + self.supportingInfo = None + """ Supporting information. + List of `CoverageEligibilityRequestSupportingInfo` items (represented as `dict` in JSON). """ + + super(CoverageEligibilityRequest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageEligibilityRequest, self).elementProperties() + js.extend([ + ("created", "created", fhirdate.FHIRDate, False, None, True), + ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), + ("facility", "facility", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("insurance", "insurance", CoverageEligibilityRequestInsurance, True, None, False), + ("insurer", "insurer", fhirreference.FHIRReference, False, None, True), + ("item", "item", CoverageEligibilityRequestItem, True, None, False), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("purpose", "purpose", str, True, None, True), + ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), + ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), + ("status", "status", str, False, None, True), + ("supportingInfo", "supportingInfo", CoverageEligibilityRequestSupportingInfo, True, None, False), + ]) + return js + + +from . import backboneelement + +class CoverageEligibilityRequestInsurance(backboneelement.BackboneElement): + """ Patient insurance information. + + Financial instruments for reimbursement for the health care products and + services. + """ + + resource_type = "CoverageEligibilityRequestInsurance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.businessArrangement = None + """ Additional provider contract number. + Type `str`. """ + + self.coverage = None + """ Insurance information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.focal = None + """ Applicable coverage. + Type `bool`. """ + + super(CoverageEligibilityRequestInsurance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageEligibilityRequestInsurance, self).elementProperties() + js.extend([ + ("businessArrangement", "businessArrangement", str, False, None, False), + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("focal", "focal", bool, False, None, False), + ]) + return js + + +class CoverageEligibilityRequestItem(backboneelement.BackboneElement): + """ Item to be evaluated for eligibiity. + + Service categories or billable services for which benefit details and/or an + authorization prior to service delivery may be required by the payor. + """ + + resource_type = "CoverageEligibilityRequestItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.category = None + """ Benefit classification. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.detail = None + """ Product or service details. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.diagnosis = None + """ Applicable diagnosis. + List of `CoverageEligibilityRequestItemDiagnosis` items (represented as `dict` in JSON). """ + + self.facility = None + """ Servicing facility. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.modifier = None + """ Product or service billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.provider = None + """ Perfoming practitioner. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.supportingInfoSequence = None + """ Applicable exception or supporting information. + List of `int` items. """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(CoverageEligibilityRequestItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageEligibilityRequestItem, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ("diagnosis", "diagnosis", CoverageEligibilityRequestItemDiagnosis, True, None, False), + ("facility", "facility", fhirreference.FHIRReference, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("supportingInfoSequence", "supportingInfoSequence", int, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class CoverageEligibilityRequestItemDiagnosis(backboneelement.BackboneElement): + """ Applicable diagnosis. + + Patient diagnosis for which care is sought. + """ + + resource_type = "CoverageEligibilityRequestItemDiagnosis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.diagnosisCodeableConcept = None + """ Nature of illness or problem. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diagnosisReference = None + """ Nature of illness or problem. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(CoverageEligibilityRequestItemDiagnosis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageEligibilityRequestItemDiagnosis, self).elementProperties() + js.extend([ + ("diagnosisCodeableConcept", "diagnosisCodeableConcept", codeableconcept.CodeableConcept, False, "diagnosis", False), + ("diagnosisReference", "diagnosisReference", fhirreference.FHIRReference, False, "diagnosis", False), + ]) + return js + + +class CoverageEligibilityRequestSupportingInfo(backboneelement.BackboneElement): + """ Supporting information. + + Additional information codes regarding exceptions, special considerations, + the condition, situation, prior or concurrent issues. + """ + + resource_type = "CoverageEligibilityRequestSupportingInfo" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.appliesToAll = None + """ Applies to all items. + Type `bool`. """ + + self.information = None + """ Data to be provided. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.sequence = None + """ Information instance identifier. + Type `int`. """ + + super(CoverageEligibilityRequestSupportingInfo, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(CoverageEligibilityRequestSupportingInfo, self).elementProperties() + js.extend([ + ("appliesToAll", "appliesToAll", bool, False, None, False), + ("information", "information", fhirreference.FHIRReference, False, None, True), + ("sequence", "sequence", int, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import money +except ImportError: + money = sys.modules[__package__ + '.money'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/coverageeligibilityrequest_tests.py b/fhirclient/models/coverageeligibilityrequest_tests.py new file mode 100644 index 000000000..a5cad2454 --- /dev/null +++ b/fhirclient/models/coverageeligibilityrequest_tests.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import coverageeligibilityrequest +from .fhirdate import FHIRDate + + +class CoverageEligibilityRequestTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("CoverageEligibilityRequest", js["resourceType"]) + return coverageeligibilityrequest.CoverageEligibilityRequest(js) + + def testCoverageEligibilityRequest1(self): + inst = self.instantiate_from("coverageeligibilityrequest-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CoverageEligibilityRequest instance") + self.implCoverageEligibilityRequest1(inst) + + js = inst.as_json() + self.assertEqual("CoverageEligibilityRequest", js["resourceType"]) + inst2 = coverageeligibilityrequest.CoverageEligibilityRequest(js) + self.implCoverageEligibilityRequest1(inst2) + + def implCoverageEligibilityRequest1(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.id, "52345") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/coverageelegibilityrequest") + self.assertEqual(inst.identifier[0].value, "52345") + self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority.coding[0].code, "normal") + self.assertEqual(inst.purpose[0], "validation") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the CoverageEligibilityRequest
") + self.assertEqual(inst.text.status, "generated") + + def testCoverageEligibilityRequest2(self): + inst = self.instantiate_from("coverageeligibilityrequest-example-2.json") + self.assertIsNotNone(inst, "Must have instantiated a CoverageEligibilityRequest instance") + self.implCoverageEligibilityRequest2(inst) + + js = inst.as_json() + self.assertEqual("CoverageEligibilityRequest", js["resourceType"]) + inst2 = coverageeligibilityrequest.CoverageEligibilityRequest(js) + self.implCoverageEligibilityRequest2(inst2) + + def implCoverageEligibilityRequest2(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.id, "52346") + self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/coverageelegibilityrequest") + self.assertEqual(inst.identifier[0].value, "52346") + self.assertEqual(inst.insurance[0].businessArrangement, "NB8742") + self.assertEqual(inst.item[0].category.coding[0].code, "69") + self.assertEqual(inst.item[0].category.coding[0].display, "Maternity") + self.assertEqual(inst.item[0].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority.coding[0].code, "normal") + self.assertEqual(inst.purpose[0], "validation") + self.assertEqual(inst.purpose[1], "benefits") + self.assertEqual(inst.servicedDate.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.servicedDate.as_json(), "2014-09-17") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the CoverageEligibilityRequest
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/eligibilityresponse.py b/fhirclient/models/coverageeligibilityresponse.py similarity index 51% rename from fhirclient/models/eligibilityresponse.py rename to fhirclient/models/coverageeligibilityresponse.py index 90711efd5..25d924cd4 100644 --- a/fhirclient/models/eligibilityresponse.py +++ b/fhirclient/models/coverageeligibilityresponse.py @@ -1,20 +1,20 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CoverageEligibilityResponse) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource -class EligibilityResponse(domainresource.DomainResource): - """ EligibilityResponse resource. +class CoverageEligibilityResponse(domainresource.DomainResource): + """ CoverageEligibilityResponse resource. This resource provides eligibility and plan details from the processing of - an Eligibility resource. + an CoverageEligibilityRequest resource. """ - resource_type = "EligibilityResponse" + resource_type = "CoverageEligibilityResponse" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -25,7 +25,7 @@ def __init__(self, jsondict=None, strict=True): """ self.created = None - """ Creation date. + """ Response creation date. Type `FHIRDate` (represented as `str` in JSON). """ self.disposition = None @@ -34,79 +34,94 @@ def __init__(self, jsondict=None, strict=True): self.error = None """ Processing errors. - List of `EligibilityResponseError` items (represented as `dict` in JSON). """ + List of `CoverageEligibilityResponseError` items (represented as `dict` in JSON). """ self.form = None - """ Printed Form Identifier. + """ Printed form identifier. Type `CodeableConcept` (represented as `dict` in JSON). """ self.identifier = None - """ Business Identifier. + """ Business Identifier for coverage eligiblity request. List of `Identifier` items (represented as `dict` in JSON). """ - self.inforce = None - """ Coverage inforce indicator. - Type `bool`. """ - self.insurance = None - """ Details by insurance coverage. - List of `EligibilityResponseInsurance` items (represented as `dict` in JSON). """ + """ Patient insurance information. + List of `CoverageEligibilityResponseInsurance` items (represented as `dict` in JSON). """ self.insurer = None - """ Insurer issuing the coverage. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Coverage issuer. + Type `FHIRReference` (represented as `dict` in JSON). """ self.outcome = None - """ complete | error | partial. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ queued | complete | error | partial. + Type `str`. """ + + self.patient = None + """ Intended recipient of products and services. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.preAuthRef = None + """ Preauthorization reference. + Type `str`. """ + + self.purpose = None + """ auth-requirements | benefits | discovery | validation. + List of `str` items. """ self.request = None - """ Eligibility reference. - Type `FHIRReference` referencing `EligibilityRequest` (represented as `dict` in JSON). """ + """ Eligibility request reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.requestor = None + """ Party responsible for the request. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.requestOrganization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + self.servicedDate = None + """ Estimated date or dates of service. + Type `FHIRDate` (represented as `str` in JSON). """ - self.requestProvider = None - """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + self.servicedPeriod = None + """ Estimated date or dates of service. + Type `Period` (represented as `dict` in JSON). """ self.status = None """ active | cancelled | draft | entered-in-error. Type `str`. """ - super(EligibilityResponse, self).__init__(jsondict=jsondict, strict=strict) + super(CoverageEligibilityResponse, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(EligibilityResponse, self).elementProperties() + js = super(CoverageEligibilityResponse, self).elementProperties() js.extend([ - ("created", "created", fhirdate.FHIRDate, False, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, True), ("disposition", "disposition", str, False, None, False), - ("error", "error", EligibilityResponseError, True, None, False), + ("error", "error", CoverageEligibilityResponseError, True, None, False), ("form", "form", codeableconcept.CodeableConcept, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("inforce", "inforce", bool, False, None, False), - ("insurance", "insurance", EligibilityResponseInsurance, True, None, False), - ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), - ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), - ("request", "request", fhirreference.FHIRReference, False, None, False), - ("requestOrganization", "requestOrganization", fhirreference.FHIRReference, False, None, False), - ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), + ("insurance", "insurance", CoverageEligibilityResponseInsurance, True, None, False), + ("insurer", "insurer", fhirreference.FHIRReference, False, None, True), + ("outcome", "outcome", str, False, None, True), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("preAuthRef", "preAuthRef", str, False, None, False), + ("purpose", "purpose", str, True, None, True), + ("request", "request", fhirreference.FHIRReference, False, None, True), + ("requestor", "requestor", fhirreference.FHIRReference, False, None, False), + ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), + ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), + ("status", "status", str, False, None, True), ]) return js from . import backboneelement -class EligibilityResponseError(backboneelement.BackboneElement): +class CoverageEligibilityResponseError(backboneelement.BackboneElement): """ Processing errors. - Mutually exclusive with Services Provided (Item). + Errors encountered during the processing of the request. """ - resource_type = "EligibilityResponseError" + resource_type = "CoverageEligibilityResponseError" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -120,24 +135,24 @@ def __init__(self, jsondict=None, strict=True): """ Error code detailing processing issues. Type `CodeableConcept` (represented as `dict` in JSON). """ - super(EligibilityResponseError, self).__init__(jsondict=jsondict, strict=strict) + super(CoverageEligibilityResponseError, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(EligibilityResponseError, self).elementProperties() + js = super(CoverageEligibilityResponseError, self).elementProperties() js.extend([ ("code", "code", codeableconcept.CodeableConcept, False, None, True), ]) return js -class EligibilityResponseInsurance(backboneelement.BackboneElement): - """ Details by insurance coverage. +class CoverageEligibilityResponseInsurance(backboneelement.BackboneElement): + """ Patient insurance information. - The insurer may provide both the details for the requested coverage as well - as details for additional coverages known to the insurer. + Financial instruments for reimbursement for the health care products and + services. """ - resource_type = "EligibilityResponseInsurance" + resource_type = "CoverageEligibilityResponseInsurance" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -147,37 +162,43 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.benefitBalance = None - """ Benefits by Category. - List of `EligibilityResponseInsuranceBenefitBalance` items (represented as `dict` in JSON). """ - - self.contract = None - """ Contract details. - Type `FHIRReference` referencing `Contract` (represented as `dict` in JSON). """ + self.benefitPeriod = None + """ When the benefits are applicable. + Type `Period` (represented as `dict` in JSON). """ self.coverage = None - """ Updated Coverage details. - Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + """ Insurance information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.inforce = None + """ Coverage inforce indicator. + Type `bool`. """ + + self.item = None + """ Benefits and authorization details. + List of `CoverageEligibilityResponseInsuranceItem` items (represented as `dict` in JSON). """ - super(EligibilityResponseInsurance, self).__init__(jsondict=jsondict, strict=strict) + super(CoverageEligibilityResponseInsurance, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(EligibilityResponseInsurance, self).elementProperties() + js = super(CoverageEligibilityResponseInsurance, self).elementProperties() js.extend([ - ("benefitBalance", "benefitBalance", EligibilityResponseInsuranceBenefitBalance, True, None, False), - ("contract", "contract", fhirreference.FHIRReference, False, None, False), - ("coverage", "coverage", fhirreference.FHIRReference, False, None, False), + ("benefitPeriod", "benefitPeriod", period.Period, False, None, False), + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("inforce", "inforce", bool, False, None, False), + ("item", "item", CoverageEligibilityResponseInsuranceItem, True, None, False), ]) return js -class EligibilityResponseInsuranceBenefitBalance(backboneelement.BackboneElement): - """ Benefits by Category. +class CoverageEligibilityResponseInsuranceItem(backboneelement.BackboneElement): + """ Benefits and authorization details. - Benefits and optionally current balances by Category. + Benefits and optionally current balances, and authorization details by + category or service. """ - resource_type = "EligibilityResponseInsuranceBenefitBalance" + resource_type = "CoverageEligibilityResponseInsuranceItem" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -187,8 +208,24 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.authorizationRequired = None + """ Authorization required flag. + Type `bool`. """ + + self.authorizationSupporting = None + """ Type of required supporting materials. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.authorizationUrl = None + """ Preauthorization requirements endpoint. + Type `str`. """ + + self.benefit = None + """ Benefit Summary. + List of `CoverageEligibilityResponseInsuranceItemBenefit` items (represented as `dict` in JSON). """ + self.category = None - """ Type of services covered. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.description = None @@ -199,9 +236,9 @@ def __init__(self, jsondict=None, strict=True): """ Excluded from the plan. Type `bool`. """ - self.financial = None - """ Benefit Summary. - List of `EligibilityResponseInsuranceBenefitBalanceFinancial` items (represented as `dict` in JSON). """ + self.modifier = None + """ Product or service billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.name = None """ Short name for the benefit. @@ -211,10 +248,14 @@ def __init__(self, jsondict=None, strict=True): """ In or out of network. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.subCategory = None - """ Detailed services covered within the type. + self.productOrService = None + """ Billing, service, product, or drug code. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.provider = None + """ Performing practitioner. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.term = None """ Annual or lifetime. Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -223,31 +264,36 @@ def __init__(self, jsondict=None, strict=True): """ Individual or family. Type `CodeableConcept` (represented as `dict` in JSON). """ - super(EligibilityResponseInsuranceBenefitBalance, self).__init__(jsondict=jsondict, strict=strict) + super(CoverageEligibilityResponseInsuranceItem, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(EligibilityResponseInsuranceBenefitBalance, self).elementProperties() + js = super(CoverageEligibilityResponseInsuranceItem, self).elementProperties() js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("authorizationRequired", "authorizationRequired", bool, False, None, False), + ("authorizationSupporting", "authorizationSupporting", codeableconcept.CodeableConcept, True, None, False), + ("authorizationUrl", "authorizationUrl", str, False, None, False), + ("benefit", "benefit", CoverageEligibilityResponseInsuranceItemBenefit, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), ("description", "description", str, False, None, False), ("excluded", "excluded", bool, False, None, False), - ("financial", "financial", EligibilityResponseInsuranceBenefitBalanceFinancial, True, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), ("name", "name", str, False, None, False), ("network", "network", codeableconcept.CodeableConcept, False, None, False), - ("subCategory", "subCategory", codeableconcept.CodeableConcept, False, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, False), ("term", "term", codeableconcept.CodeableConcept, False, None, False), ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), ]) return js -class EligibilityResponseInsuranceBenefitBalanceFinancial(backboneelement.BackboneElement): +class CoverageEligibilityResponseInsuranceItemBenefit(backboneelement.BackboneElement): """ Benefit Summary. - Benefits Used to date. + Benefits used to date. """ - resource_type = "EligibilityResponseInsuranceBenefitBalanceFinancial" + resource_type = "CoverageEligibilityResponseInsuranceItemBenefit" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -270,27 +316,32 @@ def __init__(self, jsondict=None, strict=True): Type `int`. """ self.type = None - """ Deductable, visits, benefit amount. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.usedMoney = None """ Benefits used. Type `Money` (represented as `dict` in JSON). """ + self.usedString = None + """ Benefits used. + Type `str`. """ + self.usedUnsignedInt = None """ Benefits used. Type `int`. """ - super(EligibilityResponseInsuranceBenefitBalanceFinancial, self).__init__(jsondict=jsondict, strict=strict) + super(CoverageEligibilityResponseInsuranceItemBenefit, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(EligibilityResponseInsuranceBenefitBalanceFinancial, self).elementProperties() + js = super(CoverageEligibilityResponseInsuranceItemBenefit, self).elementProperties() js.extend([ ("allowedMoney", "allowedMoney", money.Money, False, "allowed", False), ("allowedString", "allowedString", str, False, "allowed", False), ("allowedUnsignedInt", "allowedUnsignedInt", int, False, "allowed", False), ("type", "type", codeableconcept.CodeableConcept, False, None, True), ("usedMoney", "usedMoney", money.Money, False, "used", False), + ("usedString", "usedString", str, False, "used", False), ("usedUnsignedInt", "usedUnsignedInt", int, False, "used", False), ]) return js @@ -317,3 +368,7 @@ def elementProperties(self): from . import money except ImportError: money = sys.modules[__package__ + '.money'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/coverageeligibilityresponse_tests.py b/fhirclient/models/coverageeligibilityresponse_tests.py new file mode 100644 index 000000000..4bf387ecb --- /dev/null +++ b/fhirclient/models/coverageeligibilityresponse_tests.py @@ -0,0 +1,257 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import coverageeligibilityresponse +from .fhirdate import FHIRDate + + +class CoverageEligibilityResponseTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("CoverageEligibilityResponse", js["resourceType"]) + return coverageeligibilityresponse.CoverageEligibilityResponse(js) + + def testCoverageEligibilityResponse1(self): + inst = self.instantiate_from("coverageeligibilityresponse-example.json") + self.assertIsNotNone(inst, "Must have instantiated a CoverageEligibilityResponse instance") + self.implCoverageEligibilityResponse1(inst) + + js = inst.as_json() + self.assertEqual("CoverageEligibilityResponse", js["resourceType"]) + inst2 = coverageeligibilityresponse.CoverageEligibilityResponse(js) + self.implCoverageEligibilityResponse1(inst2) + + def implCoverageEligibilityResponse1(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "Policy is currently in-force.") + self.assertEqual(inst.id, "E2500") + self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/coverageeligibilityresponse") + self.assertEqual(inst.identifier[0].value, "881234") + self.assertTrue(inst.insurance[0].inforce) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.purpose[0], "validation") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the CoverageEligibilityResponse.
") + self.assertEqual(inst.text.status, "generated") + + def testCoverageEligibilityResponse2(self): + inst = self.instantiate_from("coverageeligibilityresponse-example-error.json") + self.assertIsNotNone(inst, "Must have instantiated a CoverageEligibilityResponse instance") + self.implCoverageEligibilityResponse2(inst) + + js = inst.as_json() + self.assertEqual("CoverageEligibilityResponse", js["resourceType"]) + inst2 = coverageeligibilityresponse.CoverageEligibilityResponse(js) + self.implCoverageEligibilityResponse2(inst2) + + def implCoverageEligibilityResponse2(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-09-16").date) + self.assertEqual(inst.created.as_json(), "2014-09-16") + self.assertEqual(inst.disposition, "Eligibiliy request could not be processed, please address errors before submitting.") + self.assertEqual(inst.error[0].code.coding[0].code, "a001") + self.assertEqual(inst.error[0].code.coding[0].system, "http://terminology.hl7.org/CodeSystem/adjudication-error") + self.assertEqual(inst.form.coding[0].code, "ELRSP/2017/01") + self.assertEqual(inst.form.coding[0].system, "http://national.org/form") + self.assertEqual(inst.id, "E2503") + self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/coverageeligibilityresponse") + self.assertEqual(inst.identifier[0].value, "8812343") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "error") + self.assertEqual(inst.purpose[0], "validation") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the CoverageEligibilityResponse.
") + self.assertEqual(inst.text.status, "generated") + + def testCoverageEligibilityResponse3(self): + inst = self.instantiate_from("coverageeligibilityresponse-example-benefits-2.json") + self.assertIsNotNone(inst, "Must have instantiated a CoverageEligibilityResponse instance") + self.implCoverageEligibilityResponse3(inst) + + js = inst.as_json() + self.assertEqual("CoverageEligibilityResponse", js["resourceType"]) + inst2 = coverageeligibilityresponse.CoverageEligibilityResponse(js) + self.implCoverageEligibilityResponse3(inst2) + + def implCoverageEligibilityResponse3(self, inst): + self.assertEqual(inst.contained[0].id, "coverage-1") + self.assertEqual(inst.created.date, FHIRDate("2014-09-16").date) + self.assertEqual(inst.created.as_json(), "2014-09-16") + self.assertEqual(inst.disposition, "Policy is currently in-force.") + self.assertEqual(inst.form.coding[0].code, "ELRSP/2017/01") + self.assertEqual(inst.form.coding[0].system, "http://national.org/form") + self.assertEqual(inst.id, "E2502") + self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/coverageeligibilityresponse") + self.assertEqual(inst.identifier[0].value, "8812342") + self.assertTrue(inst.insurance[0].inforce) + self.assertEqual(inst.insurance[0].item[0].benefit[0].allowedMoney.currency, "USD") + self.assertEqual(inst.insurance[0].item[0].benefit[0].allowedMoney.value, 500000) + self.assertEqual(inst.insurance[0].item[0].benefit[0].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[0].benefit[0].usedMoney.currency, "USD") + self.assertEqual(inst.insurance[0].item[0].benefit[0].usedMoney.value, 3748.0) + self.assertEqual(inst.insurance[0].item[0].benefit[1].allowedMoney.currency, "USD") + self.assertEqual(inst.insurance[0].item[0].benefit[1].allowedMoney.value, 100) + self.assertEqual(inst.insurance[0].item[0].benefit[1].type.coding[0].code, "copay-maximum") + self.assertEqual(inst.insurance[0].item[0].benefit[2].allowedUnsignedInt, 20) + self.assertEqual(inst.insurance[0].item[0].benefit[2].type.coding[0].code, "copay-percent") + self.assertEqual(inst.insurance[0].item[0].category.coding[0].code, "30") + self.assertEqual(inst.insurance[0].item[0].category.coding[0].display, "Health Benefit Plan Coverage") + self.assertEqual(inst.insurance[0].item[0].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[0].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[0].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[0].term.coding[0].code, "annual") + self.assertEqual(inst.insurance[0].item[0].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[0].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[0].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.insurance[0].item[1].benefit[0].allowedMoney.currency, "USD") + self.assertEqual(inst.insurance[0].item[1].benefit[0].allowedMoney.value, 15000) + self.assertEqual(inst.insurance[0].item[1].benefit[0].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[1].category.coding[0].code, "69") + self.assertEqual(inst.insurance[0].item[1].category.coding[0].display, "Maternity") + self.assertEqual(inst.insurance[0].item[1].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[1].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[1].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[1].term.coding[0].code, "annual") + self.assertEqual(inst.insurance[0].item[1].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[1].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[1].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.insurance[0].item[2].benefit[0].allowedMoney.currency, "USD") + self.assertEqual(inst.insurance[0].item[2].benefit[0].allowedMoney.value, 2000) + self.assertEqual(inst.insurance[0].item[2].benefit[0].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[2].category.coding[0].code, "F3") + self.assertEqual(inst.insurance[0].item[2].category.coding[0].display, "Dental Coverage") + self.assertEqual(inst.insurance[0].item[2].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[2].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[2].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[2].term.coding[0].code, "annual") + self.assertEqual(inst.insurance[0].item[2].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[2].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[2].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.insurance[0].item[3].category.coding[0].code, "F6") + self.assertEqual(inst.insurance[0].item[3].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.insurance[0].item[3].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[3].description, "Vision products and services such as exams, glasses and contact lenses.") + self.assertTrue(inst.insurance[0].item[3].excluded) + self.assertEqual(inst.insurance[0].item[3].name, "Vision") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.purpose[0], "validation") + self.assertEqual(inst.purpose[1], "benefits") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the CoverageEligibilityResponse.
") + self.assertEqual(inst.text.status, "generated") + + def testCoverageEligibilityResponse4(self): + inst = self.instantiate_from("coverageeligibilityresponse-example-benefits.json") + self.assertIsNotNone(inst, "Must have instantiated a CoverageEligibilityResponse instance") + self.implCoverageEligibilityResponse4(inst) + + js = inst.as_json() + self.assertEqual("CoverageEligibilityResponse", js["resourceType"]) + inst2 = coverageeligibilityresponse.CoverageEligibilityResponse(js) + self.implCoverageEligibilityResponse4(inst2) + + def implCoverageEligibilityResponse4(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "Policy is currently in-force.") + self.assertEqual(inst.id, "E2501") + self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/coverageeligibilityresponse") + self.assertEqual(inst.identifier[0].value, "881234") + self.assertTrue(inst.insurance[0].inforce) + self.assertEqual(inst.insurance[0].item[0].benefit[0].allowedMoney.currency, "SAR") + self.assertEqual(inst.insurance[0].item[0].benefit[0].allowedMoney.value, 500000) + self.assertEqual(inst.insurance[0].item[0].benefit[0].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[0].benefit[1].allowedMoney.currency, "SAR") + self.assertEqual(inst.insurance[0].item[0].benefit[1].allowedMoney.value, 100) + self.assertEqual(inst.insurance[0].item[0].benefit[1].type.coding[0].code, "copay-maximum") + self.assertEqual(inst.insurance[0].item[0].benefit[2].allowedUnsignedInt, 20) + self.assertEqual(inst.insurance[0].item[0].benefit[2].type.coding[0].code, "copay-percent") + self.assertEqual(inst.insurance[0].item[0].category.coding[0].code, "30") + self.assertEqual(inst.insurance[0].item[0].category.coding[0].display, "Health Benefit Plan Coverage") + self.assertEqual(inst.insurance[0].item[0].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[0].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[0].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[0].term.coding[0].code, "annual") + self.assertEqual(inst.insurance[0].item[0].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[0].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[0].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.insurance[0].item[1].benefit[0].allowedMoney.currency, "SAR") + self.assertEqual(inst.insurance[0].item[1].benefit[0].allowedMoney.value, 15000) + self.assertEqual(inst.insurance[0].item[1].benefit[0].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[1].category.coding[0].code, "69") + self.assertEqual(inst.insurance[0].item[1].category.coding[0].display, "Maternity") + self.assertEqual(inst.insurance[0].item[1].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[1].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[1].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[1].term.coding[0].code, "annual") + self.assertEqual(inst.insurance[0].item[1].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[1].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[1].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.insurance[0].item[2].benefit[0].allowedMoney.currency, "SAR") + self.assertEqual(inst.insurance[0].item[2].benefit[0].allowedMoney.value, 2000) + self.assertEqual(inst.insurance[0].item[2].benefit[0].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[2].category.coding[0].code, "F3") + self.assertEqual(inst.insurance[0].item[2].category.coding[0].display, "Dental Coverage") + self.assertEqual(inst.insurance[0].item[2].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[2].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[2].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[2].term.coding[0].code, "annual") + self.assertEqual(inst.insurance[0].item[2].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[2].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[2].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.insurance[0].item[3].benefit[0].allowedMoney.currency, "SAR") + self.assertEqual(inst.insurance[0].item[3].benefit[0].allowedMoney.value, 400) + self.assertEqual(inst.insurance[0].item[3].benefit[0].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[3].category.coding[0].code, "F6") + self.assertEqual(inst.insurance[0].item[3].category.coding[0].display, "Vision Coverage") + self.assertEqual(inst.insurance[0].item[3].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[3].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[3].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[3].term.coding[0].code, "annual") + self.assertEqual(inst.insurance[0].item[3].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[3].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[3].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.insurance[0].item[4].benefit[0].allowedString, "shared") + self.assertEqual(inst.insurance[0].item[4].benefit[0].type.coding[0].code, "room") + self.assertEqual(inst.insurance[0].item[4].benefit[1].allowedMoney.currency, "SAR") + self.assertEqual(inst.insurance[0].item[4].benefit[1].allowedMoney.value, 600) + self.assertEqual(inst.insurance[0].item[4].benefit[1].type.coding[0].code, "benefit") + self.assertEqual(inst.insurance[0].item[4].category.coding[0].code, "49") + self.assertEqual(inst.insurance[0].item[4].category.coding[0].display, "Hospital Room and Board") + self.assertEqual(inst.insurance[0].item[4].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-benefitcategory") + self.assertEqual(inst.insurance[0].item[4].network.coding[0].code, "in") + self.assertEqual(inst.insurance[0].item[4].network.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-network") + self.assertEqual(inst.insurance[0].item[4].term.coding[0].code, "day") + self.assertEqual(inst.insurance[0].item[4].term.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-term") + self.assertEqual(inst.insurance[0].item[4].unit.coding[0].code, "individual") + self.assertEqual(inst.insurance[0].item[4].unit.coding[0].system, "http://terminology.hl7.org/CodeSystem/benefit-unit") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.purpose[0], "validation") + self.assertEqual(inst.purpose[1], "benefits") + self.assertEqual(inst.servicedDate.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.servicedDate.as_json(), "2014-09-17") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
A human-readable rendering of the CoverageEligibilityResponse.
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/dataelement.py b/fhirclient/models/dataelement.py deleted file mode 100644 index 63b7f7ac9..000000000 --- a/fhirclient/models/dataelement.py +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DataElement) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class DataElement(domainresource.DomainResource): - """ Resource data element. - - The formal description of a single piece of information that can be - gathered and reported. - """ - - resource_type = "DataElement" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.contact = None - """ Contact details for the publisher. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.copyright = None - """ Use and/or publishing restrictions. - Type `str`. """ - - self.date = None - """ Date this was last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.element = None - """ Definition of element. - List of `ElementDefinition` items (represented as `dict` in JSON). """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.identifier = None - """ Additional identifier for the data element. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.jurisdiction = None - """ Intended jurisdiction for data element (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.mapping = None - """ External specification mapped to. - List of `DataElementMapping` items (represented as `dict` in JSON). """ - - self.name = None - """ Name for this data element (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.stringency = None - """ comparable | fully-specified | equivalent | convertable | scaleable - | flexible. - Type `str`. """ - - self.title = None - """ Name for this data element (human friendly). - Type `str`. """ - - self.url = None - """ Logical URI to reference this data element (globally unique). - Type `str`. """ - - self.useContext = None - """ Context the content is intended to support. - List of `UsageContext` items (represented as `dict` in JSON). """ - - self.version = None - """ Business version of the data element. - Type `str`. """ - - super(DataElement, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DataElement, self).elementProperties() - js.extend([ - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("copyright", "copyright", str, False, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("element", "element", elementdefinition.ElementDefinition, True, None, True), - ("experimental", "experimental", bool, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("mapping", "mapping", DataElementMapping, True, None, False), - ("name", "name", str, False, None, False), - ("publisher", "publisher", str, False, None, False), - ("status", "status", str, False, None, True), - ("stringency", "stringency", str, False, None, False), - ("title", "title", str, False, None, False), - ("url", "url", str, False, None, False), - ("useContext", "useContext", usagecontext.UsageContext, True, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class DataElementMapping(backboneelement.BackboneElement): - """ External specification mapped to. - - Identifies a specification (other than a terminology) that the elements - which make up the DataElement have some correspondence with. - """ - - resource_type = "DataElementMapping" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.comment = None - """ Versions, issues, scope limitations, etc.. - Type `str`. """ - - self.identity = None - """ Internal id when this mapping is used. - Type `str`. """ - - self.name = None - """ Names what this mapping refers to. - Type `str`. """ - - self.uri = None - """ Identifies what this mapping refers to. - Type `str`. """ - - super(DataElementMapping, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DataElementMapping, self).elementProperties() - js.extend([ - ("comment", "comment", str, False, None, False), - ("identity", "identity", str, False, None, True), - ("name", "name", str, False, None, False), - ("uri", "uri", str, False, None, False), - ]) - return js - - -import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import contactdetail -except ImportError: - contactdetail = sys.modules[__package__ + '.contactdetail'] -try: - from . import elementdefinition -except ImportError: - elementdefinition = sys.modules[__package__ + '.elementdefinition'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] -try: - from . import usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/dataelement_tests.py b/fhirclient/models/dataelement_tests.py deleted file mode 100644 index 9ac746c74..000000000 --- a/fhirclient/models/dataelement_tests.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import dataelement -from .fhirdate import FHIRDate - - -class DataElementTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("DataElement", js["resourceType"]) - return dataelement.DataElement(js) - - def testDataElement1(self): - inst = self.instantiate_from("dataelement-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DataElement instance") - self.implDataElement1(inst) - - js = inst.as_json() - self.assertEqual("DataElement", js["resourceType"]) - inst2 = dataelement.DataElement(js) - self.implDataElement1(inst2) - - def implDataElement1(self, inst): - self.assertEqual(inst.contained[0].id, "2179414") - self.assertEqual(inst.contained[1].id, "2179414-permitted") - self.assertEqual(inst.contained[2].id, "2179414-cm") - self.assertEqual(inst.date.date, FHIRDate("2016-01-01").date) - self.assertEqual(inst.date.as_json(), "2016-01-01") - self.assertEqual(inst.element[0].binding.strength, "required") - self.assertEqual(inst.element[0].code[0].code, "46098-0") - self.assertEqual(inst.element[0].code[0].display, "Sex") - self.assertEqual(inst.element[0].code[0].system, "http://loinc.org") - self.assertEqual(inst.element[0].definition, "The code representing the gender of a person.") - self.assertEqual(inst.element[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/minLength") - self.assertEqual(inst.element[0].extension[0].valueInteger, 1) - self.assertEqual(inst.element[0].extension[1].url, "http://hl7.org/fhir/StructureDefinition/elementdefinition-question") - self.assertEqual(inst.element[0].extension[1].valueString, "Gender") - self.assertEqual(inst.element[0].mapping[0].identity, "fhir") - self.assertEqual(inst.element[0].mapping[0].language, "application/xquery") - self.assertEqual(inst.element[0].mapping[0].map, "return f:/Patient/f:gender") - self.assertEqual(inst.element[0].maxLength, 13) - self.assertEqual(inst.element[0].path, "Gender") - self.assertEqual(inst.element[0].type[0].code, "CodeableConcept") - self.assertEqual(inst.id, "gender") - self.assertEqual(inst.identifier[0].value, "2179650") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.mapping[0].identity, "fhir") - self.assertEqual(inst.mapping[0].name, "Fast Healthcare Interoperable Resources (FHIR)") - self.assertEqual(inst.mapping[0].uri, "http://hl7.org/fhir/api") - self.assertEqual(inst.name, "Gender Code") - self.assertEqual(inst.publisher, "DCP") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Administrative gender") - self.assertEqual(inst.version, "1.0") - - def testDataElement2(self): - inst = self.instantiate_from("dataelement-labtestmaster-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DataElement instance") - self.implDataElement2(inst) - - js = inst.as_json() - self.assertEqual("DataElement", js["resourceType"]) - inst2 = dataelement.DataElement(js) - self.implDataElement2(inst2) - - def implDataElement2(self, inst): - self.assertEqual(inst.element[0].alias[0], "Protime, PT") - self.assertEqual(inst.element[0].comment, "Used to screen the integrity of the extrinsic and common pathways of coagulation and to monitor warfarin anticoagulation. ") - self.assertEqual(inst.element[0].definition, "The PT test evaluates the extrinsic and common pathways of the coagulation cascade.") - self.assertEqual(inst.element[0].example[0].label, "Simple") - self.assertEqual(inst.element[0].example[0].valueDecimal, 10.0) - self.assertEqual(inst.element[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits") - self.assertEqual(inst.element[0].extension[0].valueCodeableConcept.coding[0].code, "s") - self.assertEqual(inst.element[0].extension[0].valueCodeableConcept.coding[0].display, "second") - self.assertEqual(inst.element[0].extension[0].valueCodeableConcept.coding[0].system, "http://unitsofmeasure.org") - self.assertTrue(inst.element[0].extension[0].valueCodeableConcept.coding[0].userSelected) - self.assertEqual(inst.element[0].extension[0].valueCodeableConcept.coding[0].version, "1.9") - self.assertEqual(inst.element[0].extension[0].valueCodeableConcept.text, "second") - self.assertEqual(inst.element[0].mapping[0].identity, "loinc") - self.assertEqual(inst.element[0].mapping[0].map, "5964-2") - self.assertEqual(inst.element[0].path, "prothrombin") - self.assertEqual(inst.element[0].requirements, "This test is orderable. A plasma specimen in a 3.2% sodium citrate blue top tube is required.") - self.assertEqual(inst.element[0].type[0].code, "decimal") - self.assertEqual(inst.id, "prothrombin") - self.assertEqual(inst.identifier[0].period.start.date, FHIRDate("2011-05-19").date) - self.assertEqual(inst.identifier[0].period.start.as_json(), "2011-05-19") - self.assertEqual(inst.identifier[0].system, "http://www.CenturyHospital/Laboratory/DirectoryofServices") - self.assertEqual(inst.identifier[0].type.text, "Prothrombin Time, PT") - self.assertEqual(inst.identifier[0].value, "11") - self.assertEqual(inst.mapping[0].comment, "Version 2.48 or later") - self.assertEqual(inst.mapping[0].identity, "loinc") - self.assertEqual(inst.mapping[0].name, "LOINC") - self.assertEqual(inst.mapping[0].uri, "http://loinc.org/") - self.assertEqual(inst.name, "Prothrombin Time") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/datarequirement.py b/fhirclient/models/datarequirement.py index 0a5d37262..b1a8e5a0e 100644 --- a/fhirclient/models/datarequirement.py +++ b/fhirclient/models/datarequirement.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DataRequirement) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DataRequirement) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -32,8 +32,12 @@ def __init__(self, jsondict=None, strict=True): """ What dates/date ranges are expected. List of `DataRequirementDateFilter` items (represented as `dict` in JSON). """ + self.limit = None + """ Number of results. + Type `int`. """ + self.mustSupport = None - """ Indicates that specific structure elements are referenced by the + """ Indicates specific structure elements that are referenced by the knowledge module. List of `str` items. """ @@ -41,6 +45,20 @@ def __init__(self, jsondict=None, strict=True): """ The profile of the required data. List of `str` items. """ + self.sort = None + """ Order of the results. + List of `DataRequirementSort` items (represented as `dict` in JSON). """ + + self.subjectCodeableConcept = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.type = None """ The type of the required data. Type `str`. """ @@ -52,8 +70,12 @@ def elementProperties(self): js.extend([ ("codeFilter", "codeFilter", DataRequirementCodeFilter, True, None, False), ("dateFilter", "dateFilter", DataRequirementDateFilter, True, None, False), + ("limit", "limit", int, False, None, False), ("mustSupport", "mustSupport", str, True, None, False), ("profile", "profile", str, True, None, False), + ("sort", "sort", DataRequirementSort, True, None, False), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), ("type", "type", str, False, None, True), ]) return js @@ -63,7 +85,9 @@ class DataRequirementCodeFilter(element.Element): """ What codes are expected. Code filters specify additional constraints on the data, specifying the - value set of interest for a particular element of the data. + value set of interest for a particular element of the data. Each code + filter defines an additional constraint on the data, i.e. code filters are + AND'ed, not OR'ed. """ resource_type = "DataRequirementCodeFilter" @@ -76,27 +100,19 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.path = None - """ The code-valued attribute of the filter. - Type `str`. """ - - self.valueCode = None + self.code = None """ What code is expected. - List of `str` items. """ - - self.valueCodeableConcept = None - """ What CodeableConcept is expected. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.valueCoding = None - """ What Coding is expected. List of `Coding` items (represented as `dict` in JSON). """ - self.valueSetReference = None - """ Valueset for the filter. - Type `FHIRReference` referencing `ValueSet` (represented as `dict` in JSON). """ + self.path = None + """ A code-valued attribute to filter on. + Type `str`. """ + + self.searchParam = None + """ A coded (token) parameter to search on. + Type `str`. """ - self.valueSetString = None + self.valueSet = None """ Valueset for the filter. Type `str`. """ @@ -105,12 +121,10 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(DataRequirementCodeFilter, self).elementProperties() js.extend([ - ("path", "path", str, False, None, True), - ("valueCode", "valueCode", str, True, None, False), - ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, True, None, False), - ("valueCoding", "valueCoding", coding.Coding, True, None, False), - ("valueSetReference", "valueSetReference", fhirreference.FHIRReference, False, "valueSet", False), - ("valueSetString", "valueSetString", str, False, "valueSet", False), + ("code", "code", coding.Coding, True, None, False), + ("path", "path", str, False, None, False), + ("searchParam", "searchParam", str, False, None, False), + ("valueSet", "valueSet", str, False, None, False), ]) return js @@ -119,7 +133,8 @@ class DataRequirementDateFilter(element.Element): """ What dates/date ranges are expected. Date filters specify additional constraints on the data in terms of the - applicable date range for specific elements. + applicable date range for specific elements. Each date filter specifies an + additional constraint on the data, i.e. date filters are AND'ed, not OR'ed. """ resource_type = "DataRequirementDateFilter" @@ -133,7 +148,11 @@ def __init__(self, jsondict=None, strict=True): """ self.path = None - """ The date-valued attribute of the filter. + """ A date-valued attribute to filter on. + Type `str`. """ + + self.searchParam = None + """ A date valued parameter to search on. Type `str`. """ self.valueDateTime = None @@ -153,7 +172,8 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(DataRequirementDateFilter, self).elementProperties() js.extend([ - ("path", "path", str, False, None, True), + ("path", "path", str, False, None, False), + ("searchParam", "searchParam", str, False, None, False), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), ("valueDuration", "valueDuration", duration.Duration, False, "value", False), ("valuePeriod", "valuePeriod", period.Period, False, "value", False), @@ -161,6 +181,41 @@ def elementProperties(self): return js +class DataRequirementSort(element.Element): + """ Order of the results. + + Specifies the order of the results to be returned. + """ + + resource_type = "DataRequirementSort" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.direction = None + """ ascending | descending. + Type `str`. """ + + self.path = None + """ The name of the attribute to perform the sort. + Type `str`. """ + + super(DataRequirementSort, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DataRequirementSort, self).elementProperties() + js.extend([ + ("direction", "direction", str, False, None, True), + ("path", "path", str, False, None, True), + ]) + return js + + import sys try: from . import codeableconcept diff --git a/fhirclient/models/detectedissue.py b/fhirclient/models/detectedissue.py index fb82ba744..e2201a7a7 100644 --- a/fhirclient/models/detectedissue.py +++ b/fhirclient/models/detectedissue.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -28,27 +28,35 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ The provider or device that identified the issue. - Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.category = None + self.code = None """ Issue Category, e.g. drug-drug, duplicate therapy, etc.. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.date = None - """ When identified. - Type `FHIRDate` (represented as `str` in JSON). """ - self.detail = None """ Description and context. Type `str`. """ + self.evidence = None + """ Supporting evidence. + List of `DetectedIssueEvidence` items (represented as `dict` in JSON). """ + + self.identifiedDateTime = None + """ When identified. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifiedPeriod = None + """ When identified. + Type `Period` (represented as `dict` in JSON). """ + self.identifier = None """ Unique id for the detected issue. - Type `Identifier` (represented as `dict` in JSON). """ + List of `Identifier` items (represented as `dict` in JSON). """ self.implicated = None """ Problem resource. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.mitigation = None """ Step taken to address. @@ -56,7 +64,7 @@ def __init__(self, jsondict=None, strict=True): self.patient = None """ Associated patient. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.reference = None """ Authority for issue. @@ -76,10 +84,12 @@ def elementProperties(self): js = super(DetectedIssue, self).elementProperties() js.extend([ ("author", "author", fhirreference.FHIRReference, False, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("detail", "detail", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("evidence", "evidence", DetectedIssueEvidence, True, None, False), + ("identifiedDateTime", "identifiedDateTime", fhirdate.FHIRDate, False, "identified", False), + ("identifiedPeriod", "identifiedPeriod", period.Period, False, "identified", False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("implicated", "implicated", fhirreference.FHIRReference, True, None, False), ("mitigation", "mitigation", DetectedIssueMitigation, True, None, False), ("patient", "patient", fhirreference.FHIRReference, False, None, False), @@ -92,10 +102,46 @@ def elementProperties(self): from . import backboneelement +class DetectedIssueEvidence(backboneelement.BackboneElement): + """ Supporting evidence. + + Supporting evidence or manifestations that provide the basis for + identifying the detected issue such as a GuidanceResponse or MeasureReport. + """ + + resource_type = "DetectedIssueEvidence" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Manifestation. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.detail = None + """ Supporting information. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(DetectedIssueEvidence, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DetectedIssueEvidence, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("detail", "detail", fhirreference.FHIRReference, True, None, False), + ]) + return js + + class DetectedIssueMitigation(backboneelement.BackboneElement): """ Step taken to address. - Indicates an action that has been taken or is committed to to reduce or + Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting. Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action. @@ -117,7 +163,7 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ Who is committing?. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.date = None """ Date committed. @@ -152,3 +198,7 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/detectedissue_tests.py b/fhirclient/models/detectedissue_tests.py index 731fb0a22..2749deeb1 100644 --- a/fhirclient/models/detectedissue_tests.py +++ b/fhirclient/models/detectedissue_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -33,6 +33,9 @@ def testDetectedIssue1(self): def implDetectedIssue1(self, inst): self.assertEqual(inst.id, "allergy") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") @@ -48,22 +51,25 @@ def testDetectedIssue2(self): self.implDetectedIssue2(inst2) def implDetectedIssue2(self, inst): - self.assertEqual(inst.category.coding[0].code, "DUPTHPY") - self.assertEqual(inst.category.coding[0].display, "Duplicate Therapy Alert") - self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.date.date, FHIRDate("2013-05-08").date) - self.assertEqual(inst.date.as_json(), "2013-05-08") + self.assertEqual(inst.code.coding[0].code, "DUPTHPY") + self.assertEqual(inst.code.coding[0].display, "Duplicate Therapy Alert") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.detail, "Similar test was performed within the past 14 days") self.assertEqual(inst.id, "duplicate") - self.assertEqual(inst.identifier.system, "http://example.org") - self.assertEqual(inst.identifier.use, "official") - self.assertEqual(inst.identifier.value, "12345") + self.assertEqual(inst.identifiedDateTime.date, FHIRDate("2013-05-08").date) + self.assertEqual(inst.identifiedDateTime.as_json(), "2013-05-08") + self.assertEqual(inst.identifier[0].system, "http://example.org") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.reference, "http://www.tmhp.com/RadiologyClinicalDecisionSupport/2011/CHEST%20IMAGING%20GUIDELINES%202011.pdf") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") def testDetectedIssue3(self): - inst = self.instantiate_from("detectedissue-example-lab.json") + inst = self.instantiate_from("detectedissue-example.json") self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") self.implDetectedIssue3(inst) @@ -73,13 +79,27 @@ def testDetectedIssue3(self): self.implDetectedIssue3(inst2) def implDetectedIssue3(self, inst): - self.assertEqual(inst.id, "lab") + self.assertEqual(inst.code.coding[0].code, "DRG") + self.assertEqual(inst.code.coding[0].display, "Drug Interaction Alert") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.id, "ddi") + self.assertEqual(inst.identifiedDateTime.date, FHIRDate("2014-01-05").date) + self.assertEqual(inst.identifiedDateTime.as_json(), "2014-01-05") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.mitigation[0].action.coding[0].code, "13") + self.assertEqual(inst.mitigation[0].action.coding[0].display, "Stopped Concurrent Therapy") + self.assertEqual(inst.mitigation[0].action.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.mitigation[0].action.text, "Asked patient to discontinue regular use of Tylenol and to consult with clinician if they need to resume to allow appropriate INR monitoring") + self.assertEqual(inst.mitigation[0].date.date, FHIRDate("2014-01-05").date) + self.assertEqual(inst.mitigation[0].date.as_json(), "2014-01-05") + self.assertEqual(inst.severity, "high") self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") def testDetectedIssue4(self): - inst = self.instantiate_from("detectedissue-example.json") + inst = self.instantiate_from("detectedissue-example-lab.json") self.assertIsNotNone(inst, "Must have instantiated a DetectedIssue instance") self.implDetectedIssue4(inst) @@ -89,19 +109,11 @@ def testDetectedIssue4(self): self.implDetectedIssue4(inst2) def implDetectedIssue4(self, inst): - self.assertEqual(inst.category.coding[0].code, "DRG") - self.assertEqual(inst.category.coding[0].display, "Drug Interaction Alert") - self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.date.date, FHIRDate("2014-01-05").date) - self.assertEqual(inst.date.as_json(), "2014-01-05") - self.assertEqual(inst.id, "ddi") - self.assertEqual(inst.mitigation[0].action.coding[0].code, "13") - self.assertEqual(inst.mitigation[0].action.coding[0].display, "Stopped Concurrent Therapy") - self.assertEqual(inst.mitigation[0].action.coding[0].system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.mitigation[0].action.text, "Asked patient to discontinue regular use of Tylenol and to consult with clinician if they need to resume to allow appropriate INR monitoring") - self.assertEqual(inst.mitigation[0].date.date, FHIRDate("2014-01-05").date) - self.assertEqual(inst.mitigation[0].date.as_json(), "2014-01-05") - self.assertEqual(inst.severity, "high") + self.assertEqual(inst.id, "lab") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/device.py b/fhirclient/models/device.py index c86ebc872..51c824e2f 100644 --- a/fhirclient/models/device.py +++ b/fhirclient/models/device.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Device) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Device) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,13 +10,9 @@ class Device(domainresource.DomainResource): """ Item used in healthcare. - This resource identifies an instance or a type of a manufactured item that - is used in the provision of healthcare without being substantially changed - through that activity. The device may be a medical or non-medical device. - Medical devices include durable (reusable) medical equipment, implantable - devices, as well as disposable equipment used for diagnostic, treatment, - and research for healthcare and public health. Non-medical devices may - include items such as a machine, cellphone, computer, application, etc. + A type of a manufactured item that is used in the provision of healthcare + without being substantially changed through that activity. The device may + be a medical or non-medical device. """ resource_type = "Device" @@ -33,6 +29,18 @@ def __init__(self, jsondict=None, strict=True): """ Details for human/organization for support. List of `ContactPoint` items (represented as `dict` in JSON). """ + self.definition = None + """ The reference to the definition for the device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.deviceName = None + """ The name of the device as given by the manufacturer. + List of `DeviceDeviceName` items (represented as `dict` in JSON). """ + + self.distinctIdentifier = None + """ The distinct identification string. + Type `str`. """ + self.expirationDate = None """ Date and time of expiry of this device (if applicable). Type `FHIRDate` (represented as `str` in JSON). """ @@ -42,8 +50,8 @@ def __init__(self, jsondict=None, strict=True): List of `Identifier` items (represented as `dict` in JSON). """ self.location = None - """ Where the resource is found. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Where the device is found. + Type `FHIRReference` (represented as `dict` in JSON). """ self.lotNumber = None """ Lot number of manufacture. @@ -57,8 +65,8 @@ def __init__(self, jsondict=None, strict=True): """ Name of device manufacturer. Type `str`. """ - self.model = None - """ Model id assigned by the manufacturer. + self.modelNumber = None + """ The model number for the device. Type `str`. """ self.note = None @@ -67,35 +75,64 @@ def __init__(self, jsondict=None, strict=True): self.owner = None """ Organization responsible for device. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.parent = None + """ The parent device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.partNumber = None + """ The part number of the device. + Type `str`. """ self.patient = None """ Patient to whom Device is affixed. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.property = None + """ The actual configuration settings of a device as it actually + operates, e.g., regulation status, time properties. + List of `DeviceProperty` items (represented as `dict` in JSON). """ self.safety = None """ Safety Characteristics of Device. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.serialNumber = None + """ Serial number assigned by the manufacturer. + Type `str`. """ + + self.specialization = None + """ The capabilities supported on a device, the standards to which the + device conforms for a particular purpose, and used for the + communication. + List of `DeviceSpecialization` items (represented as `dict` in JSON). """ + self.status = None """ active | inactive | entered-in-error | unknown. Type `str`. """ + self.statusReason = None + """ online | paused | standby | offline | not-ready | transduc-discon | + hw-discon | off. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.type = None - """ What kind of device this is. + """ The kind or type of device. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.udi = None + self.udiCarrier = None """ Unique Device Identifier (UDI) Barcode string. - Type `DeviceUdi` (represented as `dict` in JSON). """ + List of `DeviceUdiCarrier` items (represented as `dict` in JSON). """ self.url = None """ Network address to contact device. Type `str`. """ self.version = None - """ Version number (i.e. software). - Type `str`. """ + """ The actual design of the device or software version running on the + device. + List of `DeviceVersion` items (represented as `dict` in JSON). """ super(Device, self).__init__(jsondict=jsondict, strict=strict) @@ -103,36 +140,160 @@ def elementProperties(self): js = super(Device, self).elementProperties() js.extend([ ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("definition", "definition", fhirreference.FHIRReference, False, None, False), + ("deviceName", "deviceName", DeviceDeviceName, True, None, False), + ("distinctIdentifier", "distinctIdentifier", str, False, None, False), ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("location", "location", fhirreference.FHIRReference, False, None, False), ("lotNumber", "lotNumber", str, False, None, False), ("manufactureDate", "manufactureDate", fhirdate.FHIRDate, False, None, False), ("manufacturer", "manufacturer", str, False, None, False), - ("model", "model", str, False, None, False), + ("modelNumber", "modelNumber", str, False, None, False), ("note", "note", annotation.Annotation, True, None, False), ("owner", "owner", fhirreference.FHIRReference, False, None, False), + ("parent", "parent", fhirreference.FHIRReference, False, None, False), + ("partNumber", "partNumber", str, False, None, False), ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("property", "property", DeviceProperty, True, None, False), ("safety", "safety", codeableconcept.CodeableConcept, True, None, False), + ("serialNumber", "serialNumber", str, False, None, False), + ("specialization", "specialization", DeviceSpecialization, True, None, False), ("status", "status", str, False, None, False), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, True, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("udi", "udi", DeviceUdi, False, None, False), + ("udiCarrier", "udiCarrier", DeviceUdiCarrier, True, None, False), ("url", "url", str, False, None, False), - ("version", "version", str, False, None, False), + ("version", "version", DeviceVersion, True, None, False), ]) return js from . import backboneelement -class DeviceUdi(backboneelement.BackboneElement): +class DeviceDeviceName(backboneelement.BackboneElement): + """ The name of the device as given by the manufacturer. + + This represents the manufacturer's name of the device as provided by the + device, from a UDI label, or by a person describing the Device. This + typically would be used when a person provides the name(s) or when the + device represents one of the names available from DeviceDefinition. + """ + + resource_type = "DeviceDeviceName" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.name = None + """ The name of the device. + Type `str`. """ + + self.type = None + """ udi-label-name | user-friendly-name | patient-reported-name | + manufacturer-name | model-name | other. + Type `str`. """ + + super(DeviceDeviceName, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDeviceName, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class DeviceProperty(backboneelement.BackboneElement): + """ The actual configuration settings of a device as it actually operates, + e.g., regulation status, time properties. + """ + + resource_type = "DeviceProperty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.type = None + """ Code that specifies the property DeviceDefinitionPropetyCode + (Extensible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCode = None + """ Property value as a code, e.g., NTP4 (synced to NTP). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Property value as a quantity. + List of `Quantity` items (represented as `dict` in JSON). """ + + super(DeviceProperty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceProperty, self).elementProperties() + js.extend([ + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("valueCode", "valueCode", codeableconcept.CodeableConcept, True, None, False), + ("valueQuantity", "valueQuantity", quantity.Quantity, True, None, False), + ]) + return js + + +class DeviceSpecialization(backboneelement.BackboneElement): + """ The capabilities supported on a device, the standards to which the device + conforms for a particular purpose, and used for the communication. + """ + + resource_type = "DeviceSpecialization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.systemType = None + """ The standard that is used to operate and communicate. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.version = None + """ The version of the standard that is used to operate and communicate. + Type `str`. """ + + super(DeviceSpecialization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceSpecialization, self).elementProperties() + js.extend([ + ("systemType", "systemType", codeableconcept.CodeableConcept, False, None, True), + ("version", "version", str, False, None, False), + ]) + return js + + +class DeviceUdiCarrier(backboneelement.BackboneElement): """ Unique Device Identifier (UDI) Barcode string. - [Unique device identifier (UDI)](device.html#5.11.3.2.2) assigned to device - label or package. + Unique device identifier (UDI) assigned to device label or package. Note + that the Device may include multiple udiCarriers as it either may include + just the udiCarrier for the jurisdiction it is sold, or for multiple + jurisdictions it could have been sold. """ - resource_type = "DeviceUdi" + resource_type = "DeviceUdiCarrier" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -166,14 +327,10 @@ def __init__(self, jsondict=None, strict=True): """ Regional UDI authority. Type `str`. """ - self.name = None - """ Device Name as appears on UDI label. - Type `str`. """ - - super(DeviceUdi, self).__init__(jsondict=jsondict, strict=strict) + super(DeviceUdiCarrier, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(DeviceUdi, self).elementProperties() + js = super(DeviceUdiCarrier, self).elementProperties() js.extend([ ("carrierAIDC", "carrierAIDC", str, False, None, False), ("carrierHRF", "carrierHRF", str, False, None, False), @@ -181,7 +338,44 @@ def elementProperties(self): ("entryType", "entryType", str, False, None, False), ("issuer", "issuer", str, False, None, False), ("jurisdiction", "jurisdiction", str, False, None, False), - ("name", "name", str, False, None, False), + ]) + return js + + +class DeviceVersion(backboneelement.BackboneElement): + """ The actual design of the device or software version running on the device. + """ + + resource_type = "DeviceVersion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.component = None + """ A single component of the device version. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ The type of the device version. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ The version text. + Type `str`. """ + + super(DeviceVersion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceVersion, self).elementProperties() + js.extend([ + ("component", "component", identifier.Identifier, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", str, False, None, True), ]) return js @@ -211,3 +405,7 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/device_tests.py b/fhirclient/models/device_tests.py index bd1c732a3..3698ecf32 100644 --- a/fhirclient/models/device_tests.py +++ b/fhirclient/models/device_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,21 +32,18 @@ def testDevice1(self): self.implDevice1(inst2) def implDevice1(self, inst): - self.assertEqual(inst.expirationDate.date, FHIRDate("2020-08-08").date) - self.assertEqual(inst.expirationDate.as_json(), "2020-08-08") self.assertEqual(inst.id, "f001") self.assertEqual(inst.identifier[0].system, "http:/goodhealthhospital/identifier/devices") self.assertEqual(inst.identifier[0].value, "12345") - self.assertEqual(inst.manufactureDate.date, FHIRDate("2015-08-08").date) - self.assertEqual(inst.manufactureDate.as_json(), "2015-08-08") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: f001

identifier: 12345

status: active

") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "25062003") - self.assertEqual(inst.type.coding[0].display, "Feeding tube, device") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") def testDevice2(self): - inst = self.instantiate_from("device-example-ihe-pcd.json") + inst = self.instantiate_from("device-example.json") self.assertIsNotNone(inst, "Must have instantiated a Device instance") self.implDevice2(inst) @@ -56,210 +53,12 @@ def testDevice2(self): self.implDevice2(inst2) def implDevice2(self, inst): - self.assertEqual(inst.id, "ihe-pcd") - self.assertEqual(inst.identifier[0].type.coding[0].code, "SNO") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/identifier-type") - self.assertEqual(inst.identifier[0].type.text, "Serial Number") - self.assertEqual(inst.identifier[0].value, "AMID-123-456") - self.assertEqual(inst.lotNumber, "12345") - self.assertEqual(inst.manufacturer, "Acme Devices, Inc") - self.assertEqual(inst.model, "A.1.1") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.text, "Vital Signs Monitor") - - def testDevice3(self): - inst = self.instantiate_from("device-example-pacemaker.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice3(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice3(inst2) - - def implDevice3(self, inst): - self.assertEqual(inst.contact[0].system, "phone") - self.assertEqual(inst.contact[0].value, "ext 4352") - self.assertEqual(inst.id, "example-pacemaker") - self.assertEqual(inst.identifier[0].system, "http://acme.com/devices/pacemakers/octane/serial") - self.assertEqual(inst.identifier[0].value, "1234-5678-90AB-CDEF") - self.assertEqual(inst.lotNumber, "1234-5678") - self.assertEqual(inst.manufacturer, "Acme Devices, Inc") - self.assertEqual(inst.model, "PM/Octane 2014") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "octane2014") - self.assertEqual(inst.type.coding[0].display, "Performance pace maker for high octane patients") - self.assertEqual(inst.type.coding[0].system, "http://acme.com/devices") - - def testDevice4(self): - inst = self.instantiate_from("device-example-software.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice4(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice4(inst2) - - def implDevice4(self, inst): - self.assertEqual(inst.contact[0].system, "url") - self.assertEqual(inst.contact[0].value, "http://acme.com") - self.assertEqual(inst.id, "software") - self.assertEqual(inst.identifier[0].system, "http://acme.com/ehr/client-ids") - self.assertEqual(inst.identifier[0].value, "goodhealth") - self.assertEqual(inst.manufacturer, "Acme Devices, Inc") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.text, "EHR") - self.assertEqual(inst.url, "http://acme.com/goodhealth/ehr/") - self.assertEqual(inst.version, "10.23-23423") - - def testDevice5(self): - inst = self.instantiate_from("device-example-udi1.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice5(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice5(inst2) - - def implDevice5(self, inst): - self.assertEqual(inst.expirationDate.date, FHIRDate("2014-11-20").date) - self.assertEqual(inst.expirationDate.as_json(), "2014-11-20") - self.assertEqual(inst.id, "example-udi1") - self.assertEqual(inst.identifier[0].system, "http://acme.com/devices/pacemakers/octane/serial") - self.assertEqual(inst.identifier[0].value, "1234-5678-90AB-CDEF") - self.assertEqual(inst.identifier[1].type.coding[0].code, "SNO") - self.assertEqual(inst.identifier[1].type.coding[0].system, "http://hl7.org/fhir/identifier-type") - self.assertEqual(inst.identifier[1].value, "10987654d321") - self.assertEqual(inst.lotNumber, "7654321D") - self.assertEqual(inst.manufacturer, "Acme Devices, Inc") - self.assertEqual(inst.model, "PM/Octane 2014") - self.assertEqual(inst.safety[0].coding[0].code, "mr-unsafe") - self.assertEqual(inst.safety[0].coding[0].display, "MR Unsafe") - self.assertEqual(inst.safety[0].coding[0].system, "urn:oid:2.16.840.1.113883.3.26.1.1") - self.assertEqual(inst.safety[0].text, "MR Unsafe") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "468063009") - self.assertEqual(inst.type.coding[0].display, "Coated femoral stem prosthesis, modular") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.type.text, "Coated femoral stem prosthesis, modular") - self.assertEqual(inst.udi.carrierAIDC, "XWQyMDExMDg1NzY3NDAwMjAxNzE3MTQxMTIwMTBOWUZVTDAx4oaUMjExOTI4MzfihpQ3MTNBMUIyQzNENEU1RjZH") - self.assertEqual(inst.udi.carrierHRF, "{01}00844588003288{17}141120{10}7654321D{21}10987654d321") - self.assertEqual(inst.udi.deviceIdentifier, "00844588003288") - self.assertEqual(inst.udi.entryType, "barcode") - self.assertEqual(inst.udi.issuer, "http://hl7.org/fhir/NamingSystem/gs1") - self.assertEqual(inst.udi.jurisdiction, "http://hl7.org/fhir/NamingSystem/fda-udi") - self.assertEqual(inst.udi.name, "FHIR® Hip System") - - def testDevice6(self): - inst = self.instantiate_from("device-example-udi2.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice6(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice6(inst2) - - def implDevice6(self, inst): - self.assertEqual(inst.expirationDate.date, FHIRDate("2014-02-01").date) - self.assertEqual(inst.expirationDate.as_json(), "2014-02-01") - self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/device-din") - self.assertEqual(inst.extension[0].valueIdentifier.system, "http://hl7.org/fhir/NamingSystem/iccbba-din") - self.assertEqual(inst.extension[0].valueIdentifier.value, "A99971312345600") - self.assertEqual(inst.id, "example-udi2") - self.assertEqual(inst.manufactureDate.date, FHIRDate("2013-02-01").date) - self.assertEqual(inst.manufactureDate.as_json(), "2013-02-01") - self.assertEqual(inst.manufacturer, "Acme Devices, Inc") - self.assertEqual(inst.status, "inactive") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.udi.deviceIdentifier, "A9999XYZ100T0474") - self.assertEqual(inst.udi.issuer, "http://hl7.org/fhir/NamingSystem/iccbba-other") - self.assertEqual(inst.udi.jurisdiction, "http://hl7.org/fhir/NamingSystem/fda-udi") - self.assertEqual(inst.udi.name, "Bone,Putty Demineralized") - - def testDevice7(self): - inst = self.instantiate_from("device-example-udi3.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice7(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice7(inst2) - - def implDevice7(self, inst): - self.assertEqual(inst.expirationDate.date, FHIRDate("2020-02-02").date) - self.assertEqual(inst.expirationDate.as_json(), "2020-02-02") - self.assertEqual(inst.id, "example-udi3") - self.assertEqual(inst.identifier[0].type.coding[0].code, "SNO") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/identifier-type") - self.assertEqual(inst.identifier[0].value, "XYZ456789012345678") - self.assertEqual(inst.lotNumber, "LOT123456789012345") - self.assertEqual(inst.manufactureDate.date, FHIRDate("2013-02-02").date) - self.assertEqual(inst.manufactureDate.as_json(), "2013-02-02") - self.assertEqual(inst.manufacturer, "GlobalMed, Inc") - self.assertEqual(inst.model, "Ultra Implantable") - self.assertEqual(inst.status, "inactive") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.udi.carrierHRF, "+H123PARTNO1234567890120/$$420020216LOT123456789012345/SXYZ456789012345678/16D20130202C") - self.assertEqual(inst.udi.entryType, "manual") - self.assertEqual(inst.udi.issuer, "http://hl7.org/fhir/NamingSystem/hibcc") - self.assertEqual(inst.udi.jurisdiction, "http://hl7.org/fhir/NamingSystem/fda-udi") - self.assertEqual(inst.udi.name, "FHIR® Ulltra Implantable") - - def testDevice8(self): - inst = self.instantiate_from("device-example-udi4.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice8(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice8(inst2) - - def implDevice8(self, inst): - self.assertEqual(inst.id, "example-udi4") - self.assertEqual(inst.lotNumber, "RZ12345678") - self.assertEqual(inst.manufacturer, "GlobalMed, Inc") - self.assertEqual(inst.status, "inactive") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.udi.carrierHRF, "=)1TE123456A&)RZ12345678") - self.assertEqual(inst.udi.issuer, "http://hl7.org/fhir/NamingSystem/iccbba-blood") - self.assertEqual(inst.udi.jurisdiction, "http://hl7.org/fhir/NamingSystem/fda-udi") - - def testDevice9(self): - inst = self.instantiate_from("device-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Device instance") - self.implDevice9(inst) - - js = inst.as_json() - self.assertEqual("Device", js["resourceType"]) - inst2 = device.Device(js) - self.implDevice9(inst2) - - def implDevice9(self, inst): - self.assertEqual(inst.contact[0].system, "phone") - self.assertEqual(inst.contact[0].value, "ext 4352") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http://goodcare.org/devices/id") self.assertEqual(inst.identifier[0].value, "345675") - self.assertEqual(inst.identifier[1].type.coding[0].code, "SNO") - self.assertEqual(inst.identifier[1].type.coding[0].system, "http://hl7.org/fhir/identifier-type") - self.assertEqual(inst.identifier[1].type.text, "Serial Number") - self.assertEqual(inst.identifier[1].value, "AMID-342135-8464") - self.assertEqual(inst.lotNumber, "43453424") - self.assertEqual(inst.manufacturer, "Acme Devices, Inc") - self.assertEqual(inst.model, "AB 45-J") - self.assertEqual(inst.note[0].text, "QA Checked") - self.assertEqual(inst.note[0].time.date, FHIRDate("2015-06-28T14:03:32+10:00").date) - self.assertEqual(inst.note[0].time.as_json(), "2015-06-28T14:03:32+10:00") - self.assertEqual(inst.status, "active") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

identifier: 345675

") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "86184003") - self.assertEqual(inst.type.coding[0].display, "Electrocardiographic monitor and recorder") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.type.text, "ECG") diff --git a/fhirclient/models/devicecomponent.py b/fhirclient/models/devicecomponent.py deleted file mode 100644 index 9ba524c15..000000000 --- a/fhirclient/models/devicecomponent.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class DeviceComponent(domainresource.DomainResource): - """ An instance of a medical-related component of a medical device. - - The characteristics, operational status and capabilities of a medical- - related component of a medical device. - """ - - resource_type = "DeviceComponent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.identifier = None - """ Instance id assigned by the software stack. - Type `Identifier` (represented as `dict` in JSON). """ - - self.languageCode = None - """ Language code for the human-readable text strings produced by the - device. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.lastSystemChange = None - """ Recent system change timestamp. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.measurementPrinciple = None - """ other | chemical | electrical | impedance | nuclear | optical | - thermal | biological | mechanical | acoustical | manual+. - Type `str`. """ - - self.operationalStatus = None - """ Current operational status of the component, for example On, Off or - Standby. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.parameterGroup = None - """ Current supported parameter group. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.parent = None - """ Parent resource link. - Type `FHIRReference` referencing `DeviceComponent` (represented as `dict` in JSON). """ - - self.productionSpecification = None - """ Specification details such as Component Revisions, or Serial - Numbers. - List of `DeviceComponentProductionSpecification` items (represented as `dict` in JSON). """ - - self.source = None - """ Top-level device resource link. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ - - self.type = None - """ What kind of component it is. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(DeviceComponent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DeviceComponent, self).elementProperties() - js.extend([ - ("identifier", "identifier", identifier.Identifier, False, None, True), - ("languageCode", "languageCode", codeableconcept.CodeableConcept, False, None, False), - ("lastSystemChange", "lastSystemChange", fhirdate.FHIRDate, False, None, False), - ("measurementPrinciple", "measurementPrinciple", str, False, None, False), - ("operationalStatus", "operationalStatus", codeableconcept.CodeableConcept, True, None, False), - ("parameterGroup", "parameterGroup", codeableconcept.CodeableConcept, False, None, False), - ("parent", "parent", fhirreference.FHIRReference, False, None, False), - ("productionSpecification", "productionSpecification", DeviceComponentProductionSpecification, True, None, False), - ("source", "source", fhirreference.FHIRReference, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, True), - ]) - return js - - -from . import backboneelement - -class DeviceComponentProductionSpecification(backboneelement.BackboneElement): - """ Specification details such as Component Revisions, or Serial Numbers. - - The production specification such as component revision, serial number, - etc. - """ - - resource_type = "DeviceComponentProductionSpecification" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.componentId = None - """ Internal component unique identification. - Type `Identifier` (represented as `dict` in JSON). """ - - self.productionSpec = None - """ A printable string defining the component. - Type `str`. """ - - self.specType = None - """ Type or kind of production specification, for example serial number - or software revision. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(DeviceComponentProductionSpecification, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DeviceComponentProductionSpecification, self).elementProperties() - js.extend([ - ("componentId", "componentId", identifier.Identifier, False, None, False), - ("productionSpec", "productionSpec", str, False, None, False), - ("specType", "specType", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/devicecomponent_tests.py b/fhirclient/models/devicecomponent_tests.py deleted file mode 100644 index 14b6deb7c..000000000 --- a/fhirclient/models/devicecomponent_tests.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import devicecomponent -from .fhirdate import FHIRDate - - -class DeviceComponentTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("DeviceComponent", js["resourceType"]) - return devicecomponent.DeviceComponent(js) - - def testDeviceComponent1(self): - inst = self.instantiate_from("devicecomponent-example-prodspec.json") - self.assertIsNotNone(inst, "Must have instantiated a DeviceComponent instance") - self.implDeviceComponent1(inst) - - js = inst.as_json() - self.assertEqual("DeviceComponent", js["resourceType"]) - inst2 = devicecomponent.DeviceComponent(js) - self.implDeviceComponent1(inst2) - - def implDeviceComponent1(self, inst): - self.assertEqual(inst.id, "example-prodspec") - self.assertEqual(inst.identifier.value, "789123") - self.assertEqual(inst.languageCode.coding[0].code, "en-US") - self.assertEqual(inst.languageCode.coding[0].system, "http://tools.ietf.org/html/bcp47") - self.assertEqual(inst.lastSystemChange.date, FHIRDate("2014-10-07T14:45:00Z").date) - self.assertEqual(inst.lastSystemChange.as_json(), "2014-10-07T14:45:00Z") - self.assertEqual(inst.operationalStatus[0].coding[0].code, "off") - self.assertEqual(inst.operationalStatus[0].coding[0].display, "Off") - self.assertEqual(inst.productionSpecification[0].productionSpec, "xa-12324-b") - self.assertEqual(inst.productionSpecification[0].specType.coding[0].code, "serial-number") - self.assertEqual(inst.productionSpecification[0].specType.coding[0].display, "Serial number") - self.assertEqual(inst.productionSpecification[1].productionSpec, "1.1") - self.assertEqual(inst.productionSpecification[1].specType.coding[0].code, "hardware-revision") - self.assertEqual(inst.productionSpecification[1].specType.coding[0].display, "Hardware Revision") - self.assertEqual(inst.productionSpecification[2].productionSpec, "1.12") - self.assertEqual(inst.productionSpecification[2].specType.coding[0].code, "software-revision") - self.assertEqual(inst.productionSpecification[2].specType.coding[0].display, "Software Revision") - self.assertEqual(inst.productionSpecification[3].productionSpec, "1.0.23") - self.assertEqual(inst.productionSpecification[3].specType.coding[0].code, "firmware-revision") - self.assertEqual(inst.productionSpecification[3].specType.coding[0].display, "Firmware Revision") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "2000") - self.assertEqual(inst.type.coding[0].display, "MDC_DEV_ANALY_SAT_O2_MDS") - self.assertEqual(inst.type.coding[0].system, "urn:iso:std:iso:11073:10101") - - def testDeviceComponent2(self): - inst = self.instantiate_from("devicecomponent-example.json") - self.assertIsNotNone(inst, "Must have instantiated a DeviceComponent instance") - self.implDeviceComponent2(inst) - - js = inst.as_json() - self.assertEqual("DeviceComponent", js["resourceType"]) - inst2 = devicecomponent.DeviceComponent(js) - self.implDeviceComponent2(inst2) - - def implDeviceComponent2(self, inst): - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.value, "0") - self.assertEqual(inst.languageCode.coding[0].code, "en-US") - self.assertEqual(inst.languageCode.coding[0].system, "http://tools.ietf.org/html/bcp47") - self.assertEqual(inst.lastSystemChange.date, FHIRDate("2014-10-07T14:45:00Z").date) - self.assertEqual(inst.lastSystemChange.as_json(), "2014-10-07T14:45:00Z") - self.assertEqual(inst.measurementPrinciple, "optical") - self.assertEqual(inst.operationalStatus[0].coding[0].code, "off") - self.assertEqual(inst.operationalStatus[0].coding[0].display, "Off") - self.assertEqual(inst.operationalStatus[0].coding[0].system, "urn:iso:std:iso:11073:10101") - self.assertEqual(inst.parameterGroup.coding[0].code, "miscellaneous") - self.assertEqual(inst.parameterGroup.coding[0].display, "Miscellaneous Parameter Group") - self.assertEqual(inst.parameterGroup.coding[0].system, "urn:iso:std:iso:11073:10101") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "2000") - self.assertEqual(inst.type.coding[0].display, "MDC_DEV_ANALY_SAT_O2_MDS") - self.assertEqual(inst.type.coding[0].system, "urn:iso:std:iso:11073:10101") - diff --git a/fhirclient/models/devicedefinition.py b/fhirclient/models/devicedefinition.py new file mode 100644 index 000000000..9c645a284 --- /dev/null +++ b/fhirclient/models/devicedefinition.py @@ -0,0 +1,416 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceDefinition) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class DeviceDefinition(domainresource.DomainResource): + """ An instance of a medical-related component of a medical device. + + The characteristics, operational status and capabilities of a medical- + related component of a medical device. + """ + + resource_type = "DeviceDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.capability = None + """ Device capabilities. + List of `DeviceDefinitionCapability` items (represented as `dict` in JSON). """ + + self.contact = None + """ Details for human/organization for support. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + self.deviceName = None + """ A name given to the device to identify it. + List of `DeviceDefinitionDeviceName` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Instance identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.languageCode = None + """ Language code for the human-readable text strings produced by the + device (all supported). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.manufacturerReference = None + """ Name of device manufacturer. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.manufacturerString = None + """ Name of device manufacturer. + Type `str`. """ + + self.material = None + """ A substance used to create the material(s) of which the device is + made. + List of `DeviceDefinitionMaterial` items (represented as `dict` in JSON). """ + + self.modelNumber = None + """ The model number for the device. + Type `str`. """ + + self.note = None + """ Device notes and comments. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.onlineInformation = None + """ Access to on-line information. + Type `str`. """ + + self.owner = None + """ Organization responsible for device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.parentDevice = None + """ The parent device it can be part of. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.physicalCharacteristics = None + """ Dimensions, color etc.. + Type `ProdCharacteristic` (represented as `dict` in JSON). """ + + self.property = None + """ The actual configuration settings of a device as it actually + operates, e.g., regulation status, time properties. + List of `DeviceDefinitionProperty` items (represented as `dict` in JSON). """ + + self.quantity = None + """ The quantity of the device present in the packaging (e.g. the + number of devices present in a pack, or the number of devices in + the same package of the medicinal product). + Type `Quantity` (represented as `dict` in JSON). """ + + self.safety = None + """ Safety characteristics of the device. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.shelfLifeStorage = None + """ Shelf Life and storage information. + List of `ProductShelfLife` items (represented as `dict` in JSON). """ + + self.specialization = None + """ The capabilities supported on a device, the standards to which the + device conforms for a particular purpose, and used for the + communication. + List of `DeviceDefinitionSpecialization` items (represented as `dict` in JSON). """ + + self.type = None + """ What kind of device or device system this is. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.udiDeviceIdentifier = None + """ Unique Device Identifier (UDI) Barcode string. + List of `DeviceDefinitionUdiDeviceIdentifier` items (represented as `dict` in JSON). """ + + self.url = None + """ Network address to contact device. + Type `str`. """ + + self.version = None + """ Available versions. + List of `str` items. """ + + super(DeviceDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDefinition, self).elementProperties() + js.extend([ + ("capability", "capability", DeviceDefinitionCapability, True, None, False), + ("contact", "contact", contactpoint.ContactPoint, True, None, False), + ("deviceName", "deviceName", DeviceDefinitionDeviceName, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("languageCode", "languageCode", codeableconcept.CodeableConcept, True, None, False), + ("manufacturerReference", "manufacturerReference", fhirreference.FHIRReference, False, "manufacturer", False), + ("manufacturerString", "manufacturerString", str, False, "manufacturer", False), + ("material", "material", DeviceDefinitionMaterial, True, None, False), + ("modelNumber", "modelNumber", str, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("onlineInformation", "onlineInformation", str, False, None, False), + ("owner", "owner", fhirreference.FHIRReference, False, None, False), + ("parentDevice", "parentDevice", fhirreference.FHIRReference, False, None, False), + ("physicalCharacteristics", "physicalCharacteristics", prodcharacteristic.ProdCharacteristic, False, None, False), + ("property", "property", DeviceDefinitionProperty, True, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("safety", "safety", codeableconcept.CodeableConcept, True, None, False), + ("shelfLifeStorage", "shelfLifeStorage", productshelflife.ProductShelfLife, True, None, False), + ("specialization", "specialization", DeviceDefinitionSpecialization, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("udiDeviceIdentifier", "udiDeviceIdentifier", DeviceDefinitionUdiDeviceIdentifier, True, None, False), + ("url", "url", str, False, None, False), + ("version", "version", str, True, None, False), + ]) + return js + + +from . import backboneelement + +class DeviceDefinitionCapability(backboneelement.BackboneElement): + """ Device capabilities. + """ + + resource_type = "DeviceDefinitionCapability" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Description of capability. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of capability. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DeviceDefinitionCapability, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDefinitionCapability, self).elementProperties() + js.extend([ + ("description", "description", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class DeviceDefinitionDeviceName(backboneelement.BackboneElement): + """ A name given to the device to identify it. + """ + + resource_type = "DeviceDefinitionDeviceName" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.name = None + """ The name of the device. + Type `str`. """ + + self.type = None + """ udi-label-name | user-friendly-name | patient-reported-name | + manufacturer-name | model-name | other. + Type `str`. """ + + super(DeviceDefinitionDeviceName, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDefinitionDeviceName, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class DeviceDefinitionMaterial(backboneelement.BackboneElement): + """ A substance used to create the material(s) of which the device is made. + """ + + resource_type = "DeviceDefinitionMaterial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allergenicIndicator = None + """ Whether the substance is a known or suspected allergen. + Type `bool`. """ + + self.alternate = None + """ Indicates an alternative material of the device. + Type `bool`. """ + + self.substance = None + """ The substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DeviceDefinitionMaterial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDefinitionMaterial, self).elementProperties() + js.extend([ + ("allergenicIndicator", "allergenicIndicator", bool, False, None, False), + ("alternate", "alternate", bool, False, None, False), + ("substance", "substance", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class DeviceDefinitionProperty(backboneelement.BackboneElement): + """ The actual configuration settings of a device as it actually operates, + e.g., regulation status, time properties. + """ + + resource_type = "DeviceDefinitionProperty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.type = None + """ Code that specifies the property DeviceDefinitionPropetyCode + (Extensible). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueCode = None + """ Property value as a code, e.g., NTP4 (synced to NTP). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Property value as a quantity. + List of `Quantity` items (represented as `dict` in JSON). """ + + super(DeviceDefinitionProperty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDefinitionProperty, self).elementProperties() + js.extend([ + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("valueCode", "valueCode", codeableconcept.CodeableConcept, True, None, False), + ("valueQuantity", "valueQuantity", quantity.Quantity, True, None, False), + ]) + return js + + +class DeviceDefinitionSpecialization(backboneelement.BackboneElement): + """ The capabilities supported on a device, the standards to which the device + conforms for a particular purpose, and used for the communication. + """ + + resource_type = "DeviceDefinitionSpecialization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.systemType = None + """ The standard that is used to operate and communicate. + Type `str`. """ + + self.version = None + """ The version of the standard that is used to operate and communicate. + Type `str`. """ + + super(DeviceDefinitionSpecialization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDefinitionSpecialization, self).elementProperties() + js.extend([ + ("systemType", "systemType", str, False, None, True), + ("version", "version", str, False, None, False), + ]) + return js + + +class DeviceDefinitionUdiDeviceIdentifier(backboneelement.BackboneElement): + """ Unique Device Identifier (UDI) Barcode string. + + Unique device identifier (UDI) assigned to device label or package. Note + that the Device may include multiple udiCarriers as it either may include + just the udiCarrier for the jurisdiction it is sold, or for multiple + jurisdictions it could have been sold. + """ + + resource_type = "DeviceDefinitionUdiDeviceIdentifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.deviceIdentifier = None + """ The identifier that is to be associated with every Device that + references this DeviceDefintiion for the issuer and jurisdication + porvided in the DeviceDefinition.udiDeviceIdentifier. + Type `str`. """ + + self.issuer = None + """ The organization that assigns the identifier algorithm. + Type `str`. """ + + self.jurisdiction = None + """ The jurisdiction to which the deviceIdentifier applies. + Type `str`. """ + + super(DeviceDefinitionUdiDeviceIdentifier, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DeviceDefinitionUdiDeviceIdentifier, self).elementProperties() + js.extend([ + ("deviceIdentifier", "deviceIdentifier", str, False, None, True), + ("issuer", "issuer", str, False, None, True), + ("jurisdiction", "jurisdiction", str, False, None, True), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import prodcharacteristic +except ImportError: + prodcharacteristic = sys.modules[__package__ + '.prodcharacteristic'] +try: + from . import productshelflife +except ImportError: + productshelflife = sys.modules[__package__ + '.productshelflife'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/devicedefinition_tests.py b/fhirclient/models/devicedefinition_tests.py new file mode 100644 index 000000000..2d8ec40b6 --- /dev/null +++ b/fhirclient/models/devicedefinition_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import devicedefinition +from .fhirdate import FHIRDate + + +class DeviceDefinitionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("DeviceDefinition", js["resourceType"]) + return devicedefinition.DeviceDefinition(js) + + def testDeviceDefinition1(self): + inst = self.instantiate_from("devicedefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a DeviceDefinition instance") + self.implDeviceDefinition1(inst) + + js = inst.as_json() + self.assertEqual("DeviceDefinition", js["resourceType"]) + inst2 = devicedefinition.DeviceDefinition(js) + self.implDeviceDefinition1(inst2) + + def implDeviceDefinition1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].value, "0") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

identifier: 0

") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/devicemetric.py b/fhirclient/models/devicemetric.py index 007f1c1c4..b47b2f68a 100644 --- a/fhirclient/models/devicemetric.py +++ b/fhirclient/models/devicemetric.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -38,8 +38,8 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.identifier = None - """ Unique identifier of this DeviceMetric. - Type `Identifier` (represented as `dict` in JSON). """ + """ Instance identifier. + List of `Identifier` items (represented as `dict` in JSON). """ self.measurementPeriod = None """ Describes the measurement repetition time. @@ -50,12 +50,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.parent = None - """ Describes the link to the parent DeviceComponent. - Type `FHIRReference` referencing `DeviceComponent` (represented as `dict` in JSON). """ + """ Describes the link to the parent Device. + Type `FHIRReference` (represented as `dict` in JSON). """ self.source = None """ Describes the link to the source Device. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ Identity of metric, for example Heart Rate or PEEP Setting. @@ -73,7 +73,7 @@ def elementProperties(self): ("calibration", "calibration", DeviceMetricCalibration, True, None, False), ("category", "category", str, False, None, True), ("color", "color", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("measurementPeriod", "measurementPeriod", timing.Timing, False, None, False), ("operationalStatus", "operationalStatus", str, False, None, False), ("parent", "parent", fhirreference.FHIRReference, False, None, False), diff --git a/fhirclient/models/devicemetric_tests.py b/fhirclient/models/devicemetric_tests.py index d27214571..944c91be3 100644 --- a/fhirclient/models/devicemetric_tests.py +++ b/fhirclient/models/devicemetric_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -39,17 +39,20 @@ def implDeviceMetric1(self, inst): self.assertEqual(inst.category, "measurement") self.assertEqual(inst.color, "blue") self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.system, "http://goodcare.org/devicemetric/id") - self.assertEqual(inst.identifier.value, "345675") + self.assertEqual(inst.identifier[0].system, "http://goodcare.org/devicemetric/id") + self.assertEqual(inst.identifier[0].value, "345675") self.assertEqual(inst.measurementPeriod.repeat.frequency, 1) self.assertEqual(inst.measurementPeriod.repeat.period, 1) self.assertEqual(inst.measurementPeriod.repeat.periodUnit, "s") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.operationalStatus, "on") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "150456") self.assertEqual(inst.type.coding[0].display, "MDC_PULS_OXIM_SAT_O2") - self.assertEqual(inst.type.coding[0].system, "https://rtmms.nist.gov") + self.assertEqual(inst.type.coding[0].system, "urn:iso:std:iso:11073:10101") self.assertEqual(inst.unit.coding[0].code, "262688") self.assertEqual(inst.unit.coding[0].display, "MDC_DIM_PERCENT") - self.assertEqual(inst.unit.coding[0].system, "https://rtmms.nist.gov") + self.assertEqual(inst.unit.coding[0].system, "urn:iso:std:iso:11073:10101") diff --git a/fhirclient/models/devicerequest.py b/fhirclient/models/devicerequest.py index 6a7a16e09..494914c55 100644 --- a/fhirclient/models/devicerequest.py +++ b/fhirclient/models/devicerequest.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DeviceRequest) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceRequest) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -31,7 +31,7 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ What request fulfills. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.codeCodeableConcept = None """ Device requested. @@ -39,15 +39,11 @@ def __init__(self, jsondict=None, strict=True): self.codeReference = None """ Device requested. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.context = None - """ Encounter or Episode motivating request. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - - self.definition = None - """ Protocol or definition. - List of `FHIRReference` items referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter motivating request. + Type `FHIRReference` (represented as `dict` in JSON). """ self.groupIdentifier = None """ Identifier of composite request. @@ -57,9 +53,21 @@ def __init__(self, jsondict=None, strict=True): """ External Request identifier. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + + self.insurance = None + """ Associated insurance coverage. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.intent = None """ proposal | plan | original-order | encoded | reflex-order. - Type `CodeableConcept` (represented as `dict` in JSON). """ + Type `str`. """ self.note = None """ Notes or comments. @@ -77,17 +85,21 @@ def __init__(self, jsondict=None, strict=True): """ Desired time or schedule for use. Type `Timing` (represented as `dict` in JSON). """ + self.parameter = None + """ Device details. + List of `DeviceRequestParameter` items (represented as `dict` in JSON). """ + self.performer = None """ Requested Filler. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson, HealthcareService` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.performerType = None - """ Fille role. + """ Filler role. Type `CodeableConcept` (represented as `dict` in JSON). """ self.priorRequest = None """ What request replaces. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.priority = None """ Indicates how quickly the {{title}} should be addressed with @@ -100,15 +112,15 @@ def __init__(self, jsondict=None, strict=True): self.reasonReference = None """ Linked Reason for request. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.relevantHistory = None """ Request provenance. - List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.requester = None """ Who/what is requesting diagnostics. - Type `DeviceRequestRequester` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ draft | active | suspended | completed | entered-in-error | @@ -117,11 +129,11 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Focus of request. - Type `FHIRReference` referencing `Patient, Group, Location, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.supportingInfo = None """ Additional clinical information. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(DeviceRequest, self).__init__(jsondict=jsondict, strict=strict) @@ -132,15 +144,18 @@ def elementProperties(self): ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("codeCodeableConcept", "codeCodeableConcept", codeableconcept.CodeableConcept, False, "code", True), ("codeReference", "codeReference", fhirreference.FHIRReference, False, "code", True), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("intent", "intent", codeableconcept.CodeableConcept, False, None, True), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), + ("insurance", "insurance", fhirreference.FHIRReference, True, None, False), + ("intent", "intent", str, False, None, True), ("note", "note", annotation.Annotation, True, None, False), ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), + ("parameter", "parameter", DeviceRequestParameter, True, None, False), ("performer", "performer", fhirreference.FHIRReference, False, None, False), ("performerType", "performerType", codeableconcept.CodeableConcept, False, None, False), ("priorRequest", "priorRequest", fhirreference.FHIRReference, True, None, False), @@ -148,7 +163,7 @@ def elementProperties(self): ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, None, False), - ("requester", "requester", DeviceRequestRequester, False, None, False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), @@ -158,14 +173,14 @@ def elementProperties(self): from . import backboneelement -class DeviceRequestRequester(backboneelement.BackboneElement): - """ Who/what is requesting diagnostics. +class DeviceRequestParameter(backboneelement.BackboneElement): + """ Device details. - The individual who initiated the request and has responsibility for its - activation. + Specific parameters for the ordered item. For example, the prism value for + lenses. """ - resource_type = "DeviceRequestRequester" + resource_type = "DeviceRequestParameter" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -175,21 +190,36 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.agent = None - """ Individual making the request. - Type `FHIRReference` referencing `Device, Practitioner, Organization` (represented as `dict` in JSON). """ + self.code = None + """ Device detail. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Value of detail. + Type `bool`. """ + + self.valueCodeableConcept = None + """ Value of detail. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Value of detail. + Type `Quantity` (represented as `dict` in JSON). """ - self.onBehalfOf = None - """ Organization agent is acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + self.valueRange = None + """ Value of detail. + Type `Range` (represented as `dict` in JSON). """ - super(DeviceRequestRequester, self).__init__(jsondict=jsondict, strict=strict) + super(DeviceRequestParameter, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(DeviceRequestRequester, self).elementProperties() + js = super(DeviceRequestParameter, self).elementProperties() js.extend([ - ("agent", "agent", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueRange", "valueRange", range.Range, False, "value", False), ]) return js @@ -219,6 +249,14 @@ def elementProperties(self): from . import period except ImportError: period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] try: from . import timing except ImportError: diff --git a/fhirclient/models/devicerequest_tests.py b/fhirclient/models/devicerequest_tests.py index 7029188db..adbc8ed39 100644 --- a/fhirclient/models/devicerequest_tests.py +++ b/fhirclient/models/devicerequest_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -40,7 +40,11 @@ def implDeviceRequest1(self, inst): self.assertEqual(inst.groupIdentifier.value, "ip_request1") self.assertEqual(inst.id, "insulinpump") self.assertEqual(inst.identifier[0].value, "ip_request1.1") - self.assertEqual(inst.intent.text, "instance-order") + self.assertEqual(inst.instantiatesCanonical[0], "http://motivemi.com/artifacts/PlanDefinition/low-suicide-risk-order-set") + self.assertEqual(inst.intent, "instance-order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "this is the right device brand and model") self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2013-05-08T09:33:27+07:00").date) self.assertEqual(inst.occurrenceDateTime.as_json(), "2013-05-08T09:33:27+07:00") @@ -63,7 +67,10 @@ def testDeviceRequest2(self): def implDeviceRequest2(self, inst): self.assertEqual(inst.id, "example") - self.assertEqual(inst.intent.coding[0].code, "original-order") + self.assertEqual(inst.intent, "original-order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/deviceusestatement.py b/fhirclient/models/deviceusestatement.py index 74ab75917..d0de8a817 100644 --- a/fhirclient/models/deviceusestatement.py +++ b/fhirclient/models/deviceusestatement.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -24,33 +24,45 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.basedOn = None + """ Fulfills plan, proposal or order. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.bodySite = None """ Target body site. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.derivedFrom = None + """ Supporting information. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.device = None """ Reference to device used. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ External identifier for this record. List of `Identifier` items (represented as `dict` in JSON). """ - self.indication = None - """ Why device was used. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.note = None """ Addition details (comments, instructions). List of `Annotation` items (represented as `dict` in JSON). """ + self.reasonCode = None + """ Why device was used. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why was DeviceUseStatement performed?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.recordedOn = None """ When statement was recorded. Type `FHIRDate` (represented as `str` in JSON). """ self.source = None """ Who made the statement. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | completed | entered-in-error +. @@ -58,7 +70,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Patient using device. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.timingDateTime = None """ How often the device was used. @@ -72,20 +84,19 @@ def __init__(self, jsondict=None, strict=True): """ How often the device was used. Type `Timing` (represented as `dict` in JSON). """ - self.whenUsed = None - """ Period device was used. - Type `Period` (represented as `dict` in JSON). """ - super(DeviceUseStatement, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(DeviceUseStatement, self).elementProperties() js.extend([ + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), + ("derivedFrom", "derivedFrom", fhirreference.FHIRReference, True, None, False), ("device", "device", fhirreference.FHIRReference, False, None, True), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("indication", "indication", codeableconcept.CodeableConcept, True, None, False), ("note", "note", annotation.Annotation, True, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("recordedOn", "recordedOn", fhirdate.FHIRDate, False, None, False), ("source", "source", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, True), @@ -93,7 +104,6 @@ def elementProperties(self): ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), ("timingTiming", "timingTiming", timing.Timing, False, "timing", False), - ("whenUsed", "whenUsed", period.Period, False, None, False), ]) return js diff --git a/fhirclient/models/deviceusestatement_tests.py b/fhirclient/models/deviceusestatement_tests.py index b063f9835..ecbfaae72 100644 --- a/fhirclient/models/deviceusestatement_tests.py +++ b/fhirclient/models/deviceusestatement_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -35,6 +35,9 @@ def implDeviceUseStatement1(self, inst): self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http:goodhealth.org/identifiers") self.assertEqual(inst.identifier[0].value, "51ebb7a9-4e3a-4360-9a05-0cc2d869086f") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/diagnosticreport.py b/fhirclient/models/diagnosticreport.py index 9cbfb5462..707c80620 100644 --- a/fhirclient/models/diagnosticreport.py +++ b/fhirclient/models/diagnosticreport.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -30,27 +30,23 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ What was requested. - List of `FHIRReference` items referencing `CarePlan, ImmunizationRecommendation, MedicationRequest, NutritionOrder, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ Service category. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.code = None """ Name/Code for this diagnostic report. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.codedDiagnosis = None - """ Codes for the conclusion. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.conclusion = None - """ Clinical Interpretation of test results. + """ Clinical conclusion (interpretation) of test results. Type `str`. """ - self.context = None - """ Health care event when test ordered. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.conclusionCode = None + """ Codes for the clinical conclusion of test results. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.effectiveDateTime = None """ Clinically relevant time/time-period for report. @@ -60,38 +56,46 @@ def __init__(self, jsondict=None, strict=True): """ Clinically relevant time/time-period for report. Type `Period` (represented as `dict` in JSON). """ + self.encounter = None + """ Health care event when test ordered. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.identifier = None """ Business identifier for report. List of `Identifier` items (represented as `dict` in JSON). """ - self.image = None - """ Key images associated with this report. - List of `DiagnosticReportImage` items (represented as `dict` in JSON). """ - self.imagingStudy = None """ Reference to full details of imaging associated with the diagnostic report. - List of `FHIRReference` items referencing `ImagingStudy, ImagingManifest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.issued = None - """ DateTime this version was released. + """ DateTime this version was made. Type `FHIRDate` (represented as `str` in JSON). """ + self.media = None + """ Key images associated with this report. + List of `DiagnosticReportMedia` items (represented as `dict` in JSON). """ + self.performer = None - """ Participants in producing the report. - List of `DiagnosticReportPerformer` items (represented as `dict` in JSON). """ + """ Responsible Diagnostic Service. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.presentedForm = None """ Entire report as issued. List of `Attachment` items (represented as `dict` in JSON). """ self.result = None - """ Observations - simple, or complex nested groups. - List of `FHIRReference` items referencing `Observation` (represented as `dict` in JSON). """ + """ Observations. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.resultsInterpreter = None + """ Primary result interpreter. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.specimen = None """ Specimens this report is based on. - List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ registered | partial | preliminary | final +. @@ -99,7 +103,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ The subject of the report - usually, but not always, the patient. - Type `FHIRReference` referencing `Patient, Group, Device, Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(DiagnosticReport, self).__init__(jsondict=jsondict, strict=strict) @@ -107,20 +111,21 @@ def elementProperties(self): js = super(DiagnosticReport, self).elementProperties() js.extend([ ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("codedDiagnosis", "codedDiagnosis", codeableconcept.CodeableConcept, True, None, False), ("conclusion", "conclusion", str, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), + ("conclusionCode", "conclusionCode", codeableconcept.CodeableConcept, True, None, False), ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("image", "image", DiagnosticReportImage, True, None, False), ("imagingStudy", "imagingStudy", fhirreference.FHIRReference, True, None, False), ("issued", "issued", fhirdate.FHIRDate, False, None, False), - ("performer", "performer", DiagnosticReportPerformer, True, None, False), + ("media", "media", DiagnosticReportMedia, True, None, False), + ("performer", "performer", fhirreference.FHIRReference, True, None, False), ("presentedForm", "presentedForm", attachment.Attachment, True, None, False), ("result", "result", fhirreference.FHIRReference, True, None, False), + ("resultsInterpreter", "resultsInterpreter", fhirreference.FHIRReference, True, None, False), ("specimen", "specimen", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, True), ("subject", "subject", fhirreference.FHIRReference, False, None, False), @@ -130,7 +135,7 @@ def elementProperties(self): from . import backboneelement -class DiagnosticReportImage(backboneelement.BackboneElement): +class DiagnosticReportMedia(backboneelement.BackboneElement): """ Key images associated with this report. A list of key images associated with this report. The images are generally @@ -138,7 +143,7 @@ class DiagnosticReportImage(backboneelement.BackboneElement): or of treated specimens (i.e. slides of interest). """ - resource_type = "DiagnosticReportImage" + resource_type = "DiagnosticReportMedia" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -154,12 +159,12 @@ def __init__(self, jsondict=None, strict=True): self.link = None """ Reference to the image source. - Type `FHIRReference` referencing `Media` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - super(DiagnosticReportImage, self).__init__(jsondict=jsondict, strict=strict) + super(DiagnosticReportMedia, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(DiagnosticReportImage, self).elementProperties() + js = super(DiagnosticReportMedia, self).elementProperties() js.extend([ ("comment", "comment", str, False, None, False), ("link", "link", fhirreference.FHIRReference, False, None, True), @@ -167,41 +172,6 @@ def elementProperties(self): return js -class DiagnosticReportPerformer(backboneelement.BackboneElement): - """ Participants in producing the report. - - Indicates who or what participated in producing the report. - """ - - resource_type = "DiagnosticReportPerformer" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.actor = None - """ Practitioner or Organization participant. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ - - self.role = None - """ Type of performer. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(DiagnosticReportPerformer, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DiagnosticReportPerformer, self).elementProperties() - js.extend([ - ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - import sys try: from . import attachment diff --git a/fhirclient/models/diagnosticreport_tests.py b/fhirclient/models/diagnosticreport_tests.py index f29b20835..d20113665 100644 --- a/fhirclient/models/diagnosticreport_tests.py +++ b/fhirclient/models/diagnosticreport_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return diagnosticreport.DiagnosticReport(js) def testDiagnosticReport1(self): - inst = self.instantiate_from("diagnosticreport-example-dxa.json") + inst = self.instantiate_from("diagnosticreport-example-ultrasound.json") self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") self.implDiagnosticReport1(inst) @@ -32,26 +32,30 @@ def testDiagnosticReport1(self): self.implDiagnosticReport1(inst2) def implDiagnosticReport1(self, inst): - self.assertEqual(inst.code.coding[0].code, "38269-7") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "DXA BONE DENSITOMETRY") - self.assertEqual(inst.codedDiagnosis[0].coding[0].code, "391040000") - self.assertEqual(inst.codedDiagnosis[0].coding[0].display, "At risk of osteoporotic fracture") - self.assertEqual(inst.codedDiagnosis[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2008-06-17").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2008-06-17") - self.assertEqual(inst.id, "102") - self.assertEqual(inst.issued.date, FHIRDate("2008-06-18T09:23:00+10:00").date) - self.assertEqual(inst.issued.as_json(), "2008-06-18T09:23:00+10:00") - self.assertEqual(inst.performer[0].role.coding[0].code, "66862007") - self.assertEqual(inst.performer[0].role.coding[0].display, "Radiologist") - self.assertEqual(inst.performer[0].role.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.performer[0].role.text, "Radiologist") + self.assertEqual(inst.category[0].coding[0].code, "394914008") + self.assertEqual(inst.category[0].coding[0].display, "Radiology") + self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].coding[1].code, "RAD") + self.assertEqual(inst.category[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/v2-0074") + self.assertEqual(inst.code.coding[0].code, "45036003") + self.assertEqual(inst.code.coding[0].display, "Ultrasonography of abdomen") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Abdominal Ultrasound") + self.assertEqual(inst.conclusion, "Unremarkable study") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2012-12-01T12:00:00+01:00").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2012-12-01T12:00:00+01:00") + self.assertEqual(inst.id, "ultrasound") + self.assertEqual(inst.issued.date, FHIRDate("2012-12-01T12:00:00+01:00").date) + self.assertEqual(inst.issued.as_json(), "2012-12-01T12:00:00+01:00") + self.assertEqual(inst.media[0].comment, "A comment about the image") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") def testDiagnosticReport2(self): - inst = self.instantiate_from("diagnosticreport-example-f001-bloodexam.json") + inst = self.instantiate_from("diagnosticreport-example-f201-brainct.json") self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") self.implDiagnosticReport2(inst) @@ -61,138 +65,69 @@ def testDiagnosticReport2(self): self.implDiagnosticReport2(inst2) def implDiagnosticReport2(self, inst): - self.assertEqual(inst.category.coding[0].code, "252275004") - self.assertEqual(inst.category.coding[0].display, "Haematology test") - self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category.coding[1].code, "HM") - self.assertEqual(inst.category.coding[1].system, "http://hl7.org/fhir/v2/0074") - self.assertEqual(inst.code.coding[0].code, "58410-2") - self.assertEqual(inst.code.coding[0].display, "Complete blood count (hemogram) panel - Blood by Automated count") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.conclusion, "Core lab") - self.assertEqual(inst.contained[0].id, "req") - self.assertEqual(inst.id, "f001") - self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/reports") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "nr1239044") - self.assertEqual(inst.issued.date, FHIRDate("2013-05-15T19:32:52+01:00").date) - self.assertEqual(inst.issued.as_json(), "2013-05-15T19:32:52+01:00") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "generated") - - def testDiagnosticReport3(self): - inst = self.instantiate_from("diagnosticreport-example-f201-brainct.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport3(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport3(inst2) - - def implDiagnosticReport3(self, inst): - self.assertEqual(inst.category.coding[0].code, "394914008") - self.assertEqual(inst.category.coding[0].display, "Radiology") - self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category.coding[1].code, "RAD") - self.assertEqual(inst.category.coding[1].system, "http://hl7.org/fhir/v2/0074") + self.assertEqual(inst.category[0].coding[0].code, "394914008") + self.assertEqual(inst.category[0].coding[0].display, "Radiology") + self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].coding[1].code, "RAD") + self.assertEqual(inst.category[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/v2-0074") self.assertEqual(inst.code.coding[0].code, "429858000") self.assertEqual(inst.code.coding[0].display, "Computed tomography (CT) of head and neck") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.code.text, "CT of head-neck") - self.assertEqual(inst.codedDiagnosis[0].coding[0].code, "188340000") - self.assertEqual(inst.codedDiagnosis[0].coding[0].display, "Malignant tumor of craniopharyngeal duct") - self.assertEqual(inst.codedDiagnosis[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.conclusion, "CT brains: large tumor sphenoid/clivus.") + self.assertEqual(inst.conclusionCode[0].coding[0].code, "188340000") + self.assertEqual(inst.conclusionCode[0].coding[0].display, "Malignant tumor of craniopharyngeal duct") + self.assertEqual(inst.conclusionCode[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2012-12-01T12:00:00+01:00").date) self.assertEqual(inst.effectiveDateTime.as_json(), "2012-12-01T12:00:00+01:00") self.assertEqual(inst.id, "f201") self.assertEqual(inst.issued.date, FHIRDate("2012-12-01T12:00:00+01:00").date) self.assertEqual(inst.issued.as_json(), "2012-12-01T12:00:00+01:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - def testDiagnosticReport4(self): - inst = self.instantiate_from("diagnosticreport-example-f202-bloodculture.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport4(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport4(inst2) - - def implDiagnosticReport4(self, inst): - self.assertEqual(inst.category.coding[0].code, "15220000") - self.assertEqual(inst.category.coding[0].display, "Laboratory test") - self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category.coding[1].code, "LAB") - self.assertEqual(inst.category.coding[1].system, "http://hl7.org/fhir/v2/0074") - self.assertEqual(inst.code.coding[0].code, "104177005") - self.assertEqual(inst.code.coding[0].display, "Blood culture for bacteria, including anaerobic screen") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.codedDiagnosis[0].coding[0].code, "428763004") - self.assertEqual(inst.codedDiagnosis[0].coding[0].display, "Bacteremia due to staphylococcus") - self.assertEqual(inst.codedDiagnosis[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.conclusion, "Blood culture tested positive on staphylococcus aureus") - self.assertEqual(inst.contained[0].id, "req") - self.assertEqual(inst.id, "f202") - self.assertEqual(inst.issued.date, FHIRDate("2013-03-11T10:28:00+01:00").date) - self.assertEqual(inst.issued.as_json(), "2013-03-11T10:28:00+01:00") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "generated") - - def testDiagnosticReport5(self): - inst = self.instantiate_from("diagnosticreport-example-ghp.json") + def testDiagnosticReport3(self): + inst = self.instantiate_from("diagnosticreport-example-papsmear.json") self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport5(inst) + self.implDiagnosticReport3(inst) js = inst.as_json() self.assertEqual("DiagnosticReport", js["resourceType"]) inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport5(inst2) + self.implDiagnosticReport3(inst2) - def implDiagnosticReport5(self, inst): - self.assertEqual(inst.code.coding[0].code, "GHP") - self.assertEqual(inst.code.coding[0].display, "General Health Profile") - self.assertEqual(inst.code.coding[0].system, "http://acme.com/labs/reports") - self.assertEqual(inst.contained[0].id, "rtt") - self.assertEqual(inst.contained[1].id, "ltt") - self.assertEqual(inst.contained[2].id, "urine") - self.assertEqual(inst.contained[3].id, "p2") - self.assertEqual(inst.contained[4].id, "r1") - self.assertEqual(inst.contained[5].id, "r2") - self.assertEqual(inst.contained[6].id, "r3") - self.assertEqual(inst.contained[7].id, "r4") - self.assertEqual(inst.contained[8].id, "r5") - self.assertEqual(inst.contained[9].id, "r6") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2015-08-16T06:40:17Z").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2015-08-16T06:40:17Z") - self.assertEqual(inst.id, "ghp") - self.assertEqual(inst.identifier[0].system, "http://acme.com/lab/reports") - self.assertEqual(inst.identifier[0].value, "ghp-example") - self.assertEqual(inst.issued.date, FHIRDate("2015-08-17T06:40:17Z").date) - self.assertEqual(inst.issued.as_json(), "2015-08-17T06:40:17Z") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2015-08-16T10:35:23Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2015-08-16T10:35:23Z") + def implDiagnosticReport3(self, inst): + self.assertEqual(inst.code.coding[0].code, "47527-7") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2013-02-11T10:33:33+11:00").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2013-02-11T10:33:33+11:00") + self.assertEqual(inst.id, "pap") + self.assertEqual(inst.issued.date, FHIRDate("2013-02-13T11:45:33+11:00").date) + self.assertEqual(inst.issued.as_json(), "2013-02-13T11:45:33+11:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.text.status, "additional") - def testDiagnosticReport6(self): + def testDiagnosticReport4(self): inst = self.instantiate_from("diagnosticreport-example-gingival-mass.json") self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport6(inst) + self.implDiagnosticReport4(inst) js = inst.as_json() self.assertEqual("DiagnosticReport", js["resourceType"]) inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport6(inst2) + self.implDiagnosticReport4(inst2) - def implDiagnosticReport6(self, inst): - self.assertEqual(inst.category.coding[0].code, "PAT") - self.assertEqual(inst.category.coding[0].display, "Pathology (gross & histopath, not surgical)") - self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/v2/0074") - self.assertEqual(inst.category.text, "Pathology") + def implDiagnosticReport4(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "PAT") + self.assertEqual(inst.category[0].coding[0].display, "Pathology (gross & histopath, not surgical)") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0074") + self.assertEqual(inst.category[0].text, "Pathology") self.assertEqual(inst.code.coding[0].code, "4503") self.assertEqual(inst.code.coding[0].display, "Biopsy without Microscopic Description (1 Site/Lesion)-Standard") self.assertEqual(inst.code.coding[0].system, "https://www.acmeonline.com") @@ -204,75 +139,26 @@ def implDiagnosticReport6(self, inst): self.assertEqual(inst.identifier[0].value, "P73456090") self.assertEqual(inst.issued.date, FHIRDate("2017-03-15T08:13:08Z").date) self.assertEqual(inst.issued.as_json(), "2017-03-15T08:13:08Z") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.presentedForm[0].contentType, "application/pdf") self.assertEqual(inst.presentedForm[0].language, "en") self.assertEqual(inst.presentedForm[0].title, "LAB ID: P73456090 MAX JONES Biopsy without Microscopic Description (1 Site/Lesion)-Standard") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - def testDiagnosticReport7(self): - inst = self.instantiate_from("diagnosticreport-example-lipids.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport7(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport7(inst2) - - def implDiagnosticReport7(self, inst): - self.assertEqual(inst.category.coding[0].code, "HM") - self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/v2/0074") - self.assertEqual(inst.code.coding[0].code, "24331-1") - self.assertEqual(inst.code.coding[0].display, "Lipid 1996 panel - Serum or Plasma") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "Lipid Panel") - self.assertEqual(inst.contained[0].id, "cholesterol") - self.assertEqual(inst.contained[1].id, "triglyceride") - self.assertEqual(inst.contained[2].id, "hdlcholesterol") - self.assertEqual(inst.contained[3].id, "ldlcholesterol") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2011-03-04T08:30:00+11:00").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2011-03-04T08:30:00+11:00") - self.assertEqual(inst.id, "lipids") - self.assertEqual(inst.identifier[0].system, "http://acme.com/lab/reports") - self.assertEqual(inst.identifier[0].value, "5234342") - self.assertEqual(inst.issued.date, FHIRDate("2013-01-27T11:45:33+11:00").date) - self.assertEqual(inst.issued.as_json(), "2013-01-27T11:45:33+11:00") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "generated") - - def testDiagnosticReport8(self): - inst = self.instantiate_from("diagnosticreport-example-papsmear.json") - self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport8(inst) - - js = inst.as_json() - self.assertEqual("DiagnosticReport", js["resourceType"]) - inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport8(inst2) - - def implDiagnosticReport8(self, inst): - self.assertEqual(inst.code.coding[0].code, "47527-7") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2013-02-11T10:33:33+11:00").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2013-02-11T10:33:33+11:00") - self.assertEqual(inst.id, "pap") - self.assertEqual(inst.issued.date, FHIRDate("2013-02-13T11:45:33+11:00").date) - self.assertEqual(inst.issued.as_json(), "2013-02-13T11:45:33+11:00") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "additional") - - def testDiagnosticReport9(self): + def testDiagnosticReport5(self): inst = self.instantiate_from("diagnosticreport-example-pgx.json") self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport9(inst) + self.implDiagnosticReport5(inst) js = inst.as_json() self.assertEqual("DiagnosticReport", js["resourceType"]) inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport9(inst2) + self.implDiagnosticReport5(inst2) - def implDiagnosticReport9(self, inst): + def implDiagnosticReport5(self, inst): self.assertEqual(inst.code.coding[0].code, "PGxReport") self.assertEqual(inst.code.coding[0].display, "Pharmacogenetics Report") self.assertEqual(inst.code.coding[0].system, "https://system/PGxReport") @@ -282,7 +168,10 @@ def implDiagnosticReport9(self, inst): self.assertEqual(inst.id, "example-pgx") self.assertEqual(inst.issued.date, FHIRDate("2016-10-20T14:00:05+11:00").date) self.assertEqual(inst.issued.as_json(), "2016-10-20T14:00:05+11:00") - self.assertEqual(inst.presentedForm[0].contentType, "PDF") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.presentedForm[0].contentType, "application/pdf") self.assertEqual(inst.presentedForm[0].creation.date, FHIRDate("2016-10-20T20:00:00+11:00").date) self.assertEqual(inst.presentedForm[0].creation.as_json(), "2016-10-20T20:00:00+11:00") self.assertEqual(inst.presentedForm[0].data, "cGRmSW5CYXNlNjRCaW5hcnk=") @@ -292,33 +181,31 @@ def implDiagnosticReport9(self, inst): self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - def testDiagnosticReport10(self): - inst = self.instantiate_from("diagnosticreport-example-ultrasound.json") + def testDiagnosticReport6(self): + inst = self.instantiate_from("diagnosticreport-example-dxa.json") self.assertIsNotNone(inst, "Must have instantiated a DiagnosticReport instance") - self.implDiagnosticReport10(inst) + self.implDiagnosticReport6(inst) js = inst.as_json() self.assertEqual("DiagnosticReport", js["resourceType"]) inst2 = diagnosticreport.DiagnosticReport(js) - self.implDiagnosticReport10(inst2) + self.implDiagnosticReport6(inst2) - def implDiagnosticReport10(self, inst): - self.assertEqual(inst.category.coding[0].code, "394914008") - self.assertEqual(inst.category.coding[0].display, "Radiology") - self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category.coding[1].code, "RAD") - self.assertEqual(inst.category.coding[1].system, "http://hl7.org/fhir/v2/0074") - self.assertEqual(inst.code.coding[0].code, "45036003") - self.assertEqual(inst.code.coding[0].display, "Ultrasonography of abdomen") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Abdominal Ultrasound") - self.assertEqual(inst.conclusion, "Unremarkable study") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2012-12-01T12:00:00+01:00").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2012-12-01T12:00:00+01:00") - self.assertEqual(inst.id, "ultrasound") - self.assertEqual(inst.image[0].comment, "A comment about the image") - self.assertEqual(inst.issued.date, FHIRDate("2012-12-01T12:00:00+01:00").date) - self.assertEqual(inst.issued.as_json(), "2012-12-01T12:00:00+01:00") + def implDiagnosticReport6(self, inst): + self.assertEqual(inst.code.coding[0].code, "38269-7") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "DXA BONE DENSITOMETRY") + self.assertEqual(inst.conclusionCode[0].coding[0].code, "391040000") + self.assertEqual(inst.conclusionCode[0].coding[0].display, "At risk of osteoporotic fracture") + self.assertEqual(inst.conclusionCode[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2008-06-17").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2008-06-17") + self.assertEqual(inst.id, "102") + self.assertEqual(inst.issued.date, FHIRDate("2008-06-18T09:23:00+10:00").date) + self.assertEqual(inst.issued.as_json(), "2008-06-18T09:23:00+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/distance.py b/fhirclient/models/distance.py index 9bf236aea..836da615f 100644 --- a/fhirclient/models/distance.py +++ b/fhirclient/models/distance.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Distance) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Distance) on 2019-05-07. +# 2019, SMART Health IT. from . import quantity diff --git a/fhirclient/models/documentmanifest.py b/fhirclient/models/documentmanifest.py index 0e51076ad..2d25db3a8 100644 --- a/fhirclient/models/documentmanifest.py +++ b/fhirclient/models/documentmanifest.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -25,12 +25,12 @@ def __init__(self, jsondict=None, strict=True): """ self.author = None - """ Who and/or what authored the manifest. - List of `FHIRReference` items referencing `Practitioner, Organization, Device, Patient, RelatedPerson` (represented as `dict` in JSON). """ + """ Who and/or what authored the DocumentManifest. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.content = None - """ The items included. - List of `DocumentManifestContent` items (represented as `dict` in JSON). """ + """ Items in manifest. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.created = None """ When this document manifest created. @@ -50,7 +50,7 @@ def __init__(self, jsondict=None, strict=True): self.recipient = None """ Intended to get notified about this set of documents. - List of `FHIRReference` items referencing `Patient, Practitioner, RelatedPerson, Organization` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.related = None """ Related things. @@ -66,7 +66,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ The subject of the set of documents. - Type `FHIRReference` referencing `Patient, Practitioner, Group, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ Kind of document set. @@ -78,7 +78,7 @@ def elementProperties(self): js = super(DocumentManifest, self).elementProperties() js.extend([ ("author", "author", fhirreference.FHIRReference, True, None, False), - ("content", "content", DocumentManifestContent, True, None, True), + ("content", "content", fhirreference.FHIRReference, True, None, True), ("created", "created", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), @@ -95,41 +95,6 @@ def elementProperties(self): from . import backboneelement -class DocumentManifestContent(backboneelement.BackboneElement): - """ The items included. - - The list of Documents included in the manifest. - """ - - resource_type = "DocumentManifestContent" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.pAttachment = None - """ Contents of this set of documents. - Type `Attachment` (represented as `dict` in JSON). """ - - self.pReference = None - """ Contents of this set of documents. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - super(DocumentManifestContent, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DocumentManifestContent, self).elementProperties() - js.extend([ - ("pAttachment", "pAttachment", attachment.Attachment, False, "p", True), - ("pReference", "pReference", fhirreference.FHIRReference, False, "p", True), - ]) - return js - - class DocumentManifestRelated(backboneelement.BackboneElement): """ Related things. @@ -152,7 +117,7 @@ def __init__(self, jsondict=None, strict=True): self.ref = None """ Related Resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(DocumentManifestRelated, self).__init__(jsondict=jsondict, strict=strict) @@ -166,10 +131,6 @@ def elementProperties(self): import sys -try: - from . import attachment -except ImportError: - attachment = sys.modules[__package__ + '.attachment'] try: from . import codeableconcept except ImportError: diff --git a/fhirclient/models/documentmanifest_tests.py b/fhirclient/models/documentmanifest_tests.py index f486e1d0b..4d2328960 100644 --- a/fhirclient/models/documentmanifest_tests.py +++ b/fhirclient/models/documentmanifest_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -41,6 +41,9 @@ def implDocumentManifest1(self, inst): self.assertEqual(inst.identifier[0].value, "23425234234-2347") self.assertEqual(inst.masterIdentifier.system, "http://example.org/documents") self.assertEqual(inst.masterIdentifier.value, "23425234234-2346") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.related[0].identifier.system, "http://example.org/documents") self.assertEqual(inst.related[0].identifier.value, "23425234234-9999") self.assertEqual(inst.source, "urn:oid:1.3.6.1.4.1.21367.2009.1.2.1") diff --git a/fhirclient/models/documentreference.py b/fhirclient/models/documentreference.py index 9bbf57c87..219e47c89 100644 --- a/fhirclient/models/documentreference.py +++ b/fhirclient/models/documentreference.py @@ -1,14 +1,20 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class DocumentReference(domainresource.DomainResource): """ A reference to a document. + + A reference to a document of any kind for any purpose. Provides metadata + about the document so that the document can be discovered and managed. The + scope of a document is any seralized object with a mime-type, so includes + formal patient centric documents (CDA), cliical notes, scanned paper, and + non-patient specific documents like policy text. """ resource_type = "DocumentReference" @@ -23,15 +29,15 @@ def __init__(self, jsondict=None, strict=True): self.authenticator = None """ Who/what authenticated the document. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.author = None """ Who and/or what authored the document. - List of `FHIRReference` items referencing `Practitioner, Organization, Device, Patient, RelatedPerson` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.class_fhir = None + self.category = None """ Categorization of document. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.content = None """ Document referenced. @@ -41,16 +47,16 @@ def __init__(self, jsondict=None, strict=True): """ Clinical context of document. Type `DocumentReferenceContext` (represented as `dict` in JSON). """ - self.created = None - """ Document creation time. - Type `FHIRDate` (represented as `str` in JSON). """ - self.custodian = None """ Organization which maintains the document. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.date = None + """ When this document reference was created. + Type `FHIRDate` (represented as `str` in JSON). """ self.description = None - """ Human-readable description (title). + """ Human-readable description. Type `str`. """ self.docStatus = None @@ -61,10 +67,6 @@ def __init__(self, jsondict=None, strict=True): """ Other identifiers for the document. List of `Identifier` items (represented as `dict` in JSON). """ - self.indexed = None - """ When this document reference was created. - Type `FHIRDate` (represented as `str` in JSON). """ - self.masterIdentifier = None """ Master Version Specific Identifier. Type `Identifier` (represented as `dict` in JSON). """ @@ -83,7 +85,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Who/what is the subject of the document. - Type `FHIRReference` referencing `Patient, Practitioner, Group, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ Kind of document (LOINC if possible). @@ -96,21 +98,20 @@ def elementProperties(self): js.extend([ ("authenticator", "authenticator", fhirreference.FHIRReference, False, None, False), ("author", "author", fhirreference.FHIRReference, True, None, False), - ("class_fhir", "class", codeableconcept.CodeableConcept, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("content", "content", DocumentReferenceContent, True, None, True), ("context", "context", DocumentReferenceContext, False, None, False), - ("created", "created", fhirdate.FHIRDate, False, None, False), ("custodian", "custodian", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), ("docStatus", "docStatus", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("indexed", "indexed", fhirdate.FHIRDate, False, None, True), ("masterIdentifier", "masterIdentifier", identifier.Identifier, False, None, False), ("relatesTo", "relatesTo", DocumentReferenceRelatesTo, True, None, False), ("securityLabel", "securityLabel", codeableconcept.CodeableConcept, True, None, False), ("status", "status", str, False, None, True), ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -171,7 +172,7 @@ def __init__(self, jsondict=None, strict=True): self.encounter = None """ Context of the document content. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.event = None """ Main clinical acts documented. @@ -192,63 +193,28 @@ def __init__(self, jsondict=None, strict=True): self.related = None """ Related identifiers or resources. - List of `DocumentReferenceContextRelated` items (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.sourcePatientInfo = None """ Patient demographics from source. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(DocumentReferenceContext, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(DocumentReferenceContext, self).elementProperties() js.extend([ - ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), ("event", "event", codeableconcept.CodeableConcept, True, None, False), ("facilityType", "facilityType", codeableconcept.CodeableConcept, False, None, False), ("period", "period", period.Period, False, None, False), ("practiceSetting", "practiceSetting", codeableconcept.CodeableConcept, False, None, False), - ("related", "related", DocumentReferenceContextRelated, True, None, False), + ("related", "related", fhirreference.FHIRReference, True, None, False), ("sourcePatientInfo", "sourcePatientInfo", fhirreference.FHIRReference, False, None, False), ]) return js -class DocumentReferenceContextRelated(backboneelement.BackboneElement): - """ Related identifiers or resources. - - Related identifiers or resources associated with the DocumentReference. - """ - - resource_type = "DocumentReferenceContextRelated" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.identifier = None - """ Identifier of related objects or events. - Type `Identifier` (represented as `dict` in JSON). """ - - self.ref = None - """ Related Resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - super(DocumentReferenceContextRelated, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(DocumentReferenceContextRelated, self).elementProperties() - js.extend([ - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("ref", "ref", fhirreference.FHIRReference, False, None, False), - ]) - return js - - class DocumentReferenceRelatesTo(backboneelement.BackboneElement): """ Relationships to other documents. @@ -272,7 +238,7 @@ def __init__(self, jsondict=None, strict=True): self.target = None """ Target of the relationship. - Type `FHIRReference` referencing `DocumentReference` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(DocumentReferenceRelatesTo, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/documentreference_tests.py b/fhirclient/models/documentreference_tests.py index b01b2a7a7..bb394fb85 100644 --- a/fhirclient/models/documentreference_tests.py +++ b/fhirclient/models/documentreference_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,14 +32,17 @@ def testDocumentReference1(self): self.implDocumentReference1(inst2) def implDocumentReference1(self, inst): - self.assertEqual(inst.class_fhir.coding[0].code, "History and Physical") - self.assertEqual(inst.class_fhir.coding[0].display, "History and Physical") - self.assertEqual(inst.class_fhir.coding[0].system, "http://ihe.net/xds/connectathon/classCodes") + self.assertEqual(inst.category[0].coding[0].code, "History and Physical") + self.assertEqual(inst.category[0].coding[0].display, "History and Physical") + self.assertEqual(inst.category[0].coding[0].system, "http://ihe.net/xds/connectathon/classCodes") self.assertEqual(inst.contained[0].id, "a2") self.assertEqual(inst.content[0].attachment.contentType, "application/hl7-v3+xml") + self.assertEqual(inst.content[0].attachment.creation.date, FHIRDate("2005-12-24T09:35:00+11:00").date) + self.assertEqual(inst.content[0].attachment.creation.as_json(), "2005-12-24T09:35:00+11:00") self.assertEqual(inst.content[0].attachment.hash, "2jmj7l5rSw0yVb/vlWAYkK/YBwk=") self.assertEqual(inst.content[0].attachment.language, "en-US") self.assertEqual(inst.content[0].attachment.size, 3654) + self.assertEqual(inst.content[0].attachment.title, "Physical") self.assertEqual(inst.content[0].attachment.url, "http://example.org/xds/mhd/Binary/07a6483f-732b-461e-86b6-edb665c45510") self.assertEqual(inst.content[0].format.code, "urn:ihe:pcc:handp:2008") self.assertEqual(inst.content[0].format.display, "History and Physical Specification") @@ -57,23 +60,22 @@ def implDocumentReference1(self, inst): self.assertEqual(inst.context.practiceSetting.coding[0].code, "General Medicine") self.assertEqual(inst.context.practiceSetting.coding[0].display, "General Medicine") self.assertEqual(inst.context.practiceSetting.coding[0].system, "http://www.ihe.net/xds/connectathon/practiceSettingCodes") - self.assertEqual(inst.context.related[0].identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.context.related[0].identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.2345") - self.assertEqual(inst.created.date, FHIRDate("2005-12-24T09:35:00+11:00").date) - self.assertEqual(inst.created.as_json(), "2005-12-24T09:35:00+11:00") + self.assertEqual(inst.date.date, FHIRDate("2005-12-24T09:43:41+11:00").date) + self.assertEqual(inst.date.as_json(), "2005-12-24T09:43:41+11:00") self.assertEqual(inst.description, "Physical") self.assertEqual(inst.docStatus, "preliminary") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1234") - self.assertEqual(inst.indexed.date, FHIRDate("2005-12-24T09:43:41+11:00").date) - self.assertEqual(inst.indexed.as_json(), "2005-12-24T09:43:41+11:00") self.assertEqual(inst.masterIdentifier.system, "urn:ietf:rfc:3986") self.assertEqual(inst.masterIdentifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.relatesTo[0].code, "appends") self.assertEqual(inst.securityLabel[0].coding[0].code, "V") self.assertEqual(inst.securityLabel[0].coding[0].display, "very restricted") - self.assertEqual(inst.securityLabel[0].coding[0].system, "http://hl7.org/fhir/v3/Confidentiality") + self.assertEqual(inst.securityLabel[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-Confidentiality") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "34108-1") diff --git a/fhirclient/models/domainresource.py b/fhirclient/models/domainresource.py index abda9f39b..2bc2b458a 100644 --- a/fhirclient/models/domainresource.py +++ b/fhirclient/models/domainresource.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2019-05-07. +# 2019, SMART Health IT. from . import resource @@ -28,7 +28,7 @@ def __init__(self, jsondict=None, strict=True): List of `Resource` items (represented as `dict` in JSON). """ self.extension = None - """ Additional Content defined by implementations. + """ Additional content defined by implementations. List of `Extension` items (represented as `dict` in JSON). """ self.modifierExtension = None diff --git a/fhirclient/models/dosage.py b/fhirclient/models/dosage.py index 1e361aabb..fdb546e6d 100644 --- a/fhirclient/models/dosage.py +++ b/fhirclient/models/dosage.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Dosage) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Dosage) on 2019-05-07. +# 2019, SMART Health IT. -from . import element +from . import backboneelement -class Dosage(element.Element): +class Dosage(backboneelement.BackboneElement): """ How the medication is/was taken or should be taken. Indicates how the medication is/was taken or should be taken by the @@ -25,7 +25,8 @@ def __init__(self, jsondict=None, strict=True): """ self.additionalInstruction = None - """ Supplemental instruction - e.g. "with meals". + """ Supplemental instruction or warnings to the patient - e.g. "with + meals", "may cause drowsiness". List of `CodeableConcept` items (represented as `dict` in JSON). """ self.asNeededBoolean = None @@ -36,13 +37,9 @@ def __init__(self, jsondict=None, strict=True): """ Take "as needed" (for x). Type `CodeableConcept` (represented as `dict` in JSON). """ - self.doseQuantity = None - """ Amount of medication per dose. - Type `Quantity` (represented as `dict` in JSON). """ - - self.doseRange = None - """ Amount of medication per dose. - Type `Range` (represented as `dict` in JSON). """ + self.doseAndRate = None + """ Amount of medication administered. + List of `DosageDoseAndRate` items (represented as `dict` in JSON). """ self.maxDosePerAdministration = None """ Upper limit on medication per administration. @@ -64,18 +61,6 @@ def __init__(self, jsondict=None, strict=True): """ Patient or consumer oriented instructions. Type `str`. """ - self.rateQuantity = None - """ Amount of medication per unit of time. - Type `Quantity` (represented as `dict` in JSON). """ - - self.rateRange = None - """ Amount of medication per unit of time. - Type `Range` (represented as `dict` in JSON). """ - - self.rateRatio = None - """ Amount of medication per unit of time. - Type `Ratio` (represented as `dict` in JSON). """ - self.route = None """ How drug should enter body. Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -104,16 +89,12 @@ def elementProperties(self): ("additionalInstruction", "additionalInstruction", codeableconcept.CodeableConcept, True, None, False), ("asNeededBoolean", "asNeededBoolean", bool, False, "asNeeded", False), ("asNeededCodeableConcept", "asNeededCodeableConcept", codeableconcept.CodeableConcept, False, "asNeeded", False), - ("doseQuantity", "doseQuantity", quantity.Quantity, False, "dose", False), - ("doseRange", "doseRange", range.Range, False, "dose", False), + ("doseAndRate", "doseAndRate", DosageDoseAndRate, True, None, False), ("maxDosePerAdministration", "maxDosePerAdministration", quantity.Quantity, False, None, False), ("maxDosePerLifetime", "maxDosePerLifetime", quantity.Quantity, False, None, False), ("maxDosePerPeriod", "maxDosePerPeriod", ratio.Ratio, False, None, False), ("method", "method", codeableconcept.CodeableConcept, False, None, False), ("patientInstruction", "patientInstruction", str, False, None, False), - ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), - ("rateRange", "rateRange", range.Range, False, "rate", False), - ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), ("route", "route", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, False), ("site", "site", codeableconcept.CodeableConcept, False, None, False), @@ -123,6 +104,63 @@ def elementProperties(self): return js +from . import element + +class DosageDoseAndRate(element.Element): + """ Amount of medication administered. + + The amount of medication administered. + """ + + resource_type = "DosageDoseAndRate" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.doseQuantity = None + """ Amount of medication per dose. + Type `Quantity` (represented as `dict` in JSON). """ + + self.doseRange = None + """ Amount of medication per dose. + Type `Range` (represented as `dict` in JSON). """ + + self.rateQuantity = None + """ Amount of medication per unit of time. + Type `Quantity` (represented as `dict` in JSON). """ + + self.rateRange = None + """ Amount of medication per unit of time. + Type `Range` (represented as `dict` in JSON). """ + + self.rateRatio = None + """ Amount of medication per unit of time. + Type `Ratio` (represented as `dict` in JSON). """ + + self.type = None + """ The kind of dose or rate specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(DosageDoseAndRate, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(DosageDoseAndRate, self).elementProperties() + js.extend([ + ("doseQuantity", "doseQuantity", quantity.Quantity, False, "dose", False), + ("doseRange", "doseRange", range.Range, False, "dose", False), + ("rateQuantity", "rateQuantity", quantity.Quantity, False, "rate", False), + ("rateRange", "rateRange", range.Range, False, "rate", False), + ("rateRatio", "rateRatio", ratio.Ratio, False, "rate", False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + import sys try: from . import codeableconcept diff --git a/fhirclient/models/duration.py b/fhirclient/models/duration.py index d5b625260..922e777fd 100644 --- a/fhirclient/models/duration.py +++ b/fhirclient/models/duration.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Duration) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Duration) on 2019-05-07. +# 2019, SMART Health IT. from . import quantity diff --git a/fhirclient/models/effectevidencesynthesis.py b/fhirclient/models/effectevidencesynthesis.py new file mode 100644 index 000000000..f88a95ae2 --- /dev/null +++ b/fhirclient/models/effectevidencesynthesis.py @@ -0,0 +1,508 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class EffectEvidenceSynthesis(domainresource.DomainResource): + """ A quantified estimate of effect based on a body of evidence. + + The EffectEvidenceSynthesis resource describes the difference in an outcome + between exposures states in a population where the effect estimate is + derived from a combination of research studies. + """ + + resource_type = "EffectEvidenceSynthesis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.approvalDate = None + """ When the effect evidence synthesis was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.certainty = None + """ How certain is the effect. + List of `EffectEvidenceSynthesisCertainty` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the effect evidence synthesis. + Type `str`. """ + + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.effectEstimate = None + """ What was the estimated effect. + List of `EffectEvidenceSynthesisEffectEstimate` items (represented as `dict` in JSON). """ + + self.effectivePeriod = None + """ When the effect evidence synthesis is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.exposure = None + """ What exposure?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.exposureAlternative = None + """ What comparison exposure?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the effect evidence synthesis. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for effect evidence synthesis (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the effect evidence synthesis was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this effect evidence synthesis (computer friendly). + Type `str`. """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcome = None + """ What outcome?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.population = None + """ What population?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc.. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.resultsByExposure = None + """ What was the result per exposure?. + List of `EffectEvidenceSynthesisResultsByExposure` items (represented as `dict` in JSON). """ + + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.sampleSize = None + """ What sample size was involved?. + Type `EffectEvidenceSynthesisSampleSize` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.studyType = None + """ Type of study. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.synthesisType = None + """ Type of synthesis. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.title = None + """ Name for this effect evidence synthesis (human friendly). + Type `str`. """ + + self.topic = None + """ The category of the EffectEvidenceSynthesis, such as Education, + Treatment, Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this effect evidence synthesis, + represented as a URI (globally unique). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the effect evidence synthesis. + Type `str`. """ + + super(EffectEvidenceSynthesis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EffectEvidenceSynthesis, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), + ("certainty", "certainty", EffectEvidenceSynthesisCertainty, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), + ("effectEstimate", "effectEstimate", EffectEvidenceSynthesisEffectEstimate, True, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), + ("exposure", "exposure", fhirreference.FHIRReference, False, None, True), + ("exposureAlternative", "exposureAlternative", fhirreference.FHIRReference, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("outcome", "outcome", fhirreference.FHIRReference, False, None, True), + ("population", "population", fhirreference.FHIRReference, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("resultsByExposure", "resultsByExposure", EffectEvidenceSynthesisResultsByExposure, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), + ("sampleSize", "sampleSize", EffectEvidenceSynthesisSampleSize, False, None, False), + ("status", "status", str, False, None, True), + ("studyType", "studyType", codeableconcept.CodeableConcept, False, None, False), + ("synthesisType", "synthesisType", codeableconcept.CodeableConcept, False, None, False), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("url", "url", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class EffectEvidenceSynthesisCertainty(backboneelement.BackboneElement): + """ How certain is the effect. + + A description of the certainty of the effect estimate. + """ + + resource_type = "EffectEvidenceSynthesisCertainty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.certaintySubcomponent = None + """ A component that contributes to the overall certainty. + List of `EffectEvidenceSynthesisCertaintyCertaintySubcomponent` items (represented as `dict` in JSON). """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.rating = None + """ Certainty rating. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(EffectEvidenceSynthesisCertainty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EffectEvidenceSynthesisCertainty, self).elementProperties() + js.extend([ + ("certaintySubcomponent", "certaintySubcomponent", EffectEvidenceSynthesisCertaintyCertaintySubcomponent, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("rating", "rating", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class EffectEvidenceSynthesisCertaintyCertaintySubcomponent(backboneelement.BackboneElement): + """ A component that contributes to the overall certainty. + + A description of a component of the overall certainty. + """ + + resource_type = "EffectEvidenceSynthesisCertaintyCertaintySubcomponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.rating = None + """ Subcomponent certainty rating. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of subcomponent of certainty rating. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EffectEvidenceSynthesisCertaintyCertaintySubcomponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EffectEvidenceSynthesisCertaintyCertaintySubcomponent, self).elementProperties() + js.extend([ + ("note", "note", annotation.Annotation, True, None, False), + ("rating", "rating", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EffectEvidenceSynthesisEffectEstimate(backboneelement.BackboneElement): + """ What was the estimated effect. + + The estimated effect of the exposure variant. + """ + + resource_type = "EffectEvidenceSynthesisEffectEstimate" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Description of effect estimate. + Type `str`. """ + + self.precisionEstimate = None + """ How precise the estimate is. + List of `EffectEvidenceSynthesisEffectEstimatePrecisionEstimate` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of efffect estimate. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.unitOfMeasure = None + """ What unit is the outcome described in?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Point estimate. + Type `float`. """ + + self.variantState = None + """ Variant exposure states. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EffectEvidenceSynthesisEffectEstimate, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EffectEvidenceSynthesisEffectEstimate, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("precisionEstimate", "precisionEstimate", EffectEvidenceSynthesisEffectEstimatePrecisionEstimate, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("unitOfMeasure", "unitOfMeasure", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", float, False, None, False), + ("variantState", "variantState", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EffectEvidenceSynthesisEffectEstimatePrecisionEstimate(backboneelement.BackboneElement): + """ How precise the estimate is. + + A description of the precision of the estimate for the effect. + """ + + resource_type = "EffectEvidenceSynthesisEffectEstimatePrecisionEstimate" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.from_fhir = None + """ Lower bound. + Type `float`. """ + + self.level = None + """ Level of confidence interval. + Type `float`. """ + + self.to = None + """ Upper bound. + Type `float`. """ + + self.type = None + """ Type of precision estimate. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EffectEvidenceSynthesisEffectEstimatePrecisionEstimate, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EffectEvidenceSynthesisEffectEstimatePrecisionEstimate, self).elementProperties() + js.extend([ + ("from_fhir", "from", float, False, None, False), + ("level", "level", float, False, None, False), + ("to", "to", float, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EffectEvidenceSynthesisResultsByExposure(backboneelement.BackboneElement): + """ What was the result per exposure?. + + A description of the results for each exposure considered in the effect + estimate. + """ + + resource_type = "EffectEvidenceSynthesisResultsByExposure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Description of results by exposure. + Type `str`. """ + + self.exposureState = None + """ exposure | exposure-alternative. + Type `str`. """ + + self.riskEvidenceSynthesis = None + """ Risk evidence synthesis. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.variantState = None + """ Variant exposure states. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(EffectEvidenceSynthesisResultsByExposure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EffectEvidenceSynthesisResultsByExposure, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("exposureState", "exposureState", str, False, None, False), + ("riskEvidenceSynthesis", "riskEvidenceSynthesis", fhirreference.FHIRReference, False, None, True), + ("variantState", "variantState", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class EffectEvidenceSynthesisSampleSize(backboneelement.BackboneElement): + """ What sample size was involved?. + + A description of the size of the sample involved in the synthesis. + """ + + resource_type = "EffectEvidenceSynthesisSampleSize" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Description of sample size. + Type `str`. """ + + self.numberOfParticipants = None + """ How many participants?. + Type `int`. """ + + self.numberOfStudies = None + """ How many studies?. + Type `int`. """ + + super(EffectEvidenceSynthesisSampleSize, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EffectEvidenceSynthesisSampleSize, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("numberOfParticipants", "numberOfParticipants", int, False, None, False), + ("numberOfStudies", "numberOfStudies", int, False, None, False), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/effectevidencesynthesis_tests.py b/fhirclient/models/effectevidencesynthesis_tests.py new file mode 100644 index 000000000..b46814840 --- /dev/null +++ b/fhirclient/models/effectevidencesynthesis_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import effectevidencesynthesis +from .fhirdate import FHIRDate + + +class EffectEvidenceSynthesisTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("EffectEvidenceSynthesis", js["resourceType"]) + return effectevidencesynthesis.EffectEvidenceSynthesis(js) + + def testEffectEvidenceSynthesis1(self): + inst = self.instantiate_from("effectevidencesynthesis-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EffectEvidenceSynthesis instance") + self.implEffectEvidenceSynthesis1(inst) + + js = inst.as_json() + self.assertEqual("EffectEvidenceSynthesis", js["resourceType"]) + inst2 = effectevidencesynthesis.EffectEvidenceSynthesis(js) + self.implEffectEvidenceSynthesis1(inst2) + + def implEffectEvidenceSynthesis1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/element.py b/fhirclient/models/element.py index aeedcbb5b..812aa22bd 100644 --- a/fhirclient/models/element.py +++ b/fhirclient/models/element.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Element) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Element) on 2019-05-07. +# 2019, SMART Health IT. from . import fhirabstractbase @@ -24,11 +24,11 @@ def __init__(self, jsondict=None, strict=True): """ self.extension = None - """ Additional Content defined by implementations. + """ Additional content defined by implementations. List of `Extension` items (represented as `dict` in JSON). """ self.id = None - """ xml:id (or equivalent in JSON). + """ Unique id for inter-element referencing. Type `str`. """ super(Element, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/elementdefinition.py b/fhirclient/models/elementdefinition.py index 3c9a08812..5c1ae4cf9 100644 --- a/fhirclient/models/elementdefinition.py +++ b/fhirclient/models/elementdefinition.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2019-05-07. +# 2019, SMART Health IT. -from . import element +from . import backboneelement -class ElementDefinition(element.Element): +class ElementDefinition(backboneelement.BackboneElement): """ Definition of an element in a resource or extension. Captures constraints on each element within the resource, profile, or @@ -80,6 +80,10 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `bool`. """ + self.defaultValueCanonical = None + """ Specified value if missing from instance. + Type `str`. """ + self.defaultValueCode = None """ Specified value if missing from instance. Type `str`. """ @@ -92,14 +96,26 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `Coding` (represented as `dict` in JSON). """ + self.defaultValueContactDetail = None + """ Specified value if missing from instance. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.defaultValueContactPoint = None """ Specified value if missing from instance. Type `ContactPoint` (represented as `dict` in JSON). """ + self.defaultValueContributor = None + """ Specified value if missing from instance. + Type `Contributor` (represented as `dict` in JSON). """ + self.defaultValueCount = None """ Specified value if missing from instance. Type `Count` (represented as `dict` in JSON). """ + self.defaultValueDataRequirement = None + """ Specified value if missing from instance. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.defaultValueDate = None """ Specified value if missing from instance. Type `FHIRDate` (represented as `str` in JSON). """ @@ -116,10 +132,18 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `Distance` (represented as `dict` in JSON). """ + self.defaultValueDosage = None + """ Specified value if missing from instance. + Type `Dosage` (represented as `dict` in JSON). """ + self.defaultValueDuration = None """ Specified value if missing from instance. Type `Duration` (represented as `dict` in JSON). """ + self.defaultValueExpression = None + """ Specified value if missing from instance. + Type `Expression` (represented as `dict` in JSON). """ + self.defaultValueHumanName = None """ Specified value if missing from instance. Type `HumanName` (represented as `dict` in JSON). """ @@ -144,10 +168,6 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `str`. """ - self.defaultValueMeta = None - """ Specified value if missing from instance. - Type `Meta` (represented as `dict` in JSON). """ - self.defaultValueMoney = None """ Specified value if missing from instance. Type `Money` (represented as `dict` in JSON). """ @@ -156,6 +176,10 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `str`. """ + self.defaultValueParameterDefinition = None + """ Specified value if missing from instance. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.defaultValuePeriod = None """ Specified value if missing from instance. Type `Period` (represented as `dict` in JSON). """ @@ -180,6 +204,10 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `FHIRReference` (represented as `dict` in JSON). """ + self.defaultValueRelatedArtifact = None + """ Specified value if missing from instance. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.defaultValueSampledData = None """ Specified value if missing from instance. Type `SampledData` (represented as `dict` in JSON). """ @@ -200,6 +228,10 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `Timing` (represented as `dict` in JSON). """ + self.defaultValueTriggerDefinition = None + """ Specified value if missing from instance. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.defaultValueUnsignedInt = None """ Specified value if missing from instance. Type `int`. """ @@ -208,6 +240,18 @@ def __init__(self, jsondict=None, strict=True): """ Specified value if missing from instance. Type `str`. """ + self.defaultValueUrl = None + """ Specified value if missing from instance. + Type `str`. """ + + self.defaultValueUsageContext = None + """ Specified value if missing from instance. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.defaultValueUuid = None + """ Specified value if missing from instance. + Type `str`. """ + self.definition = None """ Full formal definition as narrative text. Type `str`. """ @@ -240,6 +284,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `bool`. """ + self.fixedCanonical = None + """ Value must be exactly this. + Type `str`. """ + self.fixedCode = None """ Value must be exactly this. Type `str`. """ @@ -252,14 +300,26 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `Coding` (represented as `dict` in JSON). """ + self.fixedContactDetail = None + """ Value must be exactly this. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.fixedContactPoint = None """ Value must be exactly this. Type `ContactPoint` (represented as `dict` in JSON). """ + self.fixedContributor = None + """ Value must be exactly this. + Type `Contributor` (represented as `dict` in JSON). """ + self.fixedCount = None """ Value must be exactly this. Type `Count` (represented as `dict` in JSON). """ + self.fixedDataRequirement = None + """ Value must be exactly this. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.fixedDate = None """ Value must be exactly this. Type `FHIRDate` (represented as `str` in JSON). """ @@ -276,10 +336,18 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `Distance` (represented as `dict` in JSON). """ + self.fixedDosage = None + """ Value must be exactly this. + Type `Dosage` (represented as `dict` in JSON). """ + self.fixedDuration = None """ Value must be exactly this. Type `Duration` (represented as `dict` in JSON). """ + self.fixedExpression = None + """ Value must be exactly this. + Type `Expression` (represented as `dict` in JSON). """ + self.fixedHumanName = None """ Value must be exactly this. Type `HumanName` (represented as `dict` in JSON). """ @@ -304,10 +372,6 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `str`. """ - self.fixedMeta = None - """ Value must be exactly this. - Type `Meta` (represented as `dict` in JSON). """ - self.fixedMoney = None """ Value must be exactly this. Type `Money` (represented as `dict` in JSON). """ @@ -316,6 +380,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `str`. """ + self.fixedParameterDefinition = None + """ Value must be exactly this. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.fixedPeriod = None """ Value must be exactly this. Type `Period` (represented as `dict` in JSON). """ @@ -340,6 +408,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `FHIRReference` (represented as `dict` in JSON). """ + self.fixedRelatedArtifact = None + """ Value must be exactly this. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.fixedSampledData = None """ Value must be exactly this. Type `SampledData` (represented as `dict` in JSON). """ @@ -360,6 +432,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `Timing` (represented as `dict` in JSON). """ + self.fixedTriggerDefinition = None + """ Value must be exactly this. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.fixedUnsignedInt = None """ Value must be exactly this. Type `int`. """ @@ -368,10 +444,26 @@ def __init__(self, jsondict=None, strict=True): """ Value must be exactly this. Type `str`. """ + self.fixedUrl = None + """ Value must be exactly this. + Type `str`. """ + + self.fixedUsageContext = None + """ Value must be exactly this. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.fixedUuid = None + """ Value must be exactly this. + Type `str`. """ + self.isModifier = None """ If this modifies the meaning of other elements. Type `bool`. """ + self.isModifierReason = None + """ Reason that this element is marked as a modifier. + Type `str`. """ + self.isSummary = None """ Include when _summary = true?. Type `bool`. """ @@ -473,7 +565,7 @@ def __init__(self, jsondict=None, strict=True): Type `int`. """ self.mustSupport = None - """ If the element must supported. + """ If the element must be supported. Type `bool`. """ self.orderMeaning = None @@ -508,6 +600,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `bool`. """ + self.patternCanonical = None + """ Value must have at least these property values. + Type `str`. """ + self.patternCode = None """ Value must have at least these property values. Type `str`. """ @@ -520,14 +616,26 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `Coding` (represented as `dict` in JSON). """ + self.patternContactDetail = None + """ Value must have at least these property values. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.patternContactPoint = None """ Value must have at least these property values. Type `ContactPoint` (represented as `dict` in JSON). """ + self.patternContributor = None + """ Value must have at least these property values. + Type `Contributor` (represented as `dict` in JSON). """ + self.patternCount = None """ Value must have at least these property values. Type `Count` (represented as `dict` in JSON). """ + self.patternDataRequirement = None + """ Value must have at least these property values. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.patternDate = None """ Value must have at least these property values. Type `FHIRDate` (represented as `str` in JSON). """ @@ -544,10 +652,18 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `Distance` (represented as `dict` in JSON). """ + self.patternDosage = None + """ Value must have at least these property values. + Type `Dosage` (represented as `dict` in JSON). """ + self.patternDuration = None """ Value must have at least these property values. Type `Duration` (represented as `dict` in JSON). """ + self.patternExpression = None + """ Value must have at least these property values. + Type `Expression` (represented as `dict` in JSON). """ + self.patternHumanName = None """ Value must have at least these property values. Type `HumanName` (represented as `dict` in JSON). """ @@ -572,10 +688,6 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `str`. """ - self.patternMeta = None - """ Value must have at least these property values. - Type `Meta` (represented as `dict` in JSON). """ - self.patternMoney = None """ Value must have at least these property values. Type `Money` (represented as `dict` in JSON). """ @@ -584,6 +696,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `str`. """ + self.patternParameterDefinition = None + """ Value must have at least these property values. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.patternPeriod = None """ Value must have at least these property values. Type `Period` (represented as `dict` in JSON). """ @@ -608,6 +724,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `FHIRReference` (represented as `dict` in JSON). """ + self.patternRelatedArtifact = None + """ Value must have at least these property values. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.patternSampledData = None """ Value must have at least these property values. Type `SampledData` (represented as `dict` in JSON). """ @@ -628,6 +748,10 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `Timing` (represented as `dict` in JSON). """ + self.patternTriggerDefinition = None + """ Value must have at least these property values. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.patternUnsignedInt = None """ Value must have at least these property values. Type `int`. """ @@ -636,6 +760,18 @@ def __init__(self, jsondict=None, strict=True): """ Value must have at least these property values. Type `str`. """ + self.patternUrl = None + """ Value must have at least these property values. + Type `str`. """ + + self.patternUsageContext = None + """ Value must have at least these property values. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.patternUuid = None + """ Value must have at least these property values. + Type `str`. """ + self.representation = None """ xmlAttr | xmlText | typeAttr | cdaText | xhtml. List of `str` items. """ @@ -648,6 +784,11 @@ def __init__(self, jsondict=None, strict=True): """ Concise definition for space-constrained presentation. Type `str`. """ + self.sliceIsConstraining = None + """ If this slice definition constrains an inherited slice definition + (or not). + Type `bool`. """ + self.sliceName = None """ Name for this particular element (in a set of slices). Type `str`. """ @@ -679,38 +820,49 @@ def elementProperties(self): ("defaultValueAttachment", "defaultValueAttachment", attachment.Attachment, False, "defaultValue", False), ("defaultValueBase64Binary", "defaultValueBase64Binary", str, False, "defaultValue", False), ("defaultValueBoolean", "defaultValueBoolean", bool, False, "defaultValue", False), + ("defaultValueCanonical", "defaultValueCanonical", str, False, "defaultValue", False), ("defaultValueCode", "defaultValueCode", str, False, "defaultValue", False), ("defaultValueCodeableConcept", "defaultValueCodeableConcept", codeableconcept.CodeableConcept, False, "defaultValue", False), ("defaultValueCoding", "defaultValueCoding", coding.Coding, False, "defaultValue", False), + ("defaultValueContactDetail", "defaultValueContactDetail", contactdetail.ContactDetail, False, "defaultValue", False), ("defaultValueContactPoint", "defaultValueContactPoint", contactpoint.ContactPoint, False, "defaultValue", False), + ("defaultValueContributor", "defaultValueContributor", contributor.Contributor, False, "defaultValue", False), ("defaultValueCount", "defaultValueCount", count.Count, False, "defaultValue", False), + ("defaultValueDataRequirement", "defaultValueDataRequirement", datarequirement.DataRequirement, False, "defaultValue", False), ("defaultValueDate", "defaultValueDate", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueDateTime", "defaultValueDateTime", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueDecimal", "defaultValueDecimal", float, False, "defaultValue", False), ("defaultValueDistance", "defaultValueDistance", distance.Distance, False, "defaultValue", False), + ("defaultValueDosage", "defaultValueDosage", dosage.Dosage, False, "defaultValue", False), ("defaultValueDuration", "defaultValueDuration", duration.Duration, False, "defaultValue", False), + ("defaultValueExpression", "defaultValueExpression", expression.Expression, False, "defaultValue", False), ("defaultValueHumanName", "defaultValueHumanName", humanname.HumanName, False, "defaultValue", False), ("defaultValueId", "defaultValueId", str, False, "defaultValue", False), ("defaultValueIdentifier", "defaultValueIdentifier", identifier.Identifier, False, "defaultValue", False), ("defaultValueInstant", "defaultValueInstant", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueInteger", "defaultValueInteger", int, False, "defaultValue", False), ("defaultValueMarkdown", "defaultValueMarkdown", str, False, "defaultValue", False), - ("defaultValueMeta", "defaultValueMeta", meta.Meta, False, "defaultValue", False), ("defaultValueMoney", "defaultValueMoney", money.Money, False, "defaultValue", False), ("defaultValueOid", "defaultValueOid", str, False, "defaultValue", False), + ("defaultValueParameterDefinition", "defaultValueParameterDefinition", parameterdefinition.ParameterDefinition, False, "defaultValue", False), ("defaultValuePeriod", "defaultValuePeriod", period.Period, False, "defaultValue", False), ("defaultValuePositiveInt", "defaultValuePositiveInt", int, False, "defaultValue", False), ("defaultValueQuantity", "defaultValueQuantity", quantity.Quantity, False, "defaultValue", False), ("defaultValueRange", "defaultValueRange", range.Range, False, "defaultValue", False), ("defaultValueRatio", "defaultValueRatio", ratio.Ratio, False, "defaultValue", False), ("defaultValueReference", "defaultValueReference", fhirreference.FHIRReference, False, "defaultValue", False), + ("defaultValueRelatedArtifact", "defaultValueRelatedArtifact", relatedartifact.RelatedArtifact, False, "defaultValue", False), ("defaultValueSampledData", "defaultValueSampledData", sampleddata.SampledData, False, "defaultValue", False), ("defaultValueSignature", "defaultValueSignature", signature.Signature, False, "defaultValue", False), ("defaultValueString", "defaultValueString", str, False, "defaultValue", False), ("defaultValueTime", "defaultValueTime", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueTiming", "defaultValueTiming", timing.Timing, False, "defaultValue", False), + ("defaultValueTriggerDefinition", "defaultValueTriggerDefinition", triggerdefinition.TriggerDefinition, False, "defaultValue", False), ("defaultValueUnsignedInt", "defaultValueUnsignedInt", int, False, "defaultValue", False), ("defaultValueUri", "defaultValueUri", str, False, "defaultValue", False), + ("defaultValueUrl", "defaultValueUrl", str, False, "defaultValue", False), + ("defaultValueUsageContext", "defaultValueUsageContext", usagecontext.UsageContext, False, "defaultValue", False), + ("defaultValueUuid", "defaultValueUuid", str, False, "defaultValue", False), ("definition", "definition", str, False, None, False), ("example", "example", ElementDefinitionExample, True, None, False), ("fixedAddress", "fixedAddress", address.Address, False, "fixed", False), @@ -719,39 +871,51 @@ def elementProperties(self): ("fixedAttachment", "fixedAttachment", attachment.Attachment, False, "fixed", False), ("fixedBase64Binary", "fixedBase64Binary", str, False, "fixed", False), ("fixedBoolean", "fixedBoolean", bool, False, "fixed", False), + ("fixedCanonical", "fixedCanonical", str, False, "fixed", False), ("fixedCode", "fixedCode", str, False, "fixed", False), ("fixedCodeableConcept", "fixedCodeableConcept", codeableconcept.CodeableConcept, False, "fixed", False), ("fixedCoding", "fixedCoding", coding.Coding, False, "fixed", False), + ("fixedContactDetail", "fixedContactDetail", contactdetail.ContactDetail, False, "fixed", False), ("fixedContactPoint", "fixedContactPoint", contactpoint.ContactPoint, False, "fixed", False), + ("fixedContributor", "fixedContributor", contributor.Contributor, False, "fixed", False), ("fixedCount", "fixedCount", count.Count, False, "fixed", False), + ("fixedDataRequirement", "fixedDataRequirement", datarequirement.DataRequirement, False, "fixed", False), ("fixedDate", "fixedDate", fhirdate.FHIRDate, False, "fixed", False), ("fixedDateTime", "fixedDateTime", fhirdate.FHIRDate, False, "fixed", False), ("fixedDecimal", "fixedDecimal", float, False, "fixed", False), ("fixedDistance", "fixedDistance", distance.Distance, False, "fixed", False), + ("fixedDosage", "fixedDosage", dosage.Dosage, False, "fixed", False), ("fixedDuration", "fixedDuration", duration.Duration, False, "fixed", False), + ("fixedExpression", "fixedExpression", expression.Expression, False, "fixed", False), ("fixedHumanName", "fixedHumanName", humanname.HumanName, False, "fixed", False), ("fixedId", "fixedId", str, False, "fixed", False), ("fixedIdentifier", "fixedIdentifier", identifier.Identifier, False, "fixed", False), ("fixedInstant", "fixedInstant", fhirdate.FHIRDate, False, "fixed", False), ("fixedInteger", "fixedInteger", int, False, "fixed", False), ("fixedMarkdown", "fixedMarkdown", str, False, "fixed", False), - ("fixedMeta", "fixedMeta", meta.Meta, False, "fixed", False), ("fixedMoney", "fixedMoney", money.Money, False, "fixed", False), ("fixedOid", "fixedOid", str, False, "fixed", False), + ("fixedParameterDefinition", "fixedParameterDefinition", parameterdefinition.ParameterDefinition, False, "fixed", False), ("fixedPeriod", "fixedPeriod", period.Period, False, "fixed", False), ("fixedPositiveInt", "fixedPositiveInt", int, False, "fixed", False), ("fixedQuantity", "fixedQuantity", quantity.Quantity, False, "fixed", False), ("fixedRange", "fixedRange", range.Range, False, "fixed", False), ("fixedRatio", "fixedRatio", ratio.Ratio, False, "fixed", False), ("fixedReference", "fixedReference", fhirreference.FHIRReference, False, "fixed", False), + ("fixedRelatedArtifact", "fixedRelatedArtifact", relatedartifact.RelatedArtifact, False, "fixed", False), ("fixedSampledData", "fixedSampledData", sampleddata.SampledData, False, "fixed", False), ("fixedSignature", "fixedSignature", signature.Signature, False, "fixed", False), ("fixedString", "fixedString", str, False, "fixed", False), ("fixedTime", "fixedTime", fhirdate.FHIRDate, False, "fixed", False), ("fixedTiming", "fixedTiming", timing.Timing, False, "fixed", False), + ("fixedTriggerDefinition", "fixedTriggerDefinition", triggerdefinition.TriggerDefinition, False, "fixed", False), ("fixedUnsignedInt", "fixedUnsignedInt", int, False, "fixed", False), ("fixedUri", "fixedUri", str, False, "fixed", False), + ("fixedUrl", "fixedUrl", str, False, "fixed", False), + ("fixedUsageContext", "fixedUsageContext", usagecontext.UsageContext, False, "fixed", False), + ("fixedUuid", "fixedUuid", str, False, "fixed", False), ("isModifier", "isModifier", bool, False, None, False), + ("isModifierReason", "isModifierReason", str, False, None, False), ("isSummary", "isSummary", bool, False, None, False), ("label", "label", str, False, None, False), ("mapping", "mapping", ElementDefinitionMapping, True, None, False), @@ -786,41 +950,53 @@ def elementProperties(self): ("patternAttachment", "patternAttachment", attachment.Attachment, False, "pattern", False), ("patternBase64Binary", "patternBase64Binary", str, False, "pattern", False), ("patternBoolean", "patternBoolean", bool, False, "pattern", False), + ("patternCanonical", "patternCanonical", str, False, "pattern", False), ("patternCode", "patternCode", str, False, "pattern", False), ("patternCodeableConcept", "patternCodeableConcept", codeableconcept.CodeableConcept, False, "pattern", False), ("patternCoding", "patternCoding", coding.Coding, False, "pattern", False), + ("patternContactDetail", "patternContactDetail", contactdetail.ContactDetail, False, "pattern", False), ("patternContactPoint", "patternContactPoint", contactpoint.ContactPoint, False, "pattern", False), + ("patternContributor", "patternContributor", contributor.Contributor, False, "pattern", False), ("patternCount", "patternCount", count.Count, False, "pattern", False), + ("patternDataRequirement", "patternDataRequirement", datarequirement.DataRequirement, False, "pattern", False), ("patternDate", "patternDate", fhirdate.FHIRDate, False, "pattern", False), ("patternDateTime", "patternDateTime", fhirdate.FHIRDate, False, "pattern", False), ("patternDecimal", "patternDecimal", float, False, "pattern", False), ("patternDistance", "patternDistance", distance.Distance, False, "pattern", False), + ("patternDosage", "patternDosage", dosage.Dosage, False, "pattern", False), ("patternDuration", "patternDuration", duration.Duration, False, "pattern", False), + ("patternExpression", "patternExpression", expression.Expression, False, "pattern", False), ("patternHumanName", "patternHumanName", humanname.HumanName, False, "pattern", False), ("patternId", "patternId", str, False, "pattern", False), ("patternIdentifier", "patternIdentifier", identifier.Identifier, False, "pattern", False), ("patternInstant", "patternInstant", fhirdate.FHIRDate, False, "pattern", False), ("patternInteger", "patternInteger", int, False, "pattern", False), ("patternMarkdown", "patternMarkdown", str, False, "pattern", False), - ("patternMeta", "patternMeta", meta.Meta, False, "pattern", False), ("patternMoney", "patternMoney", money.Money, False, "pattern", False), ("patternOid", "patternOid", str, False, "pattern", False), + ("patternParameterDefinition", "patternParameterDefinition", parameterdefinition.ParameterDefinition, False, "pattern", False), ("patternPeriod", "patternPeriod", period.Period, False, "pattern", False), ("patternPositiveInt", "patternPositiveInt", int, False, "pattern", False), ("patternQuantity", "patternQuantity", quantity.Quantity, False, "pattern", False), ("patternRange", "patternRange", range.Range, False, "pattern", False), ("patternRatio", "patternRatio", ratio.Ratio, False, "pattern", False), ("patternReference", "patternReference", fhirreference.FHIRReference, False, "pattern", False), + ("patternRelatedArtifact", "patternRelatedArtifact", relatedartifact.RelatedArtifact, False, "pattern", False), ("patternSampledData", "patternSampledData", sampleddata.SampledData, False, "pattern", False), ("patternSignature", "patternSignature", signature.Signature, False, "pattern", False), ("patternString", "patternString", str, False, "pattern", False), ("patternTime", "patternTime", fhirdate.FHIRDate, False, "pattern", False), ("patternTiming", "patternTiming", timing.Timing, False, "pattern", False), + ("patternTriggerDefinition", "patternTriggerDefinition", triggerdefinition.TriggerDefinition, False, "pattern", False), ("patternUnsignedInt", "patternUnsignedInt", int, False, "pattern", False), ("patternUri", "patternUri", str, False, "pattern", False), + ("patternUrl", "patternUrl", str, False, "pattern", False), + ("patternUsageContext", "patternUsageContext", usagecontext.UsageContext, False, "pattern", False), + ("patternUuid", "patternUuid", str, False, "pattern", False), ("representation", "representation", str, True, None, False), ("requirements", "requirements", str, False, None, False), ("short", "short", str, False, None, False), + ("sliceIsConstraining", "sliceIsConstraining", bool, False, None, False), ("sliceName", "sliceName", str, False, None, False), ("slicing", "slicing", ElementDefinitionSlicing, False, None, False), ("type", "type", ElementDefinitionType, True, None, False), @@ -828,15 +1004,19 @@ def elementProperties(self): return js +from . import element + class ElementDefinitionBase(element.Element): """ Base definition information for tools. Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the - derived and related profiles. This information is provided when the element - definition is not the original definition of an element - i.g. either in a - constraint on another type, or for elements from a super type in a snap - shot. + derived and related profiles. When the element definition is not the + original definition of an element - i.g. either in a constraint on another + type, or for elements from a super type in a snap shot - then the + information in provided in the element definition may be different to the + base definition. On the original definition of the element, it will be + same. """ resource_type = "ElementDefinitionBase" @@ -898,11 +1078,7 @@ def __init__(self, jsondict=None, strict=True): """ required | extensible | preferred | example. Type `str`. """ - self.valueSetReference = None - """ Source of value set. - Type `FHIRReference` referencing `ValueSet` (represented as `dict` in JSON). """ - - self.valueSetUri = None + self.valueSet = None """ Source of value set. Type `str`. """ @@ -913,8 +1089,7 @@ def elementProperties(self): js.extend([ ("description", "description", str, False, None, False), ("strength", "strength", str, False, None, True), - ("valueSetReference", "valueSetReference", fhirreference.FHIRReference, False, "valueSet", False), - ("valueSetUri", "valueSetUri", str, False, "valueSet", False), + ("valueSet", "valueSet", str, False, None, False), ]) return js @@ -969,7 +1144,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(ElementDefinitionConstraint, self).elementProperties() js.extend([ - ("expression", "expression", str, False, None, True), + ("expression", "expression", str, False, None, False), ("human", "human", str, False, None, True), ("key", "key", str, False, None, True), ("requirements", "requirements", str, False, None, False), @@ -1025,6 +1200,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `bool`. """ + self.valueCanonical = None + """ Value of Example (one of allowed types). + Type `str`. """ + self.valueCode = None """ Value of Example (one of allowed types). Type `str`. """ @@ -1037,14 +1216,26 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `Coding` (represented as `dict` in JSON). """ + self.valueContactDetail = None + """ Value of Example (one of allowed types). + Type `ContactDetail` (represented as `dict` in JSON). """ + self.valueContactPoint = None """ Value of Example (one of allowed types). Type `ContactPoint` (represented as `dict` in JSON). """ + self.valueContributor = None + """ Value of Example (one of allowed types). + Type `Contributor` (represented as `dict` in JSON). """ + self.valueCount = None """ Value of Example (one of allowed types). Type `Count` (represented as `dict` in JSON). """ + self.valueDataRequirement = None + """ Value of Example (one of allowed types). + Type `DataRequirement` (represented as `dict` in JSON). """ + self.valueDate = None """ Value of Example (one of allowed types). Type `FHIRDate` (represented as `str` in JSON). """ @@ -1061,10 +1252,18 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `Distance` (represented as `dict` in JSON). """ + self.valueDosage = None + """ Value of Example (one of allowed types). + Type `Dosage` (represented as `dict` in JSON). """ + self.valueDuration = None """ Value of Example (one of allowed types). Type `Duration` (represented as `dict` in JSON). """ + self.valueExpression = None + """ Value of Example (one of allowed types). + Type `Expression` (represented as `dict` in JSON). """ + self.valueHumanName = None """ Value of Example (one of allowed types). Type `HumanName` (represented as `dict` in JSON). """ @@ -1089,10 +1288,6 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `str`. """ - self.valueMeta = None - """ Value of Example (one of allowed types). - Type `Meta` (represented as `dict` in JSON). """ - self.valueMoney = None """ Value of Example (one of allowed types). Type `Money` (represented as `dict` in JSON). """ @@ -1101,6 +1296,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `str`. """ + self.valueParameterDefinition = None + """ Value of Example (one of allowed types). + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.valuePeriod = None """ Value of Example (one of allowed types). Type `Period` (represented as `dict` in JSON). """ @@ -1125,6 +1324,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `FHIRReference` (represented as `dict` in JSON). """ + self.valueRelatedArtifact = None + """ Value of Example (one of allowed types). + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.valueSampledData = None """ Value of Example (one of allowed types). Type `SampledData` (represented as `dict` in JSON). """ @@ -1145,6 +1348,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `Timing` (represented as `dict` in JSON). """ + self.valueTriggerDefinition = None + """ Value of Example (one of allowed types). + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.valueUnsignedInt = None """ Value of Example (one of allowed types). Type `int`. """ @@ -1153,6 +1360,18 @@ def __init__(self, jsondict=None, strict=True): """ Value of Example (one of allowed types). Type `str`. """ + self.valueUrl = None + """ Value of Example (one of allowed types). + Type `str`. """ + + self.valueUsageContext = None + """ Value of Example (one of allowed types). + Type `UsageContext` (represented as `dict` in JSON). """ + + self.valueUuid = None + """ Value of Example (one of allowed types). + Type `str`. """ + super(ElementDefinitionExample, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -1165,38 +1384,49 @@ def elementProperties(self): ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCanonical", "valueCanonical", str, False, "value", True), ("valueCode", "valueCode", str, False, "value", True), ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueContactDetail", "valueContactDetail", contactdetail.ContactDetail, False, "value", True), ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", True), + ("valueContributor", "valueContributor", contributor.Contributor, False, "value", True), ("valueCount", "valueCount", count.Count, False, "value", True), + ("valueDataRequirement", "valueDataRequirement", datarequirement.DataRequirement, False, "value", True), ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", True), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", True), ("valueDecimal", "valueDecimal", float, False, "value", True), ("valueDistance", "valueDistance", distance.Distance, False, "value", True), + ("valueDosage", "valueDosage", dosage.Dosage, False, "value", True), ("valueDuration", "valueDuration", duration.Duration, False, "value", True), + ("valueExpression", "valueExpression", expression.Expression, False, "value", True), ("valueHumanName", "valueHumanName", humanname.HumanName, False, "value", True), ("valueId", "valueId", str, False, "value", True), ("valueIdentifier", "valueIdentifier", identifier.Identifier, False, "value", True), ("valueInstant", "valueInstant", fhirdate.FHIRDate, False, "value", True), ("valueInteger", "valueInteger", int, False, "value", True), ("valueMarkdown", "valueMarkdown", str, False, "value", True), - ("valueMeta", "valueMeta", meta.Meta, False, "value", True), ("valueMoney", "valueMoney", money.Money, False, "value", True), ("valueOid", "valueOid", str, False, "value", True), + ("valueParameterDefinition", "valueParameterDefinition", parameterdefinition.ParameterDefinition, False, "value", True), ("valuePeriod", "valuePeriod", period.Period, False, "value", True), ("valuePositiveInt", "valuePositiveInt", int, False, "value", True), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), ("valueRange", "valueRange", range.Range, False, "value", True), ("valueRatio", "valueRatio", ratio.Ratio, False, "value", True), ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), + ("valueRelatedArtifact", "valueRelatedArtifact", relatedartifact.RelatedArtifact, False, "value", True), ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", True), ("valueSignature", "valueSignature", signature.Signature, False, "value", True), ("valueString", "valueString", str, False, "value", True), ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", True), ("valueTiming", "valueTiming", timing.Timing, False, "value", True), + ("valueTriggerDefinition", "valueTriggerDefinition", triggerdefinition.TriggerDefinition, False, "value", True), ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", True), ("valueUri", "valueUri", str, False, "value", True), + ("valueUrl", "valueUrl", str, False, "value", True), + ("valueUsageContext", "valueUsageContext", usagecontext.UsageContext, False, "value", True), + ("valueUuid", "valueUuid", str, False, "value", True), ]) return js @@ -1363,12 +1593,13 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.profile = None - """ Profile (StructureDefinition) to apply (or IG). - Type `str`. """ + """ Profiles (StructureDefinition or IG) - one must apply. + List of `str` items. """ self.targetProfile = None - """ Profile (StructureDefinition) to apply to reference target (or IG). - Type `str`. """ + """ Profile (StructureDefinition or IG) on the Reference/canonical + target - one must apply. + List of `str` items. """ self.versioning = None """ either | independent | specific. @@ -1381,8 +1612,8 @@ def elementProperties(self): js.extend([ ("aggregation", "aggregation", str, True, None, False), ("code", "code", str, False, None, True), - ("profile", "profile", str, False, None, False), - ("targetProfile", "targetProfile", str, False, None, False), + ("profile", "profile", str, True, None, False), + ("targetProfile", "targetProfile", str, True, None, False), ("versioning", "versioning", str, False, None, False), ]) return js @@ -1413,22 +1644,42 @@ def elementProperties(self): from . import coding except ImportError: coding = sys.modules[__package__ + '.coding'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] try: from . import contactpoint except ImportError: contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import contributor +except ImportError: + contributor = sys.modules[__package__ + '.contributor'] try: from . import count except ImportError: count = sys.modules[__package__ + '.count'] +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] try: from . import distance except ImportError: distance = sys.modules[__package__ + '.distance'] +try: + from . import dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] try: from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: @@ -1445,14 +1696,14 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] -try: - from . import meta -except ImportError: - meta = sys.modules[__package__ + '.meta'] try: from . import money except ImportError: money = sys.modules[__package__ + '.money'] +try: + from . import parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] try: from . import period except ImportError: @@ -1469,6 +1720,10 @@ def elementProperties(self): from . import ratio except ImportError: ratio = sys.modules[__package__ + '.ratio'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] try: from . import sampleddata except ImportError: @@ -1481,3 +1736,11 @@ def elementProperties(self): from . import timing except ImportError: timing = sys.modules[__package__ + '.timing'] +try: + from . import triggerdefinition +except ImportError: + triggerdefinition = sys.modules[__package__ + '.triggerdefinition'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/eligibilityrequest.py b/fhirclient/models/eligibilityrequest.py deleted file mode 100644 index ff0d1769c..000000000 --- a/fhirclient/models/eligibilityrequest.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class EligibilityRequest(domainresource.DomainResource): - """ Determine insurance validity and scope of coverage. - - The EligibilityRequest provides patient and insurance coverage information - to an insurer for them to respond, in the form of an EligibilityResponse, - with information regarding whether the stated coverage is valid and in- - force and optionally to provide the insurance details of the policy. - """ - - resource_type = "EligibilityRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.benefitCategory = None - """ Type of services covered. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.benefitSubCategory = None - """ Detailed services covered within the type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.businessArrangement = None - """ Business agreement. - Type `str`. """ - - self.coverage = None - """ Insurance or medical plan. - Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ - - self.created = None - """ Creation date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.enterer = None - """ Author. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ - - self.facility = None - """ Servicing Facility. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ - - self.identifier = None - """ Business Identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.insurer = None - """ Target. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.organization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.patient = None - """ The subject of the Products and Services. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ - - self.priority = None - """ Desired processing priority. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.provider = None - """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ - - self.servicedDate = None - """ Estimated date or dates of Service. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.servicedPeriod = None - """ Estimated date or dates of Service. - Type `Period` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - super(EligibilityRequest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(EligibilityRequest, self).elementProperties() - js.extend([ - ("benefitCategory", "benefitCategory", codeableconcept.CodeableConcept, False, None, False), - ("benefitSubCategory", "benefitSubCategory", codeableconcept.CodeableConcept, False, None, False), - ("businessArrangement", "businessArrangement", str, False, None, False), - ("coverage", "coverage", fhirreference.FHIRReference, False, None, False), - ("created", "created", fhirdate.FHIRDate, False, None, False), - ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), - ("facility", "facility", fhirreference.FHIRReference, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), - ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), - ("provider", "provider", fhirreference.FHIRReference, False, None, False), - ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), - ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), - ("status", "status", str, False, None, False), - ]) - return js - - -import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] -try: - from . import period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/eligibilityrequest_tests.py b/fhirclient/models/eligibilityrequest_tests.py deleted file mode 100644 index b4d8b499f..000000000 --- a/fhirclient/models/eligibilityrequest_tests.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import eligibilityrequest -from .fhirdate import FHIRDate - - -class EligibilityRequestTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("EligibilityRequest", js["resourceType"]) - return eligibilityrequest.EligibilityRequest(js) - - def testEligibilityRequest1(self): - inst = self.instantiate_from("eligibilityrequest-example-2.json") - self.assertIsNotNone(inst, "Must have instantiated a EligibilityRequest instance") - self.implEligibilityRequest1(inst) - - js = inst.as_json() - self.assertEqual("EligibilityRequest", js["resourceType"]) - inst2 = eligibilityrequest.EligibilityRequest(js) - self.implEligibilityRequest1(inst2) - - def implEligibilityRequest1(self, inst): - self.assertEqual(inst.benefitCategory.coding[0].code, "medical") - self.assertEqual(inst.benefitCategory.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.benefitSubCategory.coding[0].code, "69") - self.assertEqual(inst.benefitSubCategory.coding[0].display, "Maternity") - self.assertEqual(inst.benefitSubCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.businessArrangement, "NB8742") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "52346") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/elegibilityrequest") - self.assertEqual(inst.identifier[0].value, "52346") - self.assertEqual(inst.priority.coding[0].code, "normal") - self.assertEqual(inst.servicedDate.date, FHIRDate("2014-09-17").date) - self.assertEqual(inst.servicedDate.as_json(), "2014-09-17") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the EligibilityRequest
") - self.assertEqual(inst.text.status, "generated") - - def testEligibilityRequest2(self): - inst = self.instantiate_from("eligibilityrequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a EligibilityRequest instance") - self.implEligibilityRequest2(inst) - - js = inst.as_json() - self.assertEqual("EligibilityRequest", js["resourceType"]) - inst2 = eligibilityrequest.EligibilityRequest(js) - self.implEligibilityRequest2(inst2) - - def implEligibilityRequest2(self, inst): - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "52345") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/elegibilityrequest") - self.assertEqual(inst.identifier[0].value, "52345") - self.assertEqual(inst.priority.coding[0].code, "normal") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the EligibilityRequest
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/eligibilityresponse_tests.py b/fhirclient/models/eligibilityresponse_tests.py deleted file mode 100644 index b349e2b29..000000000 --- a/fhirclient/models/eligibilityresponse_tests.py +++ /dev/null @@ -1,271 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import eligibilityresponse -from .fhirdate import FHIRDate - - -class EligibilityResponseTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("EligibilityResponse", js["resourceType"]) - return eligibilityresponse.EligibilityResponse(js) - - def testEligibilityResponse1(self): - inst = self.instantiate_from("eligibilityresponse-example-benefits-2.json") - self.assertIsNotNone(inst, "Must have instantiated a EligibilityResponse instance") - self.implEligibilityResponse1(inst) - - js = inst.as_json() - self.assertEqual("EligibilityResponse", js["resourceType"]) - inst2 = eligibilityresponse.EligibilityResponse(js) - self.implEligibilityResponse1(inst2) - - def implEligibilityResponse1(self, inst): - self.assertEqual(inst.contained[0].id, "patient-1") - self.assertEqual(inst.contained[1].id, "coverage-1") - self.assertEqual(inst.created.date, FHIRDate("2014-09-16").date) - self.assertEqual(inst.created.as_json(), "2014-09-16") - self.assertEqual(inst.disposition, "Policy is currently in-force.") - self.assertEqual(inst.form.coding[0].code, "ELRSP/2017/01") - self.assertEqual(inst.form.coding[0].system, "http://national.org/form") - self.assertEqual(inst.id, "E2502") - self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/eligibilityresponse") - self.assertEqual(inst.identifier[0].value, "8812342") - self.assertTrue(inst.inforce) - self.assertEqual(inst.insurance[0].benefitBalance[0].category.coding[0].code, "medical") - self.assertEqual(inst.insurance[0].benefitBalance[0].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].allowedMoney.code, "USD") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].allowedMoney.value, 500000) - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].usedMoney.code, "USD") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].usedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].usedMoney.value, 3748.0) - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].allowedMoney.code, "USD") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].allowedMoney.value, 100) - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].type.coding[0].code, "copay-maximum") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[2].allowedUnsignedInt, 20) - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[2].type.coding[0].code, "copay-percent") - self.assertEqual(inst.insurance[0].benefitBalance[0].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[0].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[0].subCategory.coding[0].code, "30") - self.assertEqual(inst.insurance[0].benefitBalance[0].subCategory.coding[0].display, "Health Benefit Plan Coverage") - self.assertEqual(inst.insurance[0].benefitBalance[0].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[0].term.coding[0].code, "annual") - self.assertEqual(inst.insurance[0].benefitBalance[0].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[0].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[0].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.insurance[0].benefitBalance[1].category.coding[0].code, "medical") - self.assertEqual(inst.insurance[0].benefitBalance[1].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].allowedMoney.code, "USD") - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].allowedMoney.value, 15000) - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[1].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[1].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[1].subCategory.coding[0].code, "69") - self.assertEqual(inst.insurance[0].benefitBalance[1].subCategory.coding[0].display, "Maternity") - self.assertEqual(inst.insurance[0].benefitBalance[1].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[1].term.coding[0].code, "annual") - self.assertEqual(inst.insurance[0].benefitBalance[1].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[1].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[1].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.insurance[0].benefitBalance[2].category.coding[0].code, "oral") - self.assertEqual(inst.insurance[0].benefitBalance[2].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].allowedMoney.code, "USD") - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].allowedMoney.value, 2000) - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[2].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[2].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[2].subCategory.coding[0].code, "F3") - self.assertEqual(inst.insurance[0].benefitBalance[2].subCategory.coding[0].display, "Dental Coverage") - self.assertEqual(inst.insurance[0].benefitBalance[2].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[2].term.coding[0].code, "annual") - self.assertEqual(inst.insurance[0].benefitBalance[2].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[2].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[2].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.insurance[0].benefitBalance[3].category.coding[0].code, "vision") - self.assertEqual(inst.insurance[0].benefitBalance[3].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[3].description, "Vision products and services such as exams, glasses and contatc lenses.") - self.assertTrue(inst.insurance[0].benefitBalance[3].excluded) - self.assertEqual(inst.insurance[0].benefitBalance[3].name, "Vision") - self.assertEqual(inst.insurance[0].benefitBalance[3].subCategory.coding[0].code, "F6") - self.assertEqual(inst.insurance[0].benefitBalance[3].subCategory.coding[0].display, "Vision Coverage") - self.assertEqual(inst.insurance[0].benefitBalance[3].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the EligibilityResponse.
") - self.assertEqual(inst.text.status, "generated") - - def testEligibilityResponse2(self): - inst = self.instantiate_from("eligibilityresponse-example-benefits.json") - self.assertIsNotNone(inst, "Must have instantiated a EligibilityResponse instance") - self.implEligibilityResponse2(inst) - - js = inst.as_json() - self.assertEqual("EligibilityResponse", js["resourceType"]) - inst2 = eligibilityresponse.EligibilityResponse(js) - self.implEligibilityResponse2(inst2) - - def implEligibilityResponse2(self, inst): - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.disposition, "Policy is currently in-force.") - self.assertEqual(inst.id, "E2501") - self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/eligibilityresponse") - self.assertEqual(inst.identifier[0].value, "881234") - self.assertTrue(inst.inforce) - self.assertEqual(inst.insurance[0].benefitBalance[0].category.coding[0].code, "medical") - self.assertEqual(inst.insurance[0].benefitBalance[0].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].allowedMoney.code, "SAR") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].allowedMoney.value, 500000) - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[0].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].allowedMoney.code, "SAR") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].allowedMoney.value, 100) - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[1].type.coding[0].code, "copay-maximum") - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[2].allowedUnsignedInt, 20) - self.assertEqual(inst.insurance[0].benefitBalance[0].financial[2].type.coding[0].code, "copay-percent") - self.assertEqual(inst.insurance[0].benefitBalance[0].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[0].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[0].subCategory.coding[0].code, "30") - self.assertEqual(inst.insurance[0].benefitBalance[0].subCategory.coding[0].display, "Health Benefit Plan Coverage") - self.assertEqual(inst.insurance[0].benefitBalance[0].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[0].term.coding[0].code, "annual") - self.assertEqual(inst.insurance[0].benefitBalance[0].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[0].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[0].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.insurance[0].benefitBalance[1].category.coding[0].code, "medical") - self.assertEqual(inst.insurance[0].benefitBalance[1].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].allowedMoney.code, "SAR") - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].allowedMoney.value, 15000) - self.assertEqual(inst.insurance[0].benefitBalance[1].financial[0].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[1].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[1].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[1].subCategory.coding[0].code, "69") - self.assertEqual(inst.insurance[0].benefitBalance[1].subCategory.coding[0].display, "Maternity") - self.assertEqual(inst.insurance[0].benefitBalance[1].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[1].term.coding[0].code, "annual") - self.assertEqual(inst.insurance[0].benefitBalance[1].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[1].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[1].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.insurance[0].benefitBalance[2].category.coding[0].code, "oral") - self.assertEqual(inst.insurance[0].benefitBalance[2].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].allowedMoney.code, "SAR") - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].allowedMoney.value, 2000) - self.assertEqual(inst.insurance[0].benefitBalance[2].financial[0].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[2].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[2].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[2].subCategory.coding[0].code, "F3") - self.assertEqual(inst.insurance[0].benefitBalance[2].subCategory.coding[0].display, "Dental Coverage") - self.assertEqual(inst.insurance[0].benefitBalance[2].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[2].term.coding[0].code, "annual") - self.assertEqual(inst.insurance[0].benefitBalance[2].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[2].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[2].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.insurance[0].benefitBalance[3].category.coding[0].code, "vision") - self.assertEqual(inst.insurance[0].benefitBalance[3].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[3].financial[0].allowedMoney.code, "SAR") - self.assertEqual(inst.insurance[0].benefitBalance[3].financial[0].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[3].financial[0].allowedMoney.value, 400) - self.assertEqual(inst.insurance[0].benefitBalance[3].financial[0].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[3].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[3].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[3].subCategory.coding[0].code, "F6") - self.assertEqual(inst.insurance[0].benefitBalance[3].subCategory.coding[0].display, "Vision Coverage") - self.assertEqual(inst.insurance[0].benefitBalance[3].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[3].term.coding[0].code, "annual") - self.assertEqual(inst.insurance[0].benefitBalance[3].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[3].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[3].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.insurance[0].benefitBalance[4].category.coding[0].code, "vision") - self.assertEqual(inst.insurance[0].benefitBalance[4].category.coding[0].system, "http://hl7.org/fhir/benefit-category") - self.assertEqual(inst.insurance[0].benefitBalance[4].financial[0].allowedString, "shared") - self.assertEqual(inst.insurance[0].benefitBalance[4].financial[0].type.coding[0].code, "room") - self.assertEqual(inst.insurance[0].benefitBalance[4].financial[1].allowedMoney.code, "SAR") - self.assertEqual(inst.insurance[0].benefitBalance[4].financial[1].allowedMoney.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.insurance[0].benefitBalance[4].financial[1].allowedMoney.value, 600) - self.assertEqual(inst.insurance[0].benefitBalance[4].financial[1].type.coding[0].code, "benefit") - self.assertEqual(inst.insurance[0].benefitBalance[4].network.coding[0].code, "in") - self.assertEqual(inst.insurance[0].benefitBalance[4].network.coding[0].system, "http://hl7.org/fhir/benefit-network") - self.assertEqual(inst.insurance[0].benefitBalance[4].subCategory.coding[0].code, "49") - self.assertEqual(inst.insurance[0].benefitBalance[4].subCategory.coding[0].display, "Hospital Room and Board") - self.assertEqual(inst.insurance[0].benefitBalance[4].subCategory.coding[0].system, "http://hl7.org/fhir/benefit-subcategory") - self.assertEqual(inst.insurance[0].benefitBalance[4].term.coding[0].code, "day") - self.assertEqual(inst.insurance[0].benefitBalance[4].term.coding[0].system, "http://hl7.org/fhir/benefit-term") - self.assertEqual(inst.insurance[0].benefitBalance[4].unit.coding[0].code, "individual") - self.assertEqual(inst.insurance[0].benefitBalance[4].unit.coding[0].system, "http://hl7.org/fhir/benefit-unit") - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the EligibilityResponse.
") - self.assertEqual(inst.text.status, "generated") - - def testEligibilityResponse3(self): - inst = self.instantiate_from("eligibilityresponse-example-error.json") - self.assertIsNotNone(inst, "Must have instantiated a EligibilityResponse instance") - self.implEligibilityResponse3(inst) - - js = inst.as_json() - self.assertEqual("EligibilityResponse", js["resourceType"]) - inst2 = eligibilityresponse.EligibilityResponse(js) - self.implEligibilityResponse3(inst2) - - def implEligibilityResponse3(self, inst): - self.assertEqual(inst.created.date, FHIRDate("2014-09-16").date) - self.assertEqual(inst.created.as_json(), "2014-09-16") - self.assertEqual(inst.disposition, "Eligibiliy request could not be processed, please address errors before submitting.") - self.assertEqual(inst.error[0].code.coding[0].code, "a001") - self.assertEqual(inst.error[0].code.coding[0].system, "http://hl7.org/fhir/adjudication-error") - self.assertEqual(inst.form.coding[0].code, "ELRSP/2017/01") - self.assertEqual(inst.form.coding[0].system, "http://national.org/form") - self.assertEqual(inst.id, "E2503") - self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/eligibilityresponse") - self.assertEqual(inst.identifier[0].value, "8812343") - self.assertEqual(inst.outcome.coding[0].code, "error") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the EligibilityResponse.
") - self.assertEqual(inst.text.status, "generated") - - def testEligibilityResponse4(self): - inst = self.instantiate_from("eligibilityresponse-example.json") - self.assertIsNotNone(inst, "Must have instantiated a EligibilityResponse instance") - self.implEligibilityResponse4(inst) - - js = inst.as_json() - self.assertEqual("EligibilityResponse", js["resourceType"]) - inst2 = eligibilityresponse.EligibilityResponse(js) - self.implEligibilityResponse4(inst2) - - def implEligibilityResponse4(self, inst): - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.disposition, "Policy is currently in-force.") - self.assertEqual(inst.id, "E2500") - self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/eligibilityresponse") - self.assertEqual(inst.identifier[0].value, "881234") - self.assertTrue(inst.inforce) - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the EligibilityResponse.
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/encounter.py b/fhirclient/models/encounter.py index 52339fd4d..6c201d0ea 100644 --- a/fhirclient/models/encounter.py +++ b/fhirclient/models/encounter.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Encounter) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Encounter) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,18 +27,22 @@ def __init__(self, jsondict=None, strict=True): self.account = None """ The set of accounts that may be used for billing for this Encounter. - List of `FHIRReference` items referencing `Account` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.appointment = None """ The appointment that scheduled this encounter. - Type `FHIRReference` referencing `Appointment` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.basedOn = None + """ The ServiceRequest that initiated this encounter. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.classHistory = None """ List of past encounter classes. List of `EncounterClassHistory` items (represented as `dict` in JSON). """ self.class_fhir = None - """ inpatient | outpatient | ambulatory | emergency +. + """ Classification of patient encounter. Type `Coding` (represented as `dict` in JSON). """ self.diagnosis = None @@ -47,7 +51,7 @@ def __init__(self, jsondict=None, strict=True): self.episodeOfCare = None """ Episode(s) of care that this encounter should be recorded against. - List of `FHIRReference` items referencing `EpisodeOfCare` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.hospitalization = None """ Details about the admission to a healthcare service. @@ -57,10 +61,6 @@ def __init__(self, jsondict=None, strict=True): """ Identifier(s) by which this encounter is known. List of `Identifier` items (represented as `dict` in JSON). """ - self.incomingReferral = None - """ The ReferralRequest that initiated this encounter. - List of `FHIRReference` items referencing `ReferralRequest` (represented as `dict` in JSON). """ - self.length = None """ Quantity of time the encounter lasted (less time absent). Type `Duration` (represented as `dict` in JSON). """ @@ -71,7 +71,7 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Another Encounter this encounter is part of. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.participant = None """ List of participants involved in the encounter. @@ -85,13 +85,21 @@ def __init__(self, jsondict=None, strict=True): """ Indicates the urgency of the encounter. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.reason = None - """ Reason the encounter takes place (code). + self.reasonCode = None + """ Coded reason the encounter takes place. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.reasonReference = None + """ Reason the encounter takes place (reference). + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.serviceProvider = None - """ The custodian organization of this Encounter record. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ The organization (facility) responsible for this encounter. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.serviceType = None + """ Specific type of service. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.status = None """ planned | arrived | triaged | in-progress | onleave | finished | @@ -103,8 +111,8 @@ def __init__(self, jsondict=None, strict=True): List of `EncounterStatusHistory` items (represented as `dict` in JSON). """ self.subject = None - """ The patient ro group present at the encounter. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + """ The patient or group present at the encounter. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ Specific type of encounter. @@ -116,22 +124,24 @@ def elementProperties(self): js = super(Encounter, self).elementProperties() js.extend([ ("account", "account", fhirreference.FHIRReference, True, None, False), - ("appointment", "appointment", fhirreference.FHIRReference, False, None, False), + ("appointment", "appointment", fhirreference.FHIRReference, True, None, False), + ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("classHistory", "classHistory", EncounterClassHistory, True, None, False), - ("class_fhir", "class", coding.Coding, False, None, False), + ("class_fhir", "class", coding.Coding, False, None, True), ("diagnosis", "diagnosis", EncounterDiagnosis, True, None, False), ("episodeOfCare", "episodeOfCare", fhirreference.FHIRReference, True, None, False), ("hospitalization", "hospitalization", EncounterHospitalization, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("incomingReferral", "incomingReferral", fhirreference.FHIRReference, True, None, False), ("length", "length", duration.Duration, False, None, False), ("location", "location", EncounterLocation, True, None, False), ("partOf", "partOf", fhirreference.FHIRReference, False, None, False), ("participant", "participant", EncounterParticipant, True, None, False), ("period", "period", period.Period, False, None, False), ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), - ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("serviceProvider", "serviceProvider", fhirreference.FHIRReference, False, None, False), + ("serviceType", "serviceType", codeableconcept.CodeableConcept, False, None, False), ("status", "status", str, False, None, True), ("statusHistory", "statusHistory", EncounterStatusHistory, True, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, False), @@ -146,13 +156,12 @@ class EncounterClassHistory(backboneelement.BackboneElement): """ List of past encounter classes. The class history permits the tracking of the encounters transitions - without needing to go through the resource history. - - This would be used for a case where an admission starts of as an emergency - encounter, then transisions into an inpatient scenario. Doing this and not - restarting a new encounter ensures that any lab/diagnostic results can more - easily follow the patient and not require re-processing and not get lost or - cancelled during a kindof discharge from emergency to inpatient. + without needing to go through the resource history. This would be used + for a case where an admission starts of as an emergency encounter, then + transitions into an inpatient scenario. Doing this and not restarting a new + encounter ensures that any lab/diagnostic results can more easily follow + the patient and not require re-processing and not get lost or cancelled + during a kind of discharge from emergency to inpatient. """ resource_type = "EncounterClassHistory" @@ -199,14 +208,14 @@ def __init__(self, jsondict=None, strict=True): """ self.condition = None - """ Reason the encounter takes place (resource). - Type `FHIRReference` referencing `Condition, Procedure` (represented as `dict` in JSON). """ + """ The diagnosis or procedure relevant to the encounter. + Type `FHIRReference` (represented as `dict` in JSON). """ self.rank = None """ Ranking of the diagnosis (for each role type). Type `int`. """ - self.role = None + self.use = None """ Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …). Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -218,7 +227,7 @@ def elementProperties(self): js.extend([ ("condition", "condition", fhirreference.FHIRReference, False, None, True), ("rank", "rank", int, False, None, False), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("use", "use", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -242,8 +251,8 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.destination = None - """ Location to which the patient is discharged. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Location/organization to which the patient is discharged. + Type `FHIRReference` (represented as `dict` in JSON). """ self.dietPreference = None """ Diet preferences reported by the patient. @@ -254,8 +263,9 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.origin = None - """ The location from which the patient came before admission. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ The location/organization from which the patient came before + admission. + Type `FHIRReference` (represented as `dict` in JSON). """ self.preAdmissionIdentifier = None """ Pre-admission identifier. @@ -310,12 +320,17 @@ def __init__(self, jsondict=None, strict=True): self.location = None """ Location the encounter takes place. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Time period during which the patient was present at the location. Type `Period` (represented as `dict` in JSON). """ + self.physicalType = None + """ The physical type of the location (usually the level in the + location hierachy - bed room ward etc.). + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.status = None """ planned | active | reserved | completed. Type `str`. """ @@ -327,6 +342,7 @@ def elementProperties(self): js.extend([ ("location", "location", fhirreference.FHIRReference, False, None, True), ("period", "period", period.Period, False, None, False), + ("physicalType", "physicalType", codeableconcept.CodeableConcept, False, None, False), ("status", "status", str, False, None, False), ]) return js @@ -335,7 +351,7 @@ def elementProperties(self): class EncounterParticipant(backboneelement.BackboneElement): """ List of participants involved in the encounter. - The list of people responsible for providing the service. + The list of people responsible for providing the service. """ resource_type = "EncounterParticipant" @@ -350,7 +366,7 @@ def __init__(self, jsondict=None, strict=True): self.individual = None """ Persons involved in the encounter other than the patient. - Type `FHIRReference` referencing `Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Period of time during the encounter that the participant diff --git a/fhirclient/models/encounter_tests.py b/fhirclient/models/encounter_tests.py index a512e28d3..c0611906d 100644 --- a/fhirclient/models/encounter_tests.py +++ b/fhirclient/models/encounter_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return encounter.Encounter(js) def testEncounter1(self): - inst = self.instantiate_from("encounter-example-emerg.json") + inst = self.instantiate_from("encounter-example-home.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter1(inst) @@ -32,79 +32,33 @@ def testEncounter1(self): self.implEncounter1(inst2) def implEncounter1(self, inst): - self.assertEqual(inst.classHistory[0].class_fhir.code, "EMER") - self.assertEqual(inst.classHistory[0].class_fhir.display, "emergency") - self.assertEqual(inst.classHistory[0].class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.classHistory[0].period.end.date, FHIRDate("2017-02-01T09:27:00+10:00").date) - self.assertEqual(inst.classHistory[0].period.end.as_json(), "2017-02-01T09:27:00+10:00") - self.assertEqual(inst.classHistory[0].period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) - self.assertEqual(inst.classHistory[0].period.start.as_json(), "2017-02-01T07:15:00+10:00") - self.assertEqual(inst.classHistory[1].class_fhir.code, "IMP") - self.assertEqual(inst.classHistory[1].class_fhir.display, "inpatient encounter") - self.assertEqual(inst.classHistory[1].class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.classHistory[1].period.start.date, FHIRDate("2017-02-01T09:27:00+10:00").date) - self.assertEqual(inst.classHistory[1].period.start.as_json(), "2017-02-01T09:27:00+10:00") - self.assertEqual(inst.class_fhir.code, "IMP") - self.assertEqual(inst.class_fhir.display, "inpatient encounter") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "emd") - self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "From accident/emergency department") - self.assertEqual(inst.hospitalization.admitSource.coding[0].system, "http://hl7.org/fhir/admit-source") - self.assertEqual(inst.id, "emerg") - self.assertEqual(inst.location[0].period.end.date, FHIRDate("2017-02-01T08:45:00+10:00").date) - self.assertEqual(inst.location[0].period.end.as_json(), "2017-02-01T08:45:00+10:00") - self.assertEqual(inst.location[0].period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) - self.assertEqual(inst.location[0].period.start.as_json(), "2017-02-01T07:15:00+10:00") - self.assertEqual(inst.location[0].status, "active") - self.assertEqual(inst.location[1].period.end.date, FHIRDate("2017-02-01T09:27:00+10:00").date) - self.assertEqual(inst.location[1].period.end.as_json(), "2017-02-01T09:27:00+10:00") - self.assertEqual(inst.location[1].period.start.date, FHIRDate("2017-02-01T08:45:00+10:00").date) - self.assertEqual(inst.location[1].period.start.as_json(), "2017-02-01T08:45:00+10:00") - self.assertEqual(inst.location[1].status, "active") - self.assertEqual(inst.location[2].period.end.date, FHIRDate("2017-02-01T12:15:00+10:00").date) - self.assertEqual(inst.location[2].period.end.as_json(), "2017-02-01T12:15:00+10:00") - self.assertEqual(inst.location[2].period.start.date, FHIRDate("2017-02-01T09:27:00+10:00").date) - self.assertEqual(inst.location[2].period.start.as_json(), "2017-02-01T09:27:00+10:00") - self.assertEqual(inst.location[2].status, "active") - self.assertEqual(inst.location[3].period.end.date, FHIRDate("2017-02-01T12:45:00+10:00").date) - self.assertEqual(inst.location[3].period.end.as_json(), "2017-02-01T12:45:00+10:00") - self.assertEqual(inst.location[3].period.start.date, FHIRDate("2017-02-01T12:15:00+10:00").date) - self.assertEqual(inst.location[3].period.start.as_json(), "2017-02-01T12:15:00+10:00") - self.assertEqual(inst.location[3].status, "reserved") - self.assertEqual(inst.location[4].period.start.date, FHIRDate("2017-02-01T12:45:00+10:00").date) - self.assertEqual(inst.location[4].period.start.as_json(), "2017-02-01T12:45:00+10:00") - self.assertEqual(inst.location[4].status, "active") - self.assertEqual(inst.period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) - self.assertEqual(inst.period.start.as_json(), "2017-02-01T07:15:00+10:00") - self.assertEqual(inst.status, "in-progress") - self.assertEqual(inst.statusHistory[0].period.end.date, FHIRDate("2017-02-01T07:35:00+10:00").date) - self.assertEqual(inst.statusHistory[0].period.end.as_json(), "2017-02-01T07:35:00+10:00") - self.assertEqual(inst.statusHistory[0].period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) - self.assertEqual(inst.statusHistory[0].period.start.as_json(), "2017-02-01T07:15:00+10:00") - self.assertEqual(inst.statusHistory[0].status, "arrived") - self.assertEqual(inst.statusHistory[1].period.end.date, FHIRDate("2017-02-01T08:45:00+10:00").date) - self.assertEqual(inst.statusHistory[1].period.end.as_json(), "2017-02-01T08:45:00+10:00") - self.assertEqual(inst.statusHistory[1].period.start.date, FHIRDate("2017-02-01T07:35:00+10:00").date) - self.assertEqual(inst.statusHistory[1].period.start.as_json(), "2017-02-01T07:35:00+10:00") - self.assertEqual(inst.statusHistory[1].status, "triaged") - self.assertEqual(inst.statusHistory[2].period.end.date, FHIRDate("2017-02-01T12:15:00+10:00").date) - self.assertEqual(inst.statusHistory[2].period.end.as_json(), "2017-02-01T12:15:00+10:00") - self.assertEqual(inst.statusHistory[2].period.start.date, FHIRDate("2017-02-01T08:45:00+10:00").date) - self.assertEqual(inst.statusHistory[2].period.start.as_json(), "2017-02-01T08:45:00+10:00") - self.assertEqual(inst.statusHistory[2].status, "in-progress") - self.assertEqual(inst.statusHistory[3].period.end.date, FHIRDate("2017-02-01T12:45:00+10:00").date) - self.assertEqual(inst.statusHistory[3].period.end.as_json(), "2017-02-01T12:45:00+10:00") - self.assertEqual(inst.statusHistory[3].period.start.date, FHIRDate("2017-02-01T12:15:00+10:00").date) - self.assertEqual(inst.statusHistory[3].period.start.as_json(), "2017-02-01T12:15:00+10:00") - self.assertEqual(inst.statusHistory[3].status, "onleave") - self.assertEqual(inst.statusHistory[4].period.start.date, FHIRDate("2017-02-01T12:45:00+10:00").date) - self.assertEqual(inst.statusHistory[4].period.start.as_json(), "2017-02-01T12:45:00+10:00") - self.assertEqual(inst.statusHistory[4].status, "in-progress") - self.assertEqual(inst.text.div, "
Emergency visit that escalated into inpatient patient @example
") + self.assertEqual(inst.class_fhir.code, "HH") + self.assertEqual(inst.class_fhir.display, "home health") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.contained[0].id, "home") + self.assertEqual(inst.id, "home") + self.assertEqual(inst.location[0].period.end.date, FHIRDate("2015-01-17T16:30:00+10:00").date) + self.assertEqual(inst.location[0].period.end.as_json(), "2015-01-17T16:30:00+10:00") + self.assertEqual(inst.location[0].period.start.date, FHIRDate("2015-01-17T16:00:00+10:00").date) + self.assertEqual(inst.location[0].period.start.as_json(), "2015-01-17T16:00:00+10:00") + self.assertEqual(inst.location[0].status, "completed") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.participant[0].period.end.date, FHIRDate("2015-01-17T16:30:00+10:00").date) + self.assertEqual(inst.participant[0].period.end.as_json(), "2015-01-17T16:30:00+10:00") + self.assertEqual(inst.participant[0].period.start.date, FHIRDate("2015-01-17T16:00:00+10:00").date) + self.assertEqual(inst.participant[0].period.start.as_json(), "2015-01-17T16:00:00+10:00") + self.assertEqual(inst.period.end.date, FHIRDate("2015-01-17T16:30:00+10:00").date) + self.assertEqual(inst.period.end.as_json(), "2015-01-17T16:30:00+10:00") + self.assertEqual(inst.period.start.date, FHIRDate("2015-01-17T16:00:00+10:00").date) + self.assertEqual(inst.period.start.as_json(), "2015-01-17T16:00:00+10:00") + self.assertEqual(inst.status, "finished") + self.assertEqual(inst.text.div, "
Encounter with patient @example who is at home
") self.assertEqual(inst.text.status, "generated") def testEncounter2(self): - inst = self.instantiate_from("encounter-example-f001-heart.json") + inst = self.instantiate_from("encounter-example-f201-20130404.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter2(inst) @@ -116,38 +70,25 @@ def testEncounter2(self): def implEncounter2(self, inst): self.assertEqual(inst.class_fhir.code, "AMB") self.assertEqual(inst.class_fhir.display, "ambulatory") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "305956004") - self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "Referral by physician") - self.assertEqual(inst.hospitalization.admitSource.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].code, "306689006") - self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].display, "Discharge to home") - self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.hospitalization.preAdmissionIdentifier.system, "http://www.amc.nl/zorgportal/identifiers/pre-admissions") - self.assertEqual(inst.hospitalization.preAdmissionIdentifier.use, "official") - self.assertEqual(inst.hospitalization.preAdmissionIdentifier.value, "93042") - self.assertEqual(inst.id, "f001") - self.assertEqual(inst.identifier[0].system, "http://www.amc.nl/zorgportal/identifiers/visits") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "v1451") - self.assertEqual(inst.length.code, "min") - self.assertEqual(inst.length.system, "http://unitsofmeasure.org") - self.assertEqual(inst.length.unit, "min") - self.assertEqual(inst.length.value, 140) - self.assertEqual(inst.priority.coding[0].code, "310361003") - self.assertEqual(inst.priority.coding[0].display, "Non-urgent cardiological admission") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.identifier[0].use, "temp") + self.assertEqual(inst.identifier[0].value, "Encounter_Roel_20130404") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority.coding[0].code, "17621005") + self.assertEqual(inst.priority.coding[0].display, "Normal") self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].coding[0].code, "34068001") - self.assertEqual(inst.reason[0].coding[0].display, "Heart valve replacement") - self.assertEqual(inst.reason[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reasonCode[0].text, "The patient had fever peaks over the last couple of days. He is worried about these peaks.") self.assertEqual(inst.status, "finished") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "270427003") - self.assertEqual(inst.type[0].coding[0].display, "Patient-initiated encounter") + self.assertEqual(inst.type[0].coding[0].code, "11429006") + self.assertEqual(inst.type[0].coding[0].display, "Consultation") self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") def testEncounter3(self): - inst = self.instantiate_from("encounter-example-f002-lung.json") + inst = self.instantiate_from("encounter-example-f003-abscess.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter3(inst) @@ -159,30 +100,33 @@ def testEncounter3(self): def implEncounter3(self, inst): self.assertEqual(inst.class_fhir.code, "AMB") self.assertEqual(inst.class_fhir.display, "ambulatory") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "305997006") - self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "Referral by radiologist") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "305956004") + self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "Referral by physician") self.assertEqual(inst.hospitalization.admitSource.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].code, "306689006") self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].display, "Discharge to home") self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.hospitalization.preAdmissionIdentifier.system, "http://www.bmc.nl/zorgportal/identifiers/pre-admissions") self.assertEqual(inst.hospitalization.preAdmissionIdentifier.use, "official") - self.assertEqual(inst.hospitalization.preAdmissionIdentifier.value, "98682") - self.assertEqual(inst.id, "f002") + self.assertEqual(inst.hospitalization.preAdmissionIdentifier.value, "93042") + self.assertEqual(inst.id, "f003") self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/encounters") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "v3251") + self.assertEqual(inst.identifier[0].value, "v6751") self.assertEqual(inst.length.code, "min") self.assertEqual(inst.length.system, "http://unitsofmeasure.org") self.assertEqual(inst.length.unit, "min") - self.assertEqual(inst.length.value, 140) + self.assertEqual(inst.length.value, 90) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.priority.coding[0].code, "103391001") - self.assertEqual(inst.priority.coding[0].display, "Urgent") + self.assertEqual(inst.priority.coding[0].display, "Non-urgent ear, nose and throat admission") self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].coding[0].code, "34068001") - self.assertEqual(inst.reason[0].coding[0].display, "Partial lobectomy of lung") - self.assertEqual(inst.reason[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reasonCode[0].coding[0].code, "18099001") + self.assertEqual(inst.reasonCode[0].coding[0].display, "Retropharyngeal abscess") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.status, "finished") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type[0].coding[0].code, "270427003") @@ -190,7 +134,7 @@ def implEncounter3(self, inst): self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") def testEncounter4(self): - inst = self.instantiate_from("encounter-example-f003-abscess.json") + inst = self.instantiate_from("encounter-example.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter4(inst) @@ -200,69 +144,65 @@ def testEncounter4(self): self.implEncounter4(inst2) def implEncounter4(self, inst): + self.assertEqual(inst.class_fhir.code, "IMP") + self.assertEqual(inst.class_fhir.display, "inpatient encounter") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "in-progress") + self.assertEqual(inst.text.div, "
Encounter with patient @example
") + self.assertEqual(inst.text.status, "generated") + + def testEncounter5(self): + inst = self.instantiate_from("encounter-example-f002-lung.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter5(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter5(inst2) + + def implEncounter5(self, inst): self.assertEqual(inst.class_fhir.code, "AMB") self.assertEqual(inst.class_fhir.display, "ambulatory") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "305956004") - self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "Referral by physician") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "305997006") + self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "Referral by radiologist") self.assertEqual(inst.hospitalization.admitSource.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].code, "306689006") self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].display, "Discharge to home") self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.hospitalization.preAdmissionIdentifier.system, "http://www.bmc.nl/zorgportal/identifiers/pre-admissions") self.assertEqual(inst.hospitalization.preAdmissionIdentifier.use, "official") - self.assertEqual(inst.hospitalization.preAdmissionIdentifier.value, "93042") - self.assertEqual(inst.id, "f003") + self.assertEqual(inst.hospitalization.preAdmissionIdentifier.value, "98682") + self.assertEqual(inst.id, "f002") self.assertEqual(inst.identifier[0].system, "http://www.bmc.nl/zorgportal/identifiers/encounters") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "v6751") + self.assertEqual(inst.identifier[0].value, "v3251") self.assertEqual(inst.length.code, "min") self.assertEqual(inst.length.system, "http://unitsofmeasure.org") self.assertEqual(inst.length.unit, "min") - self.assertEqual(inst.length.value, 90) + self.assertEqual(inst.length.value, 140) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.priority.coding[0].code, "103391001") - self.assertEqual(inst.priority.coding[0].display, "Non-urgent ear, nose and throat admission") + self.assertEqual(inst.priority.coding[0].display, "Urgent") self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].coding[0].code, "18099001") - self.assertEqual(inst.reason[0].coding[0].display, "Retropharyngeal abscess") - self.assertEqual(inst.reason[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/encounter-primaryDiagnosis") - self.assertEqual(inst.reason[0].extension[0].valuePositiveInt, 1) + self.assertEqual(inst.reasonCode[0].coding[0].code, "34068001") + self.assertEqual(inst.reasonCode[0].coding[0].display, "Partial lobectomy of lung") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.status, "finished") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type[0].coding[0].code, "270427003") self.assertEqual(inst.type[0].coding[0].display, "Patient-initiated encounter") self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") - def testEncounter5(self): - inst = self.instantiate_from("encounter-example-f201-20130404.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter5(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter5(inst2) - - def implEncounter5(self, inst): - self.assertEqual(inst.class_fhir.code, "AMB") - self.assertEqual(inst.class_fhir.display, "ambulatory") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.id, "f201") - self.assertEqual(inst.identifier[0].use, "temp") - self.assertEqual(inst.identifier[0].value, "Encounter_Roel_20130404") - self.assertEqual(inst.priority.coding[0].code, "17621005") - self.assertEqual(inst.priority.coding[0].display, "Normal") - self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].text, "The patient had fever peaks over the last couple of days. He is worried about these peaks.") - self.assertEqual(inst.status, "finished") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "11429006") - self.assertEqual(inst.type[0].coding[0].display, "Consultation") - self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") - def testEncounter6(self): - inst = self.instantiate_from("encounter-example-f202-20130128.json") + inst = self.instantiate_from("encounter-example-f203-20130311.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter6(inst) @@ -272,53 +212,16 @@ def testEncounter6(self): self.implEncounter6(inst2) def implEncounter6(self, inst): - self.assertEqual(inst.class_fhir.code, "AMB") - self.assertEqual(inst.class_fhir.display, "ambulatory") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.diagnosis[0].rank, 1) - self.assertEqual(inst.diagnosis[0].role.coding[0].code, "AD") - self.assertEqual(inst.diagnosis[0].role.coding[0].display, "Admission diagnosis") - self.assertEqual(inst.diagnosis[0].role.coding[0].system, "http://hl7.org/fhir/diagnosis-role") - self.assertEqual(inst.id, "f202") - self.assertEqual(inst.identifier[0].use, "temp") - self.assertEqual(inst.identifier[0].value, "Encounter_Roel_20130128") - self.assertEqual(inst.length.code, "min") - self.assertEqual(inst.length.system, "http://unitsofmeasure.org") - self.assertEqual(inst.length.unit, "minutes") - self.assertEqual(inst.length.value, 56) - self.assertEqual(inst.priority.coding[0].code, "103391001") - self.assertEqual(inst.priority.coding[0].display, "Urgent") - self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/encounter-primaryDiagnosis") - self.assertEqual(inst.reason[0].extension[0].valuePositiveInt, 2) - self.assertEqual(inst.reason[0].text, "The patient is treated for a tumor.") - self.assertEqual(inst.status, "finished") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "367336001") - self.assertEqual(inst.type[0].coding[0].display, "Chemotherapy") - self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") - - def testEncounter7(self): - inst = self.instantiate_from("encounter-example-f203-20130311.json") - self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") - self.implEncounter7(inst) - - js = inst.as_json() - self.assertEqual("Encounter", js["resourceType"]) - inst2 = encounter.Encounter(js) - self.implEncounter7(inst2) - - def implEncounter7(self, inst): self.assertEqual(inst.class_fhir.code, "IMP") self.assertEqual(inst.class_fhir.display, "inpatient encounter") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.diagnosis[0].rank, 1) - self.assertEqual(inst.diagnosis[0].role.coding[0].code, "AD") - self.assertEqual(inst.diagnosis[0].role.coding[0].display, "Admission diagnosis") - self.assertEqual(inst.diagnosis[0].role.coding[0].system, "http://hl7.org/fhir/diagnosis-role") - self.assertEqual(inst.diagnosis[1].role.coding[0].code, "DD") - self.assertEqual(inst.diagnosis[1].role.coding[0].display, "Discharge diagnosis") - self.assertEqual(inst.diagnosis[1].role.coding[0].system, "http://hl7.org/fhir/diagnosis-role") + self.assertEqual(inst.diagnosis[0].use.coding[0].code, "AD") + self.assertEqual(inst.diagnosis[0].use.coding[0].display, "Admission diagnosis") + self.assertEqual(inst.diagnosis[0].use.coding[0].system, "http://terminology.hl7.org/CodeSystem/diagnosis-role") + self.assertEqual(inst.diagnosis[1].use.coding[0].code, "DD") + self.assertEqual(inst.diagnosis[1].use.coding[0].display, "Discharge diagnosis") + self.assertEqual(inst.diagnosis[1].use.coding[0].system, "http://terminology.hl7.org/CodeSystem/diagnosis-role") self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "309902002") self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "Clinical Oncology Department") self.assertEqual(inst.hospitalization.admitSource.coding[0].system, "http://snomed.info/sct") @@ -328,15 +231,18 @@ def implEncounter7(self, inst): self.assertEqual(inst.hospitalization.reAdmission.coding[0].display, "readmitted") self.assertEqual(inst.hospitalization.specialArrangement[0].coding[0].code, "wheel") self.assertEqual(inst.hospitalization.specialArrangement[0].coding[0].display, "Wheelchair") - self.assertEqual(inst.hospitalization.specialArrangement[0].coding[0].system, "http://hl7.org/fhir/encounter-special-arrangements") + self.assertEqual(inst.hospitalization.specialArrangement[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/encounter-special-arrangements") self.assertEqual(inst.hospitalization.specialCourtesy[0].coding[0].code, "NRM") self.assertEqual(inst.hospitalization.specialCourtesy[0].coding[0].display, "normal courtesy") - self.assertEqual(inst.hospitalization.specialCourtesy[0].coding[0].system, "http://hl7.org/fhir/v3/EncounterSpecialCourtesy") + self.assertEqual(inst.hospitalization.specialCourtesy[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-EncounterSpecialCourtesy") self.assertEqual(inst.id, "f203") self.assertEqual(inst.identifier[0].use, "temp") self.assertEqual(inst.identifier[0].value, "Encounter_Roel_20130311") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.participant[0].type[0].coding[0].code, "PART") - self.assertEqual(inst.participant[0].type[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.participant[0].type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.period.end.date, FHIRDate("2013-03-20").date) self.assertEqual(inst.period.end.as_json(), "2013-03-20") self.assertEqual(inst.period.start.date, FHIRDate("2013-03-11").date) @@ -344,7 +250,7 @@ def implEncounter7(self, inst): self.assertEqual(inst.priority.coding[0].code, "394849002") self.assertEqual(inst.priority.coding[0].display, "High priority") self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.reason[0].text, "The patient seems to suffer from bilateral pneumonia and renal insufficiency, most likely due to chemotherapy.") + self.assertEqual(inst.reasonCode[0].text, "The patient seems to suffer from bilateral pneumonia and renal insufficiency, most likely due to chemotherapy.") self.assertEqual(inst.status, "finished") self.assertEqual(inst.statusHistory[0].period.start.date, FHIRDate("2013-03-08").date) self.assertEqual(inst.statusHistory[0].period.start.as_json(), "2013-03-08") @@ -354,8 +260,35 @@ def implEncounter7(self, inst): self.assertEqual(inst.type[0].coding[0].display, "Inpatient stay for nine days") self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") + def testEncounter7(self): + inst = self.instantiate_from("encounter-example-xcda.json") + self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") + self.implEncounter7(inst) + + js = inst.as_json() + self.assertEqual("Encounter", js["resourceType"]) + inst2 = encounter.Encounter(js) + self.implEncounter7(inst2) + + def implEncounter7(self, inst): + self.assertEqual(inst.class_fhir.code, "AMB") + self.assertEqual(inst.class_fhir.display, "ambulatory") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.id, "xcda") + self.assertEqual(inst.identifier[0].system, "http://healthcare.example.org/identifiers/enocunter") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "1234213.52345873") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.reasonCode[0].coding[0].code, "T-D8200") + self.assertEqual(inst.reasonCode[0].coding[0].display, "Arm") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://ihe.net/xds/connectathon/eventCodes") + self.assertEqual(inst.status, "finished") + self.assertEqual(inst.text.status, "generated") + def testEncounter8(self): - inst = self.instantiate_from("encounter-example-home.json") + inst = self.instantiate_from("encounter-example-f202-20130128.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter8(inst) @@ -365,30 +298,39 @@ def testEncounter8(self): self.implEncounter8(inst2) def implEncounter8(self, inst): - self.assertEqual(inst.class_fhir.code, "HH") - self.assertEqual(inst.class_fhir.display, "home health") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.contained[0].id, "home") - self.assertEqual(inst.id, "home") - self.assertEqual(inst.location[0].period.end.date, FHIRDate("2015-01-17T16:30:00+10:00").date) - self.assertEqual(inst.location[0].period.end.as_json(), "2015-01-17T16:30:00+10:00") - self.assertEqual(inst.location[0].period.start.date, FHIRDate("2015-01-17T16:00:00+10:00").date) - self.assertEqual(inst.location[0].period.start.as_json(), "2015-01-17T16:00:00+10:00") - self.assertEqual(inst.location[0].status, "completed") - self.assertEqual(inst.participant[0].period.end.date, FHIRDate("2015-01-17T16:30:00+10:00").date) - self.assertEqual(inst.participant[0].period.end.as_json(), "2015-01-17T16:30:00+10:00") - self.assertEqual(inst.participant[0].period.start.date, FHIRDate("2015-01-17T16:00:00+10:00").date) - self.assertEqual(inst.participant[0].period.start.as_json(), "2015-01-17T16:00:00+10:00") - self.assertEqual(inst.period.end.date, FHIRDate("2015-01-17T16:30:00+10:00").date) - self.assertEqual(inst.period.end.as_json(), "2015-01-17T16:30:00+10:00") - self.assertEqual(inst.period.start.date, FHIRDate("2015-01-17T16:00:00+10:00").date) - self.assertEqual(inst.period.start.as_json(), "2015-01-17T16:00:00+10:00") + self.assertEqual(inst.class_fhir.code, "AMB") + self.assertEqual(inst.class_fhir.display, "ambulatory") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.diagnosis[0].rank, 2) + self.assertEqual(inst.diagnosis[0].use.coding[0].code, "AD") + self.assertEqual(inst.diagnosis[0].use.coding[0].display, "Admission diagnosis") + self.assertEqual(inst.diagnosis[0].use.coding[0].system, "http://terminology.hl7.org/CodeSystem/diagnosis-role") + self.assertEqual(inst.diagnosis[1].rank, 1) + self.assertEqual(inst.diagnosis[1].use.coding[0].code, "CC") + self.assertEqual(inst.diagnosis[1].use.coding[0].display, "Chief complaint") + self.assertEqual(inst.diagnosis[1].use.coding[0].system, "http://terminology.hl7.org/CodeSystem/diagnosis-role") + self.assertEqual(inst.id, "f202") + self.assertEqual(inst.identifier[0].use, "temp") + self.assertEqual(inst.identifier[0].value, "Encounter_Roel_20130128") + self.assertEqual(inst.length.code, "min") + self.assertEqual(inst.length.system, "http://unitsofmeasure.org") + self.assertEqual(inst.length.unit, "minutes") + self.assertEqual(inst.length.value, 56) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority.coding[0].code, "103391001") + self.assertEqual(inst.priority.coding[0].display, "Urgent") + self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reasonCode[0].text, "The patient is treated for a tumor.") self.assertEqual(inst.status, "finished") - self.assertEqual(inst.text.div, "
Encounter with patient @example who is at home
") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "367336001") + self.assertEqual(inst.type[0].coding[0].display, "Chemotherapy") + self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") def testEncounter9(self): - inst = self.instantiate_from("encounter-example-xcda.json") + inst = self.instantiate_from("encounter-example-emerg.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter9(inst) @@ -398,21 +340,82 @@ def testEncounter9(self): self.implEncounter9(inst2) def implEncounter9(self, inst): - self.assertEqual(inst.class_fhir.code, "AMB") - self.assertEqual(inst.class_fhir.display, "ambulatory") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.id, "xcda") - self.assertEqual(inst.identifier[0].system, "http://healthcare.example.org/identifiers/enocunter") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "1234213.52345873") - self.assertEqual(inst.reason[0].coding[0].code, "T-D8200") - self.assertEqual(inst.reason[0].coding[0].display, "Arm") - self.assertEqual(inst.reason[0].coding[0].system, "http://ihe.net/xds/connectathon/eventCodes") - self.assertEqual(inst.status, "finished") + self.assertEqual(inst.classHistory[0].class_fhir.code, "EMER") + self.assertEqual(inst.classHistory[0].class_fhir.display, "emergency") + self.assertEqual(inst.classHistory[0].class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.classHistory[0].period.end.date, FHIRDate("2017-02-01T09:27:00+10:00").date) + self.assertEqual(inst.classHistory[0].period.end.as_json(), "2017-02-01T09:27:00+10:00") + self.assertEqual(inst.classHistory[0].period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) + self.assertEqual(inst.classHistory[0].period.start.as_json(), "2017-02-01T07:15:00+10:00") + self.assertEqual(inst.classHistory[1].class_fhir.code, "IMP") + self.assertEqual(inst.classHistory[1].class_fhir.display, "inpatient encounter") + self.assertEqual(inst.classHistory[1].class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.classHistory[1].period.start.date, FHIRDate("2017-02-01T09:27:00+10:00").date) + self.assertEqual(inst.classHistory[1].period.start.as_json(), "2017-02-01T09:27:00+10:00") + self.assertEqual(inst.class_fhir.code, "IMP") + self.assertEqual(inst.class_fhir.display, "inpatient encounter") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "emd") + self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "From accident/emergency department") + self.assertEqual(inst.hospitalization.admitSource.coding[0].system, "http://terminology.hl7.org/CodeSystem/admit-source") + self.assertEqual(inst.id, "emerg") + self.assertEqual(inst.location[0].period.end.date, FHIRDate("2017-02-01T08:45:00+10:00").date) + self.assertEqual(inst.location[0].period.end.as_json(), "2017-02-01T08:45:00+10:00") + self.assertEqual(inst.location[0].period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) + self.assertEqual(inst.location[0].period.start.as_json(), "2017-02-01T07:15:00+10:00") + self.assertEqual(inst.location[0].status, "active") + self.assertEqual(inst.location[1].period.end.date, FHIRDate("2017-02-01T09:27:00+10:00").date) + self.assertEqual(inst.location[1].period.end.as_json(), "2017-02-01T09:27:00+10:00") + self.assertEqual(inst.location[1].period.start.date, FHIRDate("2017-02-01T08:45:00+10:00").date) + self.assertEqual(inst.location[1].period.start.as_json(), "2017-02-01T08:45:00+10:00") + self.assertEqual(inst.location[1].status, "active") + self.assertEqual(inst.location[2].period.end.date, FHIRDate("2017-02-01T12:15:00+10:00").date) + self.assertEqual(inst.location[2].period.end.as_json(), "2017-02-01T12:15:00+10:00") + self.assertEqual(inst.location[2].period.start.date, FHIRDate("2017-02-01T09:27:00+10:00").date) + self.assertEqual(inst.location[2].period.start.as_json(), "2017-02-01T09:27:00+10:00") + self.assertEqual(inst.location[2].status, "active") + self.assertEqual(inst.location[3].period.end.date, FHIRDate("2017-02-01T12:45:00+10:00").date) + self.assertEqual(inst.location[3].period.end.as_json(), "2017-02-01T12:45:00+10:00") + self.assertEqual(inst.location[3].period.start.date, FHIRDate("2017-02-01T12:15:00+10:00").date) + self.assertEqual(inst.location[3].period.start.as_json(), "2017-02-01T12:15:00+10:00") + self.assertEqual(inst.location[3].status, "reserved") + self.assertEqual(inst.location[4].period.start.date, FHIRDate("2017-02-01T12:45:00+10:00").date) + self.assertEqual(inst.location[4].period.start.as_json(), "2017-02-01T12:45:00+10:00") + self.assertEqual(inst.location[4].status, "active") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) + self.assertEqual(inst.period.start.as_json(), "2017-02-01T07:15:00+10:00") + self.assertEqual(inst.status, "in-progress") + self.assertEqual(inst.statusHistory[0].period.end.date, FHIRDate("2017-02-01T07:35:00+10:00").date) + self.assertEqual(inst.statusHistory[0].period.end.as_json(), "2017-02-01T07:35:00+10:00") + self.assertEqual(inst.statusHistory[0].period.start.date, FHIRDate("2017-02-01T07:15:00+10:00").date) + self.assertEqual(inst.statusHistory[0].period.start.as_json(), "2017-02-01T07:15:00+10:00") + self.assertEqual(inst.statusHistory[0].status, "arrived") + self.assertEqual(inst.statusHistory[1].period.end.date, FHIRDate("2017-02-01T08:45:00+10:00").date) + self.assertEqual(inst.statusHistory[1].period.end.as_json(), "2017-02-01T08:45:00+10:00") + self.assertEqual(inst.statusHistory[1].period.start.date, FHIRDate("2017-02-01T07:35:00+10:00").date) + self.assertEqual(inst.statusHistory[1].period.start.as_json(), "2017-02-01T07:35:00+10:00") + self.assertEqual(inst.statusHistory[1].status, "triaged") + self.assertEqual(inst.statusHistory[2].period.end.date, FHIRDate("2017-02-01T12:15:00+10:00").date) + self.assertEqual(inst.statusHistory[2].period.end.as_json(), "2017-02-01T12:15:00+10:00") + self.assertEqual(inst.statusHistory[2].period.start.date, FHIRDate("2017-02-01T08:45:00+10:00").date) + self.assertEqual(inst.statusHistory[2].period.start.as_json(), "2017-02-01T08:45:00+10:00") + self.assertEqual(inst.statusHistory[2].status, "in-progress") + self.assertEqual(inst.statusHistory[3].period.end.date, FHIRDate("2017-02-01T12:45:00+10:00").date) + self.assertEqual(inst.statusHistory[3].period.end.as_json(), "2017-02-01T12:45:00+10:00") + self.assertEqual(inst.statusHistory[3].period.start.date, FHIRDate("2017-02-01T12:15:00+10:00").date) + self.assertEqual(inst.statusHistory[3].period.start.as_json(), "2017-02-01T12:15:00+10:00") + self.assertEqual(inst.statusHistory[3].status, "onleave") + self.assertEqual(inst.statusHistory[4].period.start.date, FHIRDate("2017-02-01T12:45:00+10:00").date) + self.assertEqual(inst.statusHistory[4].period.start.as_json(), "2017-02-01T12:45:00+10:00") + self.assertEqual(inst.statusHistory[4].status, "in-progress") + self.assertEqual(inst.text.div, "
Emergency visit that escalated into inpatient patient @example
") self.assertEqual(inst.text.status, "generated") def testEncounter10(self): - inst = self.instantiate_from("encounter-example.json") + inst = self.instantiate_from("encounter-example-f001-heart.json") self.assertIsNotNone(inst, "Must have instantiated a Encounter instance") self.implEncounter10(inst) @@ -422,11 +425,38 @@ def testEncounter10(self): self.implEncounter10(inst2) def implEncounter10(self, inst): - self.assertEqual(inst.class_fhir.code, "IMP") - self.assertEqual(inst.class_fhir.display, "inpatient encounter") - self.assertEqual(inst.class_fhir.system, "http://hl7.org/fhir/v3/ActCode") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.status, "in-progress") - self.assertEqual(inst.text.div, "
Encounter with patient @example
") + self.assertEqual(inst.class_fhir.code, "AMB") + self.assertEqual(inst.class_fhir.display, "ambulatory") + self.assertEqual(inst.class_fhir.system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.hospitalization.admitSource.coding[0].code, "305956004") + self.assertEqual(inst.hospitalization.admitSource.coding[0].display, "Referral by physician") + self.assertEqual(inst.hospitalization.admitSource.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].code, "306689006") + self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].display, "Discharge to home") + self.assertEqual(inst.hospitalization.dischargeDisposition.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.hospitalization.preAdmissionIdentifier.system, "http://www.amc.nl/zorgportal/identifiers/pre-admissions") + self.assertEqual(inst.hospitalization.preAdmissionIdentifier.use, "official") + self.assertEqual(inst.hospitalization.preAdmissionIdentifier.value, "93042") + self.assertEqual(inst.id, "f001") + self.assertEqual(inst.identifier[0].system, "http://www.amc.nl/zorgportal/identifiers/visits") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "v1451") + self.assertEqual(inst.length.code, "min") + self.assertEqual(inst.length.system, "http://unitsofmeasure.org") + self.assertEqual(inst.length.unit, "min") + self.assertEqual(inst.length.value, 140) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority.coding[0].code, "310361003") + self.assertEqual(inst.priority.coding[0].display, "Non-urgent cardiological admission") + self.assertEqual(inst.priority.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reasonCode[0].coding[0].code, "34068001") + self.assertEqual(inst.reasonCode[0].coding[0].display, "Heart valve replacement") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "finished") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "270427003") + self.assertEqual(inst.type[0].coding[0].display, "Patient-initiated encounter") + self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") diff --git a/fhirclient/models/endpoint.py b/fhirclient/models/endpoint.py index 1a1104892..1dcffb47d 100644 --- a/fhirclient/models/endpoint.py +++ b/fhirclient/models/endpoint.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Endpoint) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Endpoint) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -47,9 +47,9 @@ def __init__(self, jsondict=None, strict=True): List of `Identifier` items (represented as `dict` in JSON). """ self.managingOrganization = None - """ Organization that manages this endpoint (may not be the + """ Organization that manages this endpoint (might not be the organization that exposes the endpoint). - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.name = None """ A name that this endpoint can be identified by. diff --git a/fhirclient/models/endpoint_tests.py b/fhirclient/models/endpoint_tests.py index 6f1a16c36..73ab722e8 100644 --- a/fhirclient/models/endpoint_tests.py +++ b/fhirclient/models/endpoint_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -34,15 +34,18 @@ def testEndpoint1(self): def implEndpoint1(self, inst): self.assertEqual(inst.address, "https://pacs.hospital.org/IHEInvokeImageDisplay") self.assertEqual(inst.connectionType.code, "ihe-iid") - self.assertEqual(inst.connectionType.system, "http://hl7.org/fhir/endpoint-connection-type") + self.assertEqual(inst.connectionType.system, "http://terminology.hl7.org/CodeSystem/endpoint-connection-type") self.assertEqual(inst.id, "example-iid") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "PACS Hospital Invoke Image Display endpoint") self.assertEqual(inst.payloadType[0].text, "DICOM IID") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testEndpoint2(self): - inst = self.instantiate_from("endpoint-example-wadors.json") + inst = self.instantiate_from("endpoint-example-direct.json") self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") self.implEndpoint2(inst) @@ -52,30 +55,56 @@ def testEndpoint2(self): self.implEndpoint2(inst2) def implEndpoint2(self, inst): + self.assertEqual(inst.address, "mailto:MARTIN.SMIETANKA@directnppes.com") + self.assertEqual(inst.connectionType.code, "direct-project") + self.assertEqual(inst.id, "direct-endpoint") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "MARTIN SMIETANKA") + self.assertEqual(inst.payloadType[0].coding[0].code, "urn:hl7-org:sdwg:ccda-structuredBody:1.1") + self.assertEqual(inst.payloadType[0].coding[0].system, "urn:oid:1.3.6.1.4.1.19376.1.2.3") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testEndpoint3(self): + inst = self.instantiate_from("endpoint-example-wadors.json") + self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") + self.implEndpoint3(inst) + + js = inst.as_json() + self.assertEqual("Endpoint", js["resourceType"]) + inst2 = endpoint.Endpoint(js) + self.implEndpoint3(inst2) + + def implEndpoint3(self, inst): self.assertEqual(inst.address, "https://pacs.hospital.org/wado-rs") self.assertEqual(inst.connectionType.code, "dicom-wado-rs") - self.assertEqual(inst.connectionType.system, "http://hl7.org/fhir/endpoint-connection-type") + self.assertEqual(inst.connectionType.system, "http://terminology.hl7.org/CodeSystem/endpoint-connection-type") self.assertEqual(inst.id, "example-wadors") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "PACS Hospital DICOM WADO-RS endpoint") self.assertEqual(inst.payloadMimeType[0], "application/dicom") self.assertEqual(inst.payloadType[0].text, "DICOM WADO-RS") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") - def testEndpoint3(self): + def testEndpoint4(self): inst = self.instantiate_from("endpoint-example.json") self.assertIsNotNone(inst, "Must have instantiated a Endpoint instance") - self.implEndpoint3(inst) + self.implEndpoint4(inst) js = inst.as_json() self.assertEqual("Endpoint", js["resourceType"]) inst2 = endpoint.Endpoint(js) - self.implEndpoint3(inst2) + self.implEndpoint4(inst2) - def implEndpoint3(self, inst): + def implEndpoint4(self, inst): self.assertEqual(inst.address, "http://fhir3.healthintersections.com.au/open/CarePlan") self.assertEqual(inst.connectionType.code, "hl7-fhir-rest") - self.assertEqual(inst.connectionType.system, "http://hl7.org/fhir/endpoint-connection-type") + self.assertEqual(inst.connectionType.system, "http://terminology.hl7.org/CodeSystem/endpoint-connection-type") self.assertEqual(inst.contact[0].system, "email") self.assertEqual(inst.contact[0].use, "work") self.assertEqual(inst.contact[0].value, "endpointmanager@example.org") @@ -83,6 +112,9 @@ def implEndpoint3(self, inst): self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http://example.org/enpoint-identifier") self.assertEqual(inst.identifier[0].value, "epcp12") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "Health Intersections CarePlan Hub") self.assertEqual(inst.payloadMimeType[0], "application/fhir+xml") self.assertEqual(inst.payloadType[0].coding[0].code, "CarePlan") diff --git a/fhirclient/models/enrollmentrequest.py b/fhirclient/models/enrollmentrequest.py index 44d8de1a6..1eab212c0 100644 --- a/fhirclient/models/enrollmentrequest.py +++ b/fhirclient/models/enrollmentrequest.py @@ -1,14 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class EnrollmentRequest(domainresource.DomainResource): - """ Enrollment request. + """ Enroll in coverage. This resource provides the insurance enrollment details to the insurer regarding a specified coverage. @@ -24,9 +24,13 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.candidate = None + """ The subject to be enrolled. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.coverage = None """ Insurance information. - Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.created = None """ Creation date. @@ -38,37 +42,28 @@ def __init__(self, jsondict=None, strict=True): self.insurer = None """ Target. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.organization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.provider = None """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | cancelled | draft | entered-in-error. Type `str`. """ - self.subject = None - """ The subject of the Products and Services. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ - super(EnrollmentRequest, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(EnrollmentRequest, self).elementProperties() js.extend([ + ("candidate", "candidate", fhirreference.FHIRReference, False, None, False), ("coverage", "coverage", fhirreference.FHIRReference, False, None, False), ("created", "created", fhirdate.FHIRDate, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), ("provider", "provider", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, False), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), ]) return js diff --git a/fhirclient/models/enrollmentrequest_tests.py b/fhirclient/models/enrollmentrequest_tests.py index 5eb0eff7f..431e53564 100644 --- a/fhirclient/models/enrollmentrequest_tests.py +++ b/fhirclient/models/enrollmentrequest_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,6 +37,9 @@ def implEnrollmentRequest1(self, inst): self.assertEqual(inst.id, "22345") self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/enrollmentrequest") self.assertEqual(inst.identifier[0].value, "EN22345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
A human-readable rendering of the EnrollmentRequest.
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/enrollmentresponse.py b/fhirclient/models/enrollmentresponse.py index 62df1ef09..eb380c52d 100644 --- a/fhirclient/models/enrollmentresponse.py +++ b/fhirclient/models/enrollmentresponse.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,7 +11,7 @@ class EnrollmentResponse(domainresource.DomainResource): """ EnrollmentResponse resource. This resource provides enrollment and plan details from the processing of - an Enrollment resource. + an EnrollmentRequest resource. """ resource_type = "EnrollmentResponse" @@ -38,23 +38,19 @@ def __init__(self, jsondict=None, strict=True): self.organization = None """ Insurer. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.outcome = None - """ complete | error | partial. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ queued | complete | error | partial. + Type `str`. """ self.request = None """ Claim reference. - Type `FHIRReference` referencing `EnrollmentRequest` (represented as `dict` in JSON). """ - - self.requestOrganization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.requestProvider = None """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | cancelled | draft | entered-in-error. @@ -69,9 +65,8 @@ def elementProperties(self): ("disposition", "disposition", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), + ("outcome", "outcome", str, False, None, False), ("request", "request", fhirreference.FHIRReference, False, None, False), - ("requestOrganization", "requestOrganization", fhirreference.FHIRReference, False, None, False), ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, False), ]) @@ -79,10 +74,6 @@ def elementProperties(self): import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/enrollmentresponse_tests.py b/fhirclient/models/enrollmentresponse_tests.py index c51a02687..6e721e841 100644 --- a/fhirclient/models/enrollmentresponse_tests.py +++ b/fhirclient/models/enrollmentresponse_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -38,8 +38,10 @@ def implEnrollmentResponse1(self, inst): self.assertEqual(inst.id, "ER2500") self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/enrollmentresponse") self.assertEqual(inst.identifier[0].value, "781234") - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
A human-readable rendering of the EnrollmentResponse
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/episodeofcare.py b/fhirclient/models/episodeofcare.py index 84b454244..b0d1ee2ec 100644 --- a/fhirclient/models/episodeofcare.py +++ b/fhirclient/models/episodeofcare.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -31,11 +31,11 @@ def __init__(self, jsondict=None, strict=True): self.account = None """ The set of accounts that may be used for billing for this EpisodeOfCare. - List of `FHIRReference` items referencing `Account` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.careManager = None - """ Care manager/care co-ordinator for the patient. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + """ Care manager/care coordinator for the patient. + Type `FHIRReference` (represented as `dict` in JSON). """ self.diagnosis = None """ The list of diagnosis relevant to this episode of care. @@ -47,11 +47,11 @@ def __init__(self, jsondict=None, strict=True): self.managingOrganization = None """ Organization that assumes care. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.patient = None """ The patient who is the focus of this episode of care. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Interval during responsibility is assumed. @@ -59,7 +59,7 @@ def __init__(self, jsondict=None, strict=True): self.referralRequest = None """ Originating Referral Request(s). - List of `FHIRReference` items referencing `ReferralRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ planned | waitlist | active | onhold | finished | cancelled | @@ -73,7 +73,7 @@ def __init__(self, jsondict=None, strict=True): self.team = None """ Other practitioners facilitating this episode of care. - List of `FHIRReference` items referencing `CareTeam` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.type = None """ Type/class - e.g. specialist referral, disease management. @@ -118,7 +118,7 @@ def __init__(self, jsondict=None, strict=True): self.condition = None """ Conditions/problems/diagnoses this episode of care is for. - Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.rank = None """ Ranking of the diagnosis (for each role type). diff --git a/fhirclient/models/episodeofcare_tests.py b/fhirclient/models/episodeofcare_tests.py index fbe520ad6..1781fcff3 100644 --- a/fhirclient/models/episodeofcare_tests.py +++ b/fhirclient/models/episodeofcare_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -35,10 +35,13 @@ def implEpisodeOfCare1(self, inst): self.assertEqual(inst.diagnosis[0].rank, 1) self.assertEqual(inst.diagnosis[0].role.coding[0].code, "CC") self.assertEqual(inst.diagnosis[0].role.coding[0].display, "Chief complaint") - self.assertEqual(inst.diagnosis[0].role.coding[0].system, "http://hl7.org/fhir/diagnosis-role") + self.assertEqual(inst.diagnosis[0].role.coding[0].system, "http://terminology.hl7.org/CodeSystem/diagnosis-role") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http://example.org/sampleepisodeofcare-identifier") self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.start.date, FHIRDate("2014-09-01").date) self.assertEqual(inst.period.start.as_json(), "2014-09-01") self.assertEqual(inst.status, "active") @@ -63,5 +66,5 @@ def implEpisodeOfCare1(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type[0].coding[0].code, "hacc") self.assertEqual(inst.type[0].coding[0].display, "Home and Community Care") - self.assertEqual(inst.type[0].coding[0].system, "http://hl7.org/fhir/episodeofcare-type") + self.assertEqual(inst.type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/episodeofcare-type") diff --git a/fhirclient/models/servicedefinition.py b/fhirclient/models/eventdefinition.py similarity index 62% rename from fhirclient/models/servicedefinition.py rename to fhirclient/models/eventdefinition.py index d20107c91..f3a18a3e3 100644 --- a/fhirclient/models/servicedefinition.py +++ b/fhirclient/models/eventdefinition.py @@ -1,21 +1,20 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ServiceDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EventDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource -class ServiceDefinition(domainresource.DomainResource): - """ A description of decision support service functionality. +class EventDefinition(domainresource.DomainResource): + """ A description of when an event can occur. - The ServiceDefinition describes a unit of decision support functionality - that is made available as a service, such as immunization modules or drug- - drug interaction checking. + The EventDefinition resource provides a reusable description of when a + particular event can occur. """ - resource_type = "ServiceDefinition" + resource_type = "EventDefinition" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -26,131 +25,152 @@ def __init__(self, jsondict=None, strict=True): """ self.approvalDate = None - """ When the service definition was approved by publisher. + """ When the event definition was approved by publisher. Type `FHIRDate` (represented as `str` in JSON). """ + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.contact = None """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ - self.contributor = None - """ A content contributor. - List of `Contributor` items (represented as `dict` in JSON). """ - self.copyright = None """ Use and/or publishing restrictions. Type `str`. """ - self.dataRequirement = None - """ What data is used by the module. - List of `DataRequirement` items (represented as `dict` in JSON). """ - self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None - """ Natural language description of the service definition. + """ Natural language description of the event definition. Type `str`. """ + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.effectivePeriod = None - """ When the service definition is expected to be used. + """ When the event definition is expected to be used. Type `Period` (represented as `dict` in JSON). """ + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.experimental = None """ For testing purposes, not real usage. Type `bool`. """ self.identifier = None - """ Additional identifier for the service definition. + """ Additional identifier for the event definition. List of `Identifier` items (represented as `dict` in JSON). """ self.jurisdiction = None - """ Intended jurisdiction for service definition (if applicable). + """ Intended jurisdiction for event definition (if applicable). List of `CodeableConcept` items (represented as `dict` in JSON). """ self.lastReviewDate = None - """ When the service definition was last reviewed. + """ When the event definition was last reviewed. Type `FHIRDate` (represented as `str` in JSON). """ self.name = None - """ Name for this service definition (computer friendly). + """ Name for this event definition (computer friendly). Type `str`. """ - self.operationDefinition = None - """ Operation to invoke. - Type `FHIRReference` referencing `OperationDefinition` (represented as `dict` in JSON). """ - self.publisher = None """ Name of the publisher (organization or individual). Type `str`. """ self.purpose = None - """ Why this service definition is defined. + """ Why this event definition is defined. Type `str`. """ self.relatedArtifact = None - """ Additional documentation, citations, etc. + """ Additional documentation, citations, etc.. List of `RelatedArtifact` items (represented as `dict` in JSON). """ + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.status = None """ draft | active | retired | unknown. Type `str`. """ + self.subjectCodeableConcept = None + """ Type of individual the event definition is focused on. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ Type of individual the event definition is focused on. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate title of the event definition. + Type `str`. """ + self.title = None - """ Name for this service definition (human friendly). + """ Name for this event definition (human friendly). Type `str`. """ self.topic = None - """ E.g. Education, Treatment, Assessment, etc. + """ E.g. Education, Treatment, Assessment, etc.. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.trigger = None - """ "when" the module should be invoked. + """ "when" the event occurs (multiple = 'or'). List of `TriggerDefinition` items (represented as `dict` in JSON). """ self.url = None - """ Logical URI to reference this service definition (globally unique). + """ Canonical identifier for this event definition, represented as a + URI (globally unique). Type `str`. """ self.usage = None - """ Describes the clinical usage of the module. + """ Describes the clinical usage of the event definition. Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None - """ Business version of the service definition. + """ Business version of the event definition. Type `str`. """ - super(ServiceDefinition, self).__init__(jsondict=jsondict, strict=strict) + super(EventDefinition, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ServiceDefinition, self).elementProperties() + js = super(EventDefinition, self).elementProperties() js.extend([ ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("contributor", "contributor", contributor.Contributor, True, None, False), ("copyright", "copyright", str, False, None, False), - ("dataRequirement", "dataRequirement", datarequirement.DataRequirement, True, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), ("experimental", "experimental", bool, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), ("name", "name", str, False, None, False), - ("operationDefinition", "operationDefinition", fhirreference.FHIRReference, False, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), ("status", "status", str, False, None, True), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), + ("subtitle", "subtitle", str, False, None, False), ("title", "title", str, False, None, False), ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), - ("trigger", "trigger", triggerdefinition.TriggerDefinition, True, None, False), + ("trigger", "trigger", triggerdefinition.TriggerDefinition, True, None, True), ("url", "url", str, False, None, False), ("usage", "usage", str, False, None, False), ("useContext", "useContext", usagecontext.UsageContext, True, None, False), @@ -168,14 +188,6 @@ def elementProperties(self): from . import contactdetail except ImportError: contactdetail = sys.modules[__package__ + '.contactdetail'] -try: - from . import contributor -except ImportError: - contributor = sys.modules[__package__ + '.contributor'] -try: - from . import datarequirement -except ImportError: - datarequirement = sys.modules[__package__ + '.datarequirement'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/eventdefinition_tests.py b/fhirclient/models/eventdefinition_tests.py new file mode 100644 index 000000000..903d444ae --- /dev/null +++ b/fhirclient/models/eventdefinition_tests.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import eventdefinition +from .fhirdate import FHIRDate + + +class EventDefinitionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("EventDefinition", js["resourceType"]) + return eventdefinition.EventDefinition(js) + + def testEventDefinition1(self): + inst = self.instantiate_from("eventdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EventDefinition instance") + self.implEventDefinition1(inst) + + js = inst.as_json() + self.assertEqual("EventDefinition", js["resourceType"]) + inst2 = eventdefinition.EventDefinition(js) + self.implEventDefinition1(inst2) + + def implEventDefinition1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.purpose, "Monitor all admissions to Emergency") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.trigger[0].condition.description, "Encounter Location = emergency (active/completed encounters, current or previous)") + self.assertEqual(inst.trigger[0].condition.expression, "(this | %previous).location.where(location = 'Location/emergency' and status in {'active', 'completed'}).exists()") + self.assertEqual(inst.trigger[0].condition.language, "text/fhirpath") + self.assertEqual(inst.trigger[0].data[0].type, "Encounter") + self.assertEqual(inst.trigger[0].name, "monitor-emergency-admissions") + self.assertEqual(inst.trigger[0].type, "named-event") + diff --git a/fhirclient/models/evidence.py b/fhirclient/models/evidence.py new file mode 100644 index 000000000..d2b6ba5ee --- /dev/null +++ b/fhirclient/models/evidence.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Evidence) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class Evidence(domainresource.DomainResource): + """ A research context or question. + + The Evidence resource describes the conditional state (population and any + exposures being compared within the population) and outcome (if specified) + that the knowledge (evidence, assertion, recommendation) is about. + """ + + resource_type = "Evidence" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.approvalDate = None + """ When the evidence was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the evidence. + Type `str`. """ + + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.effectivePeriod = None + """ When the evidence is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.exposureBackground = None + """ What population?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.exposureVariant = None + """ What exposure?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the evidence. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for evidence (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the evidence was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this evidence (computer friendly). + Type `str`. """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcome = None + """ What outcome?. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc.. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.shortTitle = None + """ Title for use in informal contexts. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.subtitle = None + """ Subordinate title of the Evidence. + Type `str`. """ + + self.title = None + """ Name for this evidence (human friendly). + Type `str`. """ + + self.topic = None + """ The category of the Evidence, such as Education, Treatment, + Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this evidence, represented as a URI + (globally unique). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the evidence. + Type `str`. """ + + super(Evidence, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Evidence, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), + ("exposureBackground", "exposureBackground", fhirreference.FHIRReference, False, None, True), + ("exposureVariant", "exposureVariant", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("outcome", "outcome", fhirreference.FHIRReference, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), + ("shortTitle", "shortTitle", str, False, None, False), + ("status", "status", str, False, None, True), + ("subtitle", "subtitle", str, False, None, False), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("url", "url", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/evidence_tests.py b/fhirclient/models/evidence_tests.py new file mode 100644 index 000000000..e61c309ae --- /dev/null +++ b/fhirclient/models/evidence_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import evidence +from .fhirdate import FHIRDate + + +class EvidenceTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("Evidence", js["resourceType"]) + return evidence.Evidence(js) + + def testEvidence1(self): + inst = self.instantiate_from("evidence-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Evidence instance") + self.implEvidence1(inst) + + js = inst.as_json() + self.assertEqual("Evidence", js["resourceType"]) + inst2 = evidence.Evidence(js) + self.implEvidence1(inst2) + + def implEvidence1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/evidencevariable.py b/fhirclient/models/evidencevariable.py new file mode 100644 index 000000000..e0ef1fb60 --- /dev/null +++ b/fhirclient/models/evidencevariable.py @@ -0,0 +1,333 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/EvidenceVariable) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class EvidenceVariable(domainresource.DomainResource): + """ A population, intervention, or exposure definition. + + The EvidenceVariable resource describes a "PICO" element that knowledge + (evidence, assertion, recommendation) is about. + """ + + resource_type = "EvidenceVariable" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.approvalDate = None + """ When the evidence variable was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.characteristic = None + """ What defines the members of the evidence element. + List of `EvidenceVariableCharacteristic` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the evidence variable. + Type `str`. """ + + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.effectivePeriod = None + """ When the evidence variable is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the evidence variable. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for evidence variable (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the evidence variable was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this evidence variable (computer friendly). + Type `str`. """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc.. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.shortTitle = None + """ Title for use in informal contexts. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.subtitle = None + """ Subordinate title of the EvidenceVariable. + Type `str`. """ + + self.title = None + """ Name for this evidence variable (human friendly). + Type `str`. """ + + self.topic = None + """ The category of the EvidenceVariable, such as Education, Treatment, + Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ dichotomous | continuous | descriptive. + Type `str`. """ + + self.url = None + """ Canonical identifier for this evidence variable, represented as a + URI (globally unique). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the evidence variable. + Type `str`. """ + + super(EvidenceVariable, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EvidenceVariable, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), + ("characteristic", "characteristic", EvidenceVariableCharacteristic, True, None, True), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), + ("shortTitle", "shortTitle", str, False, None, False), + ("status", "status", str, False, None, True), + ("subtitle", "subtitle", str, False, None, False), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", str, False, None, False), + ("url", "url", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class EvidenceVariableCharacteristic(backboneelement.BackboneElement): + """ What defines the members of the evidence element. + + A characteristic that defines the members of the evidence element. Multiple + characteristics are applied with "and" semantics. + """ + + resource_type = "EvidenceVariableCharacteristic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.definitionCanonical = None + """ What code or expression defines members?. + Type `str`. """ + + self.definitionCodeableConcept = None + """ What code or expression defines members?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.definitionDataRequirement = None + """ What code or expression defines members?. + Type `DataRequirement` (represented as `dict` in JSON). """ + + self.definitionExpression = None + """ What code or expression defines members?. + Type `Expression` (represented as `dict` in JSON). """ + + self.definitionReference = None + """ What code or expression defines members?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.definitionTriggerDefinition = None + """ What code or expression defines members?. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + + self.description = None + """ Natural language description of the characteristic. + Type `str`. """ + + self.exclude = None + """ Whether the characteristic includes or excludes members. + Type `bool`. """ + + self.groupMeasure = None + """ mean | median | mean-of-mean | mean-of-median | median-of-mean | + median-of-median. + Type `str`. """ + + self.participantEffectiveDateTime = None + """ What time period do participants cover. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.participantEffectiveDuration = None + """ What time period do participants cover. + Type `Duration` (represented as `dict` in JSON). """ + + self.participantEffectivePeriod = None + """ What time period do participants cover. + Type `Period` (represented as `dict` in JSON). """ + + self.participantEffectiveTiming = None + """ What time period do participants cover. + Type `Timing` (represented as `dict` in JSON). """ + + self.timeFromStart = None + """ Observation time from study start. + Type `Duration` (represented as `dict` in JSON). """ + + self.usageContext = None + """ What code/value pairs define members?. + List of `UsageContext` items (represented as `dict` in JSON). """ + + super(EvidenceVariableCharacteristic, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(EvidenceVariableCharacteristic, self).elementProperties() + js.extend([ + ("definitionCanonical", "definitionCanonical", str, False, "definition", True), + ("definitionCodeableConcept", "definitionCodeableConcept", codeableconcept.CodeableConcept, False, "definition", True), + ("definitionDataRequirement", "definitionDataRequirement", datarequirement.DataRequirement, False, "definition", True), + ("definitionExpression", "definitionExpression", expression.Expression, False, "definition", True), + ("definitionReference", "definitionReference", fhirreference.FHIRReference, False, "definition", True), + ("definitionTriggerDefinition", "definitionTriggerDefinition", triggerdefinition.TriggerDefinition, False, "definition", True), + ("description", "description", str, False, None, False), + ("exclude", "exclude", bool, False, None, False), + ("groupMeasure", "groupMeasure", str, False, None, False), + ("participantEffectiveDateTime", "participantEffectiveDateTime", fhirdate.FHIRDate, False, "participantEffective", False), + ("participantEffectiveDuration", "participantEffectiveDuration", duration.Duration, False, "participantEffective", False), + ("participantEffectivePeriod", "participantEffectivePeriod", period.Period, False, "participantEffective", False), + ("participantEffectiveTiming", "participantEffectiveTiming", timing.Timing, False, "participantEffective", False), + ("timeFromStart", "timeFromStart", duration.Duration, False, None, False), + ("usageContext", "usageContext", usagecontext.UsageContext, True, None, False), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] +try: + from . import triggerdefinition +except ImportError: + triggerdefinition = sys.modules[__package__ + '.triggerdefinition'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/evidencevariable_tests.py b/fhirclient/models/evidencevariable_tests.py new file mode 100644 index 000000000..1f0d8069b --- /dev/null +++ b/fhirclient/models/evidencevariable_tests.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import evidencevariable +from .fhirdate import FHIRDate + + +class EvidenceVariableTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("EvidenceVariable", js["resourceType"]) + return evidencevariable.EvidenceVariable(js) + + def testEvidenceVariable1(self): + inst = self.instantiate_from("evidencevariable-example.json") + self.assertIsNotNone(inst, "Must have instantiated a EvidenceVariable instance") + self.implEvidenceVariable1(inst) + + js = inst.as_json() + self.assertEqual("EvidenceVariable", js["resourceType"]) + inst2 = evidencevariable.EvidenceVariable(js) + self.implEvidenceVariable1(inst2) + + def implEvidenceVariable1(self, inst): + self.assertEqual(inst.characteristic[0].definitionCodeableConcept.text, "Diabetic patients over 65") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/examplescenario.py b/fhirclient/models/examplescenario.py new file mode 100644 index 000000000..dcc85f74a --- /dev/null +++ b/fhirclient/models/examplescenario.py @@ -0,0 +1,511 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ExampleScenario) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class ExampleScenario(domainresource.DomainResource): + """ Example of workflow instance. + """ + + resource_type = "ExampleScenario" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actor = None + """ Actor participating in the resource. + List of `ExampleScenarioActor` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.identifier = None + """ Additional identifier for the example scenario. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.instance = None + """ Each resource and each version that is present in the workflow. + List of `ExampleScenarioInstance` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for example scenario (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ Name for this example scenario (computer friendly). + Type `str`. """ + + self.process = None + """ Each major process - a group of operations. + List of `ExampleScenarioProcess` items (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ The purpose of the example, e.g. to illustrate a scenario. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.url = None + """ Canonical identifier for this example scenario, represented as a + URI (globally unique). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the example scenario. + Type `str`. """ + + self.workflow = None + """ Another nested workflow. + List of `str` items. """ + + super(ExampleScenario, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenario, self).elementProperties() + js.extend([ + ("actor", "actor", ExampleScenarioActor, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instance", "instance", ExampleScenarioInstance, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, False), + ("process", "process", ExampleScenarioProcess, True, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("status", "status", str, False, None, True), + ("url", "url", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ("workflow", "workflow", str, True, None, False), + ]) + return js + + +from . import backboneelement + +class ExampleScenarioActor(backboneelement.BackboneElement): + """ Actor participating in the resource. + """ + + resource_type = "ExampleScenarioActor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actorId = None + """ ID or acronym of the actor. + Type `str`. """ + + self.description = None + """ The description of the actor. + Type `str`. """ + + self.name = None + """ The name of the actor as shown in the page. + Type `str`. """ + + self.type = None + """ person | entity. + Type `str`. """ + + super(ExampleScenarioActor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioActor, self).elementProperties() + js.extend([ + ("actorId", "actorId", str, False, None, True), + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class ExampleScenarioInstance(backboneelement.BackboneElement): + """ Each resource and each version that is present in the workflow. + """ + + resource_type = "ExampleScenarioInstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.containedInstance = None + """ Resources contained in the instance. + List of `ExampleScenarioInstanceContainedInstance` items (represented as `dict` in JSON). """ + + self.description = None + """ Human-friendly description of the resource instance. + Type `str`. """ + + self.name = None + """ A short name for the resource instance. + Type `str`. """ + + self.resourceId = None + """ The id of the resource for referencing. + Type `str`. """ + + self.resourceType = None + """ The type of the resource. + Type `str`. """ + + self.version = None + """ A specific version of the resource. + List of `ExampleScenarioInstanceVersion` items (represented as `dict` in JSON). """ + + super(ExampleScenarioInstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioInstance, self).elementProperties() + js.extend([ + ("containedInstance", "containedInstance", ExampleScenarioInstanceContainedInstance, True, None, False), + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, False), + ("resourceId", "resourceId", str, False, None, True), + ("resourceType", "resourceType", str, False, None, True), + ("version", "version", ExampleScenarioInstanceVersion, True, None, False), + ]) + return js + + +class ExampleScenarioInstanceContainedInstance(backboneelement.BackboneElement): + """ Resources contained in the instance. + + Resources contained in the instance (e.g. the observations contained in a + bundle). + """ + + resource_type = "ExampleScenarioInstanceContainedInstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.resourceId = None + """ Each resource contained in the instance. + Type `str`. """ + + self.versionId = None + """ A specific version of a resource contained in the instance. + Type `str`. """ + + super(ExampleScenarioInstanceContainedInstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioInstanceContainedInstance, self).elementProperties() + js.extend([ + ("resourceId", "resourceId", str, False, None, True), + ("versionId", "versionId", str, False, None, False), + ]) + return js + + +class ExampleScenarioInstanceVersion(backboneelement.BackboneElement): + """ A specific version of the resource. + """ + + resource_type = "ExampleScenarioInstanceVersion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ The description of the resource version. + Type `str`. """ + + self.versionId = None + """ The identifier of a specific version of a resource. + Type `str`. """ + + super(ExampleScenarioInstanceVersion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioInstanceVersion, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("versionId", "versionId", str, False, None, True), + ]) + return js + + +class ExampleScenarioProcess(backboneelement.BackboneElement): + """ Each major process - a group of operations. + """ + + resource_type = "ExampleScenarioProcess" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ A longer description of the group of operations. + Type `str`. """ + + self.postConditions = None + """ Description of final status after the process ends. + Type `str`. """ + + self.preConditions = None + """ Description of initial status before the process starts. + Type `str`. """ + + self.step = None + """ Each step of the process. + List of `ExampleScenarioProcessStep` items (represented as `dict` in JSON). """ + + self.title = None + """ The diagram title of the group of operations. + Type `str`. """ + + super(ExampleScenarioProcess, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioProcess, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("postConditions", "postConditions", str, False, None, False), + ("preConditions", "preConditions", str, False, None, False), + ("step", "step", ExampleScenarioProcessStep, True, None, False), + ("title", "title", str, False, None, True), + ]) + return js + + +class ExampleScenarioProcessStep(backboneelement.BackboneElement): + """ Each step of the process. + """ + + resource_type = "ExampleScenarioProcessStep" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.alternative = None + """ Alternate non-typical step action. + List of `ExampleScenarioProcessStepAlternative` items (represented as `dict` in JSON). """ + + self.operation = None + """ Each interaction or action. + Type `ExampleScenarioProcessStepOperation` (represented as `dict` in JSON). """ + + self.pause = None + """ If there is a pause in the flow. + Type `bool`. """ + + self.process = None + """ Nested process. + List of `ExampleScenarioProcess` items (represented as `dict` in JSON). """ + + super(ExampleScenarioProcessStep, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioProcessStep, self).elementProperties() + js.extend([ + ("alternative", "alternative", ExampleScenarioProcessStepAlternative, True, None, False), + ("operation", "operation", ExampleScenarioProcessStepOperation, False, None, False), + ("pause", "pause", bool, False, None, False), + ("process", "process", ExampleScenarioProcess, True, None, False), + ]) + return js + + +class ExampleScenarioProcessStepAlternative(backboneelement.BackboneElement): + """ Alternate non-typical step action. + + Indicates an alternative step that can be taken instead of the operations + on the base step in exceptional/atypical circumstances. + """ + + resource_type = "ExampleScenarioProcessStepAlternative" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ A human-readable description of each option. + Type `str`. """ + + self.step = None + """ What happens in each alternative option. + List of `ExampleScenarioProcessStep` items (represented as `dict` in JSON). """ + + self.title = None + """ Label for alternative. + Type `str`. """ + + super(ExampleScenarioProcessStepAlternative, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioProcessStepAlternative, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("step", "step", ExampleScenarioProcessStep, True, None, False), + ("title", "title", str, False, None, True), + ]) + return js + + +class ExampleScenarioProcessStepOperation(backboneelement.BackboneElement): + """ Each interaction or action. + """ + + resource_type = "ExampleScenarioProcessStepOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ A comment to be inserted in the diagram. + Type `str`. """ + + self.initiator = None + """ Who starts the transaction. + Type `str`. """ + + self.initiatorActive = None + """ Whether the initiator is deactivated right after the transaction. + Type `bool`. """ + + self.name = None + """ The human-friendly name of the interaction. + Type `str`. """ + + self.number = None + """ The sequential number of the interaction. + Type `str`. """ + + self.receiver = None + """ Who receives the transaction. + Type `str`. """ + + self.receiverActive = None + """ Whether the receiver is deactivated right after the transaction. + Type `bool`. """ + + self.request = None + """ Each resource instance used by the initiator. + Type `ExampleScenarioInstanceContainedInstance` (represented as `dict` in JSON). """ + + self.response = None + """ Each resource instance used by the responder. + Type `ExampleScenarioInstanceContainedInstance` (represented as `dict` in JSON). """ + + self.type = None + """ The type of operation - CRUD. + Type `str`. """ + + super(ExampleScenarioProcessStepOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExampleScenarioProcessStepOperation, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("initiator", "initiator", str, False, None, False), + ("initiatorActive", "initiatorActive", bool, False, None, False), + ("name", "name", str, False, None, False), + ("number", "number", str, False, None, True), + ("receiver", "receiver", str, False, None, False), + ("receiverActive", "receiverActive", bool, False, None, False), + ("request", "request", ExampleScenarioInstanceContainedInstance, False, None, False), + ("response", "response", ExampleScenarioInstanceContainedInstance, False, None, False), + ("type", "type", str, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/examplescenario_tests.py b/fhirclient/models/examplescenario_tests.py new file mode 100644 index 000000000..451a4cc24 --- /dev/null +++ b/fhirclient/models/examplescenario_tests.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import examplescenario +from .fhirdate import FHIRDate + + +class ExampleScenarioTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("ExampleScenario", js["resourceType"]) + return examplescenario.ExampleScenario(js) + + def testExampleScenario1(self): + inst = self.instantiate_from("examplescenario-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ExampleScenario instance") + self.implExampleScenario1(inst) + + js = inst.as_json() + self.assertEqual("ExampleScenario", js["resourceType"]) + inst2 = examplescenario.ExampleScenario(js) + self.implExampleScenario1(inst2) + + def implExampleScenario1(self, inst): + self.assertEqual(inst.actor[0].actorId, "Nurse") + self.assertEqual(inst.actor[0].description, "The Nurse") + self.assertEqual(inst.actor[0].name, "Nurse") + self.assertEqual(inst.actor[0].type, "person") + self.assertEqual(inst.actor[1].actorId, "MAP") + self.assertEqual(inst.actor[1].description, "The entity that receives the Administration Requests to show the nurse to perform them") + self.assertEqual(inst.actor[1].name, "Nurse's Tablet") + self.assertEqual(inst.actor[1].type, "entity") + self.assertEqual(inst.actor[2].actorId, "OP") + self.assertEqual(inst.actor[2].description, "The Medication Administration Order Placer") + self.assertEqual(inst.actor[2].name, "MAR / Scheduler") + self.assertEqual(inst.actor[2].type, "entity") + self.assertEqual(inst.actor[3].actorId, "MAC") + self.assertEqual(inst.actor[3].description, "The entity that receives the Medication Administration reports") + self.assertEqual(inst.actor[3].name, "MAR / EHR") + self.assertEqual(inst.actor[3].type, "entity") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.instance[0].description, "The initial prescription which describes \"medication X, 3 times per day\" - the exact scheduling is not in the initial prescription (it is left for the care teams to decide on the schedule).") + self.assertEqual(inst.instance[0].name, "Initial Prescription") + self.assertEqual(inst.instance[0].resourceId, "iherx001") + self.assertEqual(inst.instance[1].description, "The administration request for day 1, morning") + self.assertEqual(inst.instance[1].name, "Request for day 1, morning") + self.assertEqual(inst.instance[1].resourceId, "iherx001.001") + self.assertEqual(inst.instance[2].description, "The administration request for day 1, lunch") + self.assertEqual(inst.instance[2].name, "Request for day 1, lunch") + self.assertEqual(inst.instance[2].resourceId, "iherx001.002") + self.assertEqual(inst.instance[3].description, "The administration request for day 1, evening") + self.assertEqual(inst.instance[3].name, "Request for day 1, evening") + self.assertEqual(inst.instance[3].resourceId, "iherx001.003") + self.assertEqual(inst.instance[4].description, "The administration request for day 2, morning") + self.assertEqual(inst.instance[4].name, "Request for day 2, morning") + self.assertEqual(inst.instance[4].resourceId, "iherx001.004") + self.assertEqual(inst.instance[5].description, "The administration request for day 2, lunch") + self.assertEqual(inst.instance[5].name, "Request for day 2, lunch") + self.assertEqual(inst.instance[5].resourceId, "iherx001.005") + self.assertEqual(inst.instance[6].description, "The administration request for day 2, evening") + self.assertEqual(inst.instance[6].name, "Request for day 2, evening") + self.assertEqual(inst.instance[6].resourceId, "iherx001.006") + self.assertEqual(inst.instance[7].description, "Administration report for day 1, morning: Taken") + self.assertEqual(inst.instance[7].name, "Morning meds - taken") + self.assertEqual(inst.instance[7].resourceId, "iheadm001a") + self.assertEqual(inst.instance[8].description, "Administration report for day 1, morning: NOT Taken") + self.assertEqual(inst.instance[8].name, "Morning meds - not taken") + self.assertEqual(inst.instance[8].resourceId, "iheadm001b") + self.assertEqual(inst.instance[9].containedInstance[0].resourceId, "iherx001.001") + self.assertEqual(inst.instance[9].containedInstance[1].resourceId, "iherx001.002") + self.assertEqual(inst.instance[9].containedInstance[2].resourceId, "iherx001.003") + self.assertEqual(inst.instance[9].containedInstance[3].resourceId, "iherx001.004") + self.assertEqual(inst.instance[9].containedInstance[4].resourceId, "iherx001.005") + self.assertEqual(inst.instance[9].containedInstance[5].resourceId, "iherx001.006") + self.assertEqual(inst.instance[9].description, "All the medication Requests for Day 1") + self.assertEqual(inst.instance[9].name, "Bundle of Medication Requests") + self.assertEqual(inst.instance[9].resourceId, "iherx001bundle") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.process[0].postConditions, "Medication administration Reports are submitted, EHR is updated.") + self.assertEqual(inst.process[0].preConditions, "Medication administration requests are in the EHR / MAR, scheduled for each individual intake.") + self.assertEqual(inst.process[0].step[0].operation.initiator, "Nurse") + self.assertEqual(inst.process[0].step[0].operation.name, "1. Get today's schedule") + self.assertEqual(inst.process[0].step[0].operation.number, "1") + self.assertEqual(inst.process[0].step[0].operation.receiver, "MAP") + self.assertEqual(inst.process[0].step[1].process[0].description, "Query for medication administration orders,\\n- For today's shifts\\n- For today's patients") + self.assertEqual(inst.process[0].step[1].process[0].step[0].operation.initiator, "MAP") + self.assertEqual(inst.process[0].step[1].process[0].step[0].operation.name, "2.Query for medication administration orders,\\n- For today's shifts\\n- For today's patients") + self.assertEqual(inst.process[0].step[1].process[0].step[0].operation.number, "2") + self.assertEqual(inst.process[0].step[1].process[0].step[0].operation.receiver, "OP") + self.assertEqual(inst.process[0].step[1].process[0].step[0].operation.request.resourceId, "iherxqry") + self.assertEqual(inst.process[0].step[1].process[0].step[0].operation.response.resourceId, "iherx001bundle") + self.assertEqual(inst.process[0].step[1].process[0].title, "P1. Query Administration Requests") + self.assertTrue(inst.process[0].step[2].pause) + self.assertEqual(inst.process[0].step[3].operation.initiator, "MAP") + self.assertEqual(inst.process[0].step[3].operation.name, "Notify (alert)") + self.assertEqual(inst.process[0].step[3].operation.number, "4") + self.assertEqual(inst.process[0].step[3].operation.receiver, "Nurse") + self.assertEqual(inst.process[0].step[4].operation.initiator, "Nurse") + self.assertEqual(inst.process[0].step[4].operation.name, "Read orders") + self.assertEqual(inst.process[0].step[4].operation.number, "5") + self.assertEqual(inst.process[0].step[4].operation.receiver, "MAP") + self.assertTrue(inst.process[0].step[5].pause) + self.assertEqual(inst.process[0].step[6].operation.initiator, "Nurse") + self.assertEqual(inst.process[0].step[6].operation.name, "Ask if patient took meds") + self.assertEqual(inst.process[0].step[6].operation.number, "5") + self.assertEqual(inst.process[0].step[6].operation.receiver, "Nurse") + self.assertEqual(inst.process[0].step[7].alternative[0].description, "Invoke if patient took medications") + self.assertEqual(inst.process[0].step[7].alternative[0].step[0].process[0].step[0].operation.initiator, "Nurse") + self.assertTrue(inst.process[0].step[7].alternative[0].step[0].process[0].step[0].operation.initiatorActive) + self.assertEqual(inst.process[0].step[7].alternative[0].step[0].process[0].step[0].operation.name, "Register Meds taken") + self.assertEqual(inst.process[0].step[7].alternative[0].step[0].process[0].step[0].operation.number, "1a") + self.assertEqual(inst.process[0].step[7].alternative[0].step[0].process[0].step[0].operation.receiver, "MAP") + self.assertEqual(inst.process[0].step[7].alternative[0].step[0].process[0].title, "Register Meds taken") + self.assertEqual(inst.process[0].step[7].alternative[0].title, "Patient took drugs") + self.assertEqual(inst.process[0].step[7].alternative[1].description, "No, patient did not take drugs") + self.assertEqual(inst.process[0].step[7].alternative[1].step[0].process[0].step[0].operation.initiator, "Nurse") + self.assertTrue(inst.process[0].step[7].alternative[1].step[0].process[0].step[0].operation.initiatorActive) + self.assertEqual(inst.process[0].step[7].alternative[1].step[0].process[0].step[0].operation.name, "Register Meds NOT taken") + self.assertEqual(inst.process[0].step[7].alternative[1].step[0].process[0].step[0].operation.number, "1b") + self.assertEqual(inst.process[0].step[7].alternative[1].step[0].process[0].step[0].operation.receiver, "MAP") + self.assertEqual(inst.process[0].step[7].alternative[1].step[0].process[0].title, "Register Meds NOT taken") + self.assertEqual(inst.process[0].step[7].alternative[1].title, "No drugs") + self.assertEqual(inst.process[0].step[7].alternative[2].description, "Unknown whether patient took medications or not") + self.assertTrue(inst.process[0].step[7].alternative[2].step[0].pause) + self.assertEqual(inst.process[0].step[7].alternative[2].title, "Not clear") + self.assertTrue(inst.process[0].step[8].pause) + self.assertEqual(inst.process[0].step[9].operation.initiator, "Nurse") + self.assertEqual(inst.process[0].step[9].operation.name, "Administer drug") + self.assertEqual(inst.process[0].step[9].operation.number, "6") + self.assertEqual(inst.process[0].step[9].operation.receiver, "Nurse") + self.assertEqual(inst.process[0].title, "Mobile Medication Administration") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/expansionprofile.py b/fhirclient/models/expansionprofile.py deleted file mode 100644 index e09d75b0f..000000000 --- a/fhirclient/models/expansionprofile.py +++ /dev/null @@ -1,418 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ExpansionProfile) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class ExpansionProfile(domainresource.DomainResource): - """ Defines behaviour and contraints on the ValueSet Expansion operation. - - Resource to define constraints on the Expansion of a FHIR ValueSet. - """ - - resource_type = "ExpansionProfile" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.activeOnly = None - """ Include or exclude inactive concepts in the expansion. - Type `bool`. """ - - self.contact = None - """ Contact details for the publisher. - List of `ContactDetail` items (represented as `dict` in JSON). """ - - self.date = None - """ Date this was last changed. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Natural language description of the expansion profile. - Type `str`. """ - - self.designation = None - """ When the expansion profile imposes designation contraints. - Type `ExpansionProfileDesignation` (represented as `dict` in JSON). """ - - self.displayLanguage = None - """ Specify the language for the display element of codes in the value - set expansion. - Type `str`. """ - - self.excludeNested = None - """ Nested codes in the expansion or not. - Type `bool`. """ - - self.excludeNotForUI = None - """ Include or exclude codes which cannot be rendered in user - interfaces in the value set expansion. - Type `bool`. """ - - self.excludePostCoordinated = None - """ Include or exclude codes which are post coordinated expressions in - the value set expansion. - Type `bool`. """ - - self.excludedSystem = None - """ Systems/Versions to be exclude. - Type `ExpansionProfileExcludedSystem` (represented as `dict` in JSON). """ - - self.experimental = None - """ For testing purposes, not real usage. - Type `bool`. """ - - self.fixedVersion = None - """ Fix use of a code system to a particular version. - List of `ExpansionProfileFixedVersion` items (represented as `dict` in JSON). """ - - self.identifier = None - """ Additional identifier for the expansion profile. - Type `Identifier` (represented as `dict` in JSON). """ - - self.includeDefinition = None - """ Include or exclude the value set definition in the expansion. - Type `bool`. """ - - self.includeDesignations = None - """ Whether the expansion should include concept designations. - Type `bool`. """ - - self.jurisdiction = None - """ Intended jurisdiction for expansion profile (if applicable). - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.limitedExpansion = None - """ Controls behaviour of the value set expand operation when value - sets are too large to be completely expanded. - Type `bool`. """ - - self.name = None - """ Name for this expansion profile (computer friendly). - Type `str`. """ - - self.publisher = None - """ Name of the publisher (organization or individual). - Type `str`. """ - - self.status = None - """ draft | active | retired | unknown. - Type `str`. """ - - self.url = None - """ Logical URI to reference this expansion profile (globally unique). - Type `str`. """ - - self.useContext = None - """ Context the content is intended to support. - List of `UsageContext` items (represented as `dict` in JSON). """ - - self.version = None - """ Business version of the expansion profile. - Type `str`. """ - - super(ExpansionProfile, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfile, self).elementProperties() - js.extend([ - ("activeOnly", "activeOnly", bool, False, None, False), - ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("description", "description", str, False, None, False), - ("designation", "designation", ExpansionProfileDesignation, False, None, False), - ("displayLanguage", "displayLanguage", str, False, None, False), - ("excludeNested", "excludeNested", bool, False, None, False), - ("excludeNotForUI", "excludeNotForUI", bool, False, None, False), - ("excludePostCoordinated", "excludePostCoordinated", bool, False, None, False), - ("excludedSystem", "excludedSystem", ExpansionProfileExcludedSystem, False, None, False), - ("experimental", "experimental", bool, False, None, False), - ("fixedVersion", "fixedVersion", ExpansionProfileFixedVersion, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("includeDefinition", "includeDefinition", bool, False, None, False), - ("includeDesignations", "includeDesignations", bool, False, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), - ("limitedExpansion", "limitedExpansion", bool, False, None, False), - ("name", "name", str, False, None, False), - ("publisher", "publisher", str, False, None, False), - ("status", "status", str, False, None, True), - ("url", "url", str, False, None, False), - ("useContext", "useContext", usagecontext.UsageContext, True, None, False), - ("version", "version", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class ExpansionProfileDesignation(backboneelement.BackboneElement): - """ When the expansion profile imposes designation contraints. - - A set of criteria that provide the constraints imposed on the value set - expansion by including or excluding designations. - """ - - resource_type = "ExpansionProfileDesignation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.exclude = None - """ Designations to be excluded. - Type `ExpansionProfileDesignationExclude` (represented as `dict` in JSON). """ - - self.include = None - """ Designations to be included. - Type `ExpansionProfileDesignationInclude` (represented as `dict` in JSON). """ - - super(ExpansionProfileDesignation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfileDesignation, self).elementProperties() - js.extend([ - ("exclude", "exclude", ExpansionProfileDesignationExclude, False, None, False), - ("include", "include", ExpansionProfileDesignationInclude, False, None, False), - ]) - return js - - -class ExpansionProfileDesignationExclude(backboneelement.BackboneElement): - """ Designations to be excluded. - """ - - resource_type = "ExpansionProfileDesignationExclude" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.designation = None - """ The designation to be excluded. - List of `ExpansionProfileDesignationExcludeDesignation` items (represented as `dict` in JSON). """ - - super(ExpansionProfileDesignationExclude, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfileDesignationExclude, self).elementProperties() - js.extend([ - ("designation", "designation", ExpansionProfileDesignationExcludeDesignation, True, None, False), - ]) - return js - - -class ExpansionProfileDesignationExcludeDesignation(backboneelement.BackboneElement): - """ The designation to be excluded. - - A data group for each designation to be excluded. - """ - - resource_type = "ExpansionProfileDesignationExcludeDesignation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.language = None - """ Human language of the designation to be excluded. - Type `str`. """ - - self.use = None - """ What kind of Designation to exclude. - Type `Coding` (represented as `dict` in JSON). """ - - super(ExpansionProfileDesignationExcludeDesignation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfileDesignationExcludeDesignation, self).elementProperties() - js.extend([ - ("language", "language", str, False, None, False), - ("use", "use", coding.Coding, False, None, False), - ]) - return js - - -class ExpansionProfileDesignationInclude(backboneelement.BackboneElement): - """ Designations to be included. - """ - - resource_type = "ExpansionProfileDesignationInclude" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.designation = None - """ The designation to be included. - List of `ExpansionProfileDesignationIncludeDesignation` items (represented as `dict` in JSON). """ - - super(ExpansionProfileDesignationInclude, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfileDesignationInclude, self).elementProperties() - js.extend([ - ("designation", "designation", ExpansionProfileDesignationIncludeDesignation, True, None, False), - ]) - return js - - -class ExpansionProfileDesignationIncludeDesignation(backboneelement.BackboneElement): - """ The designation to be included. - - A data group for each designation to be included. - """ - - resource_type = "ExpansionProfileDesignationIncludeDesignation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.language = None - """ Human language of the designation to be included. - Type `str`. """ - - self.use = None - """ What kind of Designation to include. - Type `Coding` (represented as `dict` in JSON). """ - - super(ExpansionProfileDesignationIncludeDesignation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfileDesignationIncludeDesignation, self).elementProperties() - js.extend([ - ("language", "language", str, False, None, False), - ("use", "use", coding.Coding, False, None, False), - ]) - return js - - -class ExpansionProfileExcludedSystem(backboneelement.BackboneElement): - """ Systems/Versions to be exclude. - - Code system, or a particular version of a code system to be excluded from - value set expansions. - """ - - resource_type = "ExpansionProfileExcludedSystem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.system = None - """ The specific code system to be excluded. - Type `str`. """ - - self.version = None - """ Specific version of the code system referred to. - Type `str`. """ - - super(ExpansionProfileExcludedSystem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfileExcludedSystem, self).elementProperties() - js.extend([ - ("system", "system", str, False, None, True), - ("version", "version", str, False, None, False), - ]) - return js - - -class ExpansionProfileFixedVersion(backboneelement.BackboneElement): - """ Fix use of a code system to a particular version. - - Fix use of a particular code system to a particular version. - """ - - resource_type = "ExpansionProfileFixedVersion" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.mode = None - """ default | check | override. - Type `str`. """ - - self.system = None - """ System to have its version fixed. - Type `str`. """ - - self.version = None - """ Specific version of the code system referred to. - Type `str`. """ - - super(ExpansionProfileFixedVersion, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExpansionProfileFixedVersion, self).elementProperties() - js.extend([ - ("mode", "mode", str, False, None, True), - ("system", "system", str, False, None, True), - ("version", "version", str, False, None, True), - ]) - return js - - -import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] -try: - from . import contactdetail -except ImportError: - contactdetail = sys.modules[__package__ + '.contactdetail'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] -try: - from . import usagecontext -except ImportError: - usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/expansionprofile_tests.py b/fhirclient/models/expansionprofile_tests.py deleted file mode 100644 index 89616ed01..000000000 --- a/fhirclient/models/expansionprofile_tests.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import expansionprofile -from .fhirdate import FHIRDate - - -class ExpansionProfileTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("ExpansionProfile", js["resourceType"]) - return expansionprofile.ExpansionProfile(js) - - def testExpansionProfile1(self): - inst = self.instantiate_from("expansionprofile-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ExpansionProfile instance") - self.implExpansionProfile1(inst) - - js = inst.as_json() - self.assertEqual("ExpansionProfile", js["resourceType"]) - inst2 = expansionprofile.ExpansionProfile(js) - self.implExpansionProfile1(inst2) - - def implExpansionProfile1(self, inst): - self.assertEqual(inst.contact[0].name, "FHIR project team") - self.assertEqual(inst.contact[0].telecom[0].system, "url") - self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.date.date, FHIRDate("2016-12-23").date) - self.assertEqual(inst.date.as_json(), "2016-12-23") - self.assertEqual(inst.description, "exanple ExpansionProfile for publication") - self.assertTrue(inst.excludeNested) - self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.system, "http://example.org/profiles") - self.assertEqual(inst.identifier.value, "example") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "001") - self.assertEqual(inst.jurisdiction[0].coding[0].display, "World") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "http://unstats.un.org/unsd/methods/m49/m49.htm") - self.assertEqual(inst.name, "Example Expansion Profile") - self.assertEqual(inst.publisher, "HL7 International") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.div, "
[ Provide Rendering ]
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/ExpansionProfile/example") - self.assertEqual(inst.version, "0.1") - diff --git a/fhirclient/models/explanationofbenefit.py b/fhirclient/models/explanationofbenefit.py index 72de616a8..e855bcab0 100644 --- a/fhirclient/models/explanationofbenefit.py +++ b/fhirclient/models/explanationofbenefit.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -26,19 +26,27 @@ def __init__(self, jsondict=None, strict=True): """ self.accident = None - """ Details of an accident. + """ Details of the event. Type `ExplanationOfBenefitAccident` (represented as `dict` in JSON). """ self.addItem = None """ Insurer added line items. List of `ExplanationOfBenefitAddItem` items (represented as `dict` in JSON). """ + self.adjudication = None + """ Header-level adjudication. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + self.benefitBalance = None """ Balance by Benefit Category. List of `ExplanationOfBenefitBenefitBalance` items (represented as `dict` in JSON). """ + self.benefitPeriod = None + """ When the benefits are applicable. + Type `Period` (represented as `dict` in JSON). """ + self.billablePeriod = None - """ Period for charge submission. + """ Relevant time frame for the claim. Type `Period` (represented as `dict` in JSON). """ self.careTeam = None @@ -47,115 +55,122 @@ def __init__(self, jsondict=None, strict=True): self.claim = None """ Claim reference. - Type `FHIRReference` referencing `Claim` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.claimResponse = None """ Claim response reference. - Type `FHIRReference` referencing `ClaimResponse` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.created = None - """ Creation date. + """ Response creation date. Type `FHIRDate` (represented as `str` in JSON). """ self.diagnosis = None - """ List of Diagnosis. + """ Pertinent diagnosis information. List of `ExplanationOfBenefitDiagnosis` items (represented as `dict` in JSON). """ self.disposition = None """ Disposition Message. Type `str`. """ - self.employmentImpacted = None - """ Period unable to work. - Type `Period` (represented as `dict` in JSON). """ - self.enterer = None - """ Author. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + """ Author of the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ self.facility = None """ Servicing Facility. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.form = None - """ Printed Form Identifier. + """ Printed reference or actual form. + Type `Attachment` (represented as `dict` in JSON). """ + + self.formCode = None + """ Printed form identifier. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.hospitalization = None - """ Period in hospital. - Type `Period` (represented as `dict` in JSON). """ + self.fundsReserve = None + """ Funds reserved status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fundsReserveRequested = None + """ For whom to reserve funds. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.identifier = None - """ Business Identifier. + """ Business Identifier for the resource. List of `Identifier` items (represented as `dict` in JSON). """ - self.information = None - """ Exceptions, special considerations, the condition, situation, prior - or concurrent issues. - List of `ExplanationOfBenefitInformation` items (represented as `dict` in JSON). """ - self.insurance = None - """ Insurance or medical plan. - Type `ExplanationOfBenefitInsurance` (represented as `dict` in JSON). """ + """ Patient insurance information. + List of `ExplanationOfBenefitInsurance` items (represented as `dict` in JSON). """ self.insurer = None - """ Insurer responsible for the EOB. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Party responsible for reimbursement. + Type `FHIRReference` (represented as `dict` in JSON). """ self.item = None - """ Goods and Services. + """ Product or service provided. List of `ExplanationOfBenefitItem` items (represented as `dict` in JSON). """ - self.organization = None - """ Responsible organization for the claim. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - self.originalPrescription = None """ Original prescription if superceded by fulfiller. - Type `FHIRReference` referencing `MedicationRequest` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.outcome = None - """ complete | error | partial. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ queued | complete | error | partial. + Type `str`. """ self.patient = None - """ The subject of the Products and Services. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + """ The recipient of the products and services. + Type `FHIRReference` (represented as `dict` in JSON). """ self.payee = None - """ Party to be paid any benefits payable. + """ Recipient of benefits payable. Type `ExplanationOfBenefitPayee` (represented as `dict` in JSON). """ self.payment = None - """ Payment (if paid). + """ Payment Details. Type `ExplanationOfBenefitPayment` (represented as `dict` in JSON). """ + self.preAuthRef = None + """ Preauthorization reference. + List of `str` items. """ + + self.preAuthRefPeriod = None + """ Preauthorization in-effect period. + List of `Period` items (represented as `dict` in JSON). """ + self.precedence = None """ Precedence (primary, secondary, etc.). Type `int`. """ self.prescription = None """ Prescription authorizing services or products. - Type `FHIRReference` referencing `MedicationRequest, VisionPrescription` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.priority = None + """ Desired processing urgency. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.procedure = None - """ Procedures performed. + """ Clinical procedures performed. List of `ExplanationOfBenefitProcedure` items (represented as `dict` in JSON). """ self.processNote = None - """ Processing notes. + """ Note concerning adjudication. List of `ExplanationOfBenefitProcessNote` items (represented as `dict` in JSON). """ self.provider = None - """ Responsible provider for the claim. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + """ Party responsible for the claim. + Type `FHIRReference` (represented as `dict` in JSON). """ self.referral = None """ Treatment Referral. - Type `FHIRReference` referencing `ReferralRequest` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.related = None - """ Related Claims which may be revelant to processing this claim. + """ Prior or corollary claims. List of `ExplanationOfBenefitRelated` items (represented as `dict` in JSON). """ self.status = None @@ -163,24 +178,24 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.subType = None - """ Finer grained claim type information. - List of `CodeableConcept` items (represented as `dict` in JSON). """ + """ More granular claim type. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.totalBenefit = None - """ Total benefit payable for the Claim. - Type `Money` (represented as `dict` in JSON). """ + self.supportingInfo = None + """ Supporting information. + List of `ExplanationOfBenefitSupportingInfo` items (represented as `dict` in JSON). """ - self.totalCost = None - """ Total Cost of service from the Claim. - Type `Money` (represented as `dict` in JSON). """ + self.total = None + """ Adjudication totals. + List of `ExplanationOfBenefitTotal` items (represented as `dict` in JSON). """ self.type = None - """ Type or discipline. + """ Category or discipline. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.unallocDeductable = None - """ Unallocated deductable. - Type `Money` (represented as `dict` in JSON). """ + self.use = None + """ claim | preauthorization | predetermination. + Type `str`. """ super(ExplanationOfBenefit, self).__init__(jsondict=jsondict, strict=strict) @@ -189,43 +204,47 @@ def elementProperties(self): js.extend([ ("accident", "accident", ExplanationOfBenefitAccident, False, None, False), ("addItem", "addItem", ExplanationOfBenefitAddItem, True, None, False), + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), ("benefitBalance", "benefitBalance", ExplanationOfBenefitBenefitBalance, True, None, False), + ("benefitPeriod", "benefitPeriod", period.Period, False, None, False), ("billablePeriod", "billablePeriod", period.Period, False, None, False), ("careTeam", "careTeam", ExplanationOfBenefitCareTeam, True, None, False), ("claim", "claim", fhirreference.FHIRReference, False, None, False), ("claimResponse", "claimResponse", fhirreference.FHIRReference, False, None, False), - ("created", "created", fhirdate.FHIRDate, False, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, True), ("diagnosis", "diagnosis", ExplanationOfBenefitDiagnosis, True, None, False), ("disposition", "disposition", str, False, None, False), - ("employmentImpacted", "employmentImpacted", period.Period, False, None, False), ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), ("facility", "facility", fhirreference.FHIRReference, False, None, False), - ("form", "form", codeableconcept.CodeableConcept, False, None, False), - ("hospitalization", "hospitalization", period.Period, False, None, False), + ("form", "form", attachment.Attachment, False, None, False), + ("formCode", "formCode", codeableconcept.CodeableConcept, False, None, False), + ("fundsReserve", "fundsReserve", codeableconcept.CodeableConcept, False, None, False), + ("fundsReserveRequested", "fundsReserveRequested", codeableconcept.CodeableConcept, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("information", "information", ExplanationOfBenefitInformation, True, None, False), - ("insurance", "insurance", ExplanationOfBenefitInsurance, False, None, False), - ("insurer", "insurer", fhirreference.FHIRReference, False, None, False), + ("insurance", "insurance", ExplanationOfBenefitInsurance, True, None, True), + ("insurer", "insurer", fhirreference.FHIRReference, False, None, True), ("item", "item", ExplanationOfBenefitItem, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), ("originalPrescription", "originalPrescription", fhirreference.FHIRReference, False, None, False), - ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("outcome", "outcome", str, False, None, True), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("payee", "payee", ExplanationOfBenefitPayee, False, None, False), ("payment", "payment", ExplanationOfBenefitPayment, False, None, False), + ("preAuthRef", "preAuthRef", str, True, None, False), + ("preAuthRefPeriod", "preAuthRefPeriod", period.Period, True, None, False), ("precedence", "precedence", int, False, None, False), ("prescription", "prescription", fhirreference.FHIRReference, False, None, False), + ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), ("procedure", "procedure", ExplanationOfBenefitProcedure, True, None, False), ("processNote", "processNote", ExplanationOfBenefitProcessNote, True, None, False), - ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("provider", "provider", fhirreference.FHIRReference, False, None, True), ("referral", "referral", fhirreference.FHIRReference, False, None, False), ("related", "related", ExplanationOfBenefitRelated, True, None, False), - ("status", "status", str, False, None, False), - ("subType", "subType", codeableconcept.CodeableConcept, True, None, False), - ("totalBenefit", "totalBenefit", money.Money, False, None, False), - ("totalCost", "totalCost", money.Money, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ("unallocDeductable", "unallocDeductable", money.Money, False, None, False), + ("status", "status", str, False, None, True), + ("subType", "subType", codeableconcept.CodeableConcept, False, None, False), + ("supportingInfo", "supportingInfo", ExplanationOfBenefitSupportingInfo, True, None, False), + ("total", "total", ExplanationOfBenefitTotal, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("use", "use", str, False, None, True), ]) return js @@ -233,9 +252,10 @@ def elementProperties(self): from . import backboneelement class ExplanationOfBenefitAccident(backboneelement.BackboneElement): - """ Details of an accident. + """ Details of the event. - An accident which resulted in the need for healthcare services. + Details of a accident which resulted in injuries which required the + products and services listed in the claim. """ resource_type = "ExplanationOfBenefitAccident" @@ -249,16 +269,16 @@ def __init__(self, jsondict=None, strict=True): """ self.date = None - """ When the accident occurred. + """ When the incident occurred. Type `FHIRDate` (represented as `str` in JSON). """ self.locationAddress = None - """ Accident Place. + """ Where the event occurred. Type `Address` (represented as `dict` in JSON). """ self.locationReference = None - """ Accident Place. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Where the event occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ The nature of the accident. @@ -280,7 +300,8 @@ def elementProperties(self): class ExplanationOfBenefitAddItem(backboneelement.BackboneElement): """ Insurer added line items. - The first tier service adjudications for payor added services. + The first-tier service adjudications for payor added product or service + lines. """ resource_type = "ExplanationOfBenefitAddItem" @@ -297,37 +318,85 @@ def __init__(self, jsondict=None, strict=True): """ Added items adjudication. List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ - self.category = None - """ Type of service or product. + self.bodySite = None + """ Anatomical location. Type `CodeableConcept` (represented as `dict` in JSON). """ self.detail = None - """ Added items details. + """ Insurer added line items. List of `ExplanationOfBenefitAddItemDetail` items (represented as `dict` in JSON). """ - self.fee = None - """ Professional fee or Product charge. - Type `Money` (represented as `dict` in JSON). """ + self.detailSequence = None + """ Detail sequence number. + List of `int` items. """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.itemSequence = None + """ Item sequence number. + List of `int` items. """ + + self.locationAddress = None + """ Place of service or where product was supplied. + Type `Address` (represented as `dict` in JSON). """ + + self.locationCodeableConcept = None + """ Place of service or where product was supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.locationReference = None + """ Place of service or where product was supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ self.modifier = None """ Service/Product billing modifiers. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.net = None + """ Total item cost. + Type `Money` (represented as `dict` in JSON). """ + self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.revenue = None - """ Revenue or cost center code. + self.productOrService = None + """ Billing, service, product, or drug code. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.sequenceLinkId = None - """ Service instances. + self.programCode = None + """ Program the product or service is provided under. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.provider = None + """ Authorized providers. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.servicedDate = None + """ Date or dates of service or product delivery. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.servicedPeriod = None + """ Date or dates of service or product delivery. + Type `Period` (represented as `dict` in JSON). """ + + self.subDetailSequence = None + """ Subdetail sequence number. List of `int` items. """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.subSite = None + """ Anatomical sub-location. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ super(ExplanationOfBenefitAddItem, self).__init__(jsondict=jsondict, strict=strict) @@ -335,22 +404,34 @@ def elementProperties(self): js = super(ExplanationOfBenefitAddItem, self).elementProperties() js.extend([ ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), ("detail", "detail", ExplanationOfBenefitAddItemDetail, True, None, False), - ("fee", "fee", money.Money, False, None, False), + ("detailSequence", "detailSequence", int, True, None, False), + ("factor", "factor", float, False, None, False), + ("itemSequence", "itemSequence", int, True, None, False), + ("locationAddress", "locationAddress", address.Address, False, "location", False), + ("locationCodeableConcept", "locationCodeableConcept", codeableconcept.CodeableConcept, False, "location", False), + ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), ("noteNumber", "noteNumber", int, True, None, False), - ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), - ("sequenceLinkId", "sequenceLinkId", int, True, None, False), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), + ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), + ("provider", "provider", fhirreference.FHIRReference, True, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), + ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), + ("subDetailSequence", "subDetailSequence", int, True, None, False), + ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), ]) return js class ExplanationOfBenefitAddItemDetail(backboneelement.BackboneElement): - """ Added items details. + """ Insurer added line items. - The second tier service adjudications for payor added services. + The second-tier service adjudications for payor added services. """ resource_type = "ExplanationOfBenefitAddItemDetail" @@ -364,45 +445,120 @@ def __init__(self, jsondict=None, strict=True): """ self.adjudication = None - """ Added items detail adjudication. + """ Added items adjudication. List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ - self.category = None - """ Type of service or product. + self.factor = None + """ Price scaling factor. + Type `float`. """ + + self.modifier = None + """ Service/Product billing modifiers. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.net = None + """ Total item cost. + Type `Money` (represented as `dict` in JSON). """ + + self.noteNumber = None + """ Applicable note numbers. + List of `int` items. """ + + self.productOrService = None + """ Billing, service, product, or drug code. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.fee = None - """ Professional fee or Product charge. + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ + + self.subDetail = None + """ Insurer added line items. + List of `ExplanationOfBenefitAddItemDetailSubDetail` items (represented as `dict` in JSON). """ + + self.unitPrice = None + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ + super(ExplanationOfBenefitAddItemDetail, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitAddItemDetail, self).elementProperties() + js.extend([ + ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), + ("factor", "factor", float, False, None, False), + ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), + ("noteNumber", "noteNumber", int, True, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("subDetail", "subDetail", ExplanationOfBenefitAddItemDetailSubDetail, True, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), + ]) + return js + + +class ExplanationOfBenefitAddItemDetailSubDetail(backboneelement.BackboneElement): + """ Insurer added line items. + + The third-tier service adjudications for payor added services. + """ + + resource_type = "ExplanationOfBenefitAddItemDetailSubDetail" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.adjudication = None + """ Added items adjudication. + List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ + + self.factor = None + """ Price scaling factor. + Type `float`. """ + self.modifier = None """ Service/Product billing modifiers. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.net = None + """ Total item cost. + Type `Money` (represented as `dict` in JSON). """ + self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.revenue = None - """ Revenue or cost center code. + self.productOrService = None + """ Billing, service, product, or drug code. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.quantity = None + """ Count of products or services. + Type `Quantity` (represented as `dict` in JSON). """ - super(ExplanationOfBenefitAddItemDetail, self).__init__(jsondict=jsondict, strict=strict) + self.unitPrice = None + """ Fee, charge or cost per item. + Type `Money` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitAddItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ExplanationOfBenefitAddItemDetail, self).elementProperties() + js = super(ExplanationOfBenefitAddItemDetailSubDetail, self).elementProperties() js.extend([ ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("fee", "fee", money.Money, False, None, False), + ("factor", "factor", float, False, None, False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), + ("net", "net", money.Money, False, None, False), ("noteNumber", "noteNumber", int, True, None, False), - ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("unitPrice", "unitPrice", money.Money, False, None, False), ]) return js @@ -422,7 +578,7 @@ def __init__(self, jsondict=None, strict=True): """ self.category = None - """ Type of services covered. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.description = None @@ -445,10 +601,6 @@ def __init__(self, jsondict=None, strict=True): """ In or out of network. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.subCategory = None - """ Detailed services covered within the type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.term = None """ Annual or lifetime. Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -468,7 +620,6 @@ def elementProperties(self): ("financial", "financial", ExplanationOfBenefitBenefitBalanceFinancial, True, None, False), ("name", "name", str, False, None, False), ("network", "network", codeableconcept.CodeableConcept, False, None, False), - ("subCategory", "subCategory", codeableconcept.CodeableConcept, False, None, False), ("term", "term", codeableconcept.CodeableConcept, False, None, False), ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), ]) @@ -504,7 +655,7 @@ def __init__(self, jsondict=None, strict=True): Type `int`. """ self.type = None - """ Deductable, visits, benefit amount. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.usedMoney = None @@ -533,8 +684,7 @@ def elementProperties(self): class ExplanationOfBenefitCareTeam(backboneelement.BackboneElement): """ Care Team members. - The members of the team who provided the overall service as well as their - role and whether responsible and qualifications. + The members of the team who provided the products and services. """ resource_type = "ExplanationOfBenefitCareTeam" @@ -548,23 +698,23 @@ def __init__(self, jsondict=None, strict=True): """ self.provider = None - """ Member of the Care Team. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + """ Practitioner or organization. + Type `FHIRReference` (represented as `dict` in JSON). """ self.qualification = None - """ Type, classification or Specialization. + """ Practitioner credential or specialization. Type `CodeableConcept` (represented as `dict` in JSON). """ self.responsible = None - """ Billing practitioner. + """ Indicator of the lead practitioner. Type `bool`. """ self.role = None - """ Role on the team. + """ Function within the team. Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Number to covey order of careteam. + """ Order of care team. Type `int`. """ super(ExplanationOfBenefitCareTeam, self).__init__(jsondict=jsondict, strict=strict) @@ -582,9 +732,9 @@ def elementProperties(self): class ExplanationOfBenefitDiagnosis(backboneelement.BackboneElement): - """ List of Diagnosis. + """ Pertinent diagnosis information. - Ordered list of patient diagnosis for which care is sought. + Information about diagnoses relevant to the claim items. """ resource_type = "ExplanationOfBenefitDiagnosis" @@ -598,19 +748,23 @@ def __init__(self, jsondict=None, strict=True): """ self.diagnosisCodeableConcept = None - """ Patient's diagnosis. + """ Nature of illness or problem. Type `CodeableConcept` (represented as `dict` in JSON). """ self.diagnosisReference = None - """ Patient's diagnosis. - Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + """ Nature of illness or problem. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.onAdmission = None + """ Present on admission. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.packageCode = None """ Package billing code. Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Number to covey order of diagnosis. + """ Diagnosis instance identifier. Type `int`. """ self.type = None @@ -624,6 +778,7 @@ def elementProperties(self): js.extend([ ("diagnosisCodeableConcept", "diagnosisCodeableConcept", codeableconcept.CodeableConcept, False, "diagnosis", True), ("diagnosisReference", "diagnosisReference", fhirreference.FHIRReference, False, "diagnosis", True), + ("onAdmission", "onAdmission", codeableconcept.CodeableConcept, False, None, False), ("packageCode", "packageCode", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), ("type", "type", codeableconcept.CodeableConcept, True, None, False), @@ -631,88 +786,11 @@ def elementProperties(self): return js -class ExplanationOfBenefitInformation(backboneelement.BackboneElement): - """ Exceptions, special considerations, the condition, situation, prior or - concurrent issues. - - Additional information codes regarding exceptions, special considerations, - the condition, situation, prior or concurrent issues. Often there are - mutiple jurisdiction specific valuesets which are required. - """ - - resource_type = "ExplanationOfBenefitInformation" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.category = None - """ General class of information. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.code = None - """ Type of information. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.reason = None - """ Reason associated with the information. - Type `Coding` (represented as `dict` in JSON). """ - - self.sequence = None - """ Information instance identifier. - Type `int`. """ - - self.timingDate = None - """ When it occurred. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.timingPeriod = None - """ When it occurred. - Type `Period` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Additional Data or supporting information. - Type `Attachment` (represented as `dict` in JSON). """ - - self.valueQuantity = None - """ Additional Data or supporting information. - Type `Quantity` (represented as `dict` in JSON). """ - - self.valueReference = None - """ Additional Data or supporting information. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.valueString = None - """ Additional Data or supporting information. - Type `str`. """ - - super(ExplanationOfBenefitInformation, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ExplanationOfBenefitInformation, self).elementProperties() - js.extend([ - ("category", "category", codeableconcept.CodeableConcept, False, None, True), - ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("reason", "reason", coding.Coding, False, None, False), - ("sequence", "sequence", int, False, None, True), - ("timingDate", "timingDate", fhirdate.FHIRDate, False, "timing", False), - ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), - ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), - ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), - ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), - ("valueString", "valueString", str, False, "value", False), - ]) - return js - - class ExplanationOfBenefitInsurance(backboneelement.BackboneElement): - """ Insurance or medical plan. + """ Patient insurance information. - Financial instrument by which payment information for health care. + Financial instruments for reimbursement for the health care products and + services specified on the claim. """ resource_type = "ExplanationOfBenefitInsurance" @@ -727,10 +805,14 @@ def __init__(self, jsondict=None, strict=True): self.coverage = None """ Insurance information. - Type `FHIRReference` referencing `Coverage` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.focal = None + """ Coverage to be used for adjudication. + Type `bool`. """ self.preAuthRef = None - """ Pre-Authorization/Determination Reference. + """ Prior authorization reference number. List of `str` items. """ super(ExplanationOfBenefitInsurance, self).__init__(jsondict=jsondict, strict=strict) @@ -738,16 +820,18 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(ExplanationOfBenefitInsurance, self).elementProperties() js.extend([ - ("coverage", "coverage", fhirreference.FHIRReference, False, None, False), + ("coverage", "coverage", fhirreference.FHIRReference, False, None, True), + ("focal", "focal", bool, False, None, True), ("preAuthRef", "preAuthRef", str, True, None, False), ]) return js class ExplanationOfBenefitItem(backboneelement.BackboneElement): - """ Goods and Services. + """ Product or service provided. - First tier of goods and services. + A claim line. Either a simple (a product or service) or a 'group' of + details which can also be a simple items or groups of sub-details. """ resource_type = "ExplanationOfBenefitItem" @@ -765,51 +849,51 @@ def __init__(self, jsondict=None, strict=True): List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ self.bodySite = None - """ Service Location. + """ Anatomical location. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.careTeamLinkId = None - """ Applicable careteam members. + self.careTeamSequence = None + """ Applicable care team members. List of `int` items. """ self.category = None - """ Type of service or product. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.detail = None """ Additional items. List of `ExplanationOfBenefitItemDetail` items (represented as `dict` in JSON). """ - self.diagnosisLinkId = None + self.diagnosisSequence = None """ Applicable diagnoses. List of `int` items. """ self.encounter = None """ Encounters related to this billed item. - List of `FHIRReference` items referencing `Encounter` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.factor = None """ Price scaling factor. Type `float`. """ - self.informationLinkId = None + self.informationSequence = None """ Applicable exception and supporting information. List of `int` items. """ self.locationAddress = None - """ Place of service. + """ Place of service or where product was supplied. Type `Address` (represented as `dict` in JSON). """ self.locationCodeableConcept = None - """ Place of service. + """ Place of service or where product was supplied. Type `CodeableConcept` (represented as `dict` in JSON). """ self.locationReference = None - """ Place of service. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Place of service or where product was supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ self.modifier = None - """ Service/Product billing modifiers. + """ Product or service billing modifiers. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.net = None @@ -817,19 +901,23 @@ def __init__(self, jsondict=None, strict=True): Type `Money` (represented as `dict` in JSON). """ self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ - self.procedureLinkId = None + self.procedureSequence = None """ Applicable procedures. List of `int` items. """ + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.programCode = None - """ Program specific reason for item inclusion. + """ Program the product or service is provided under. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.quantity = None - """ Count of Products or Services. + """ Count of products or services. Type `Quantity` (represented as `dict` in JSON). """ self.revenue = None @@ -837,31 +925,27 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Service instance. + """ Item instance identifier. Type `int`. """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.servicedDate = None - """ Date or dates of Service. + """ Date or dates of service or product delivery. Type `FHIRDate` (represented as `str` in JSON). """ self.servicedPeriod = None - """ Date or dates of Service. + """ Date or dates of service or product delivery. Type `Period` (represented as `dict` in JSON). """ self.subSite = None - """ Service Sub-location. + """ Anatomical sub-location. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.udi = None - """ Unique Device Identifier. - List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.unitPrice = None - """ Fee, charge or cost per point. + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ super(ExplanationOfBenefitItem, self).__init__(jsondict=jsondict, strict=strict) @@ -871,25 +955,25 @@ def elementProperties(self): js.extend([ ("adjudication", "adjudication", ExplanationOfBenefitItemAdjudication, True, None, False), ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), - ("careTeamLinkId", "careTeamLinkId", int, True, None, False), + ("careTeamSequence", "careTeamSequence", int, True, None, False), ("category", "category", codeableconcept.CodeableConcept, False, None, False), ("detail", "detail", ExplanationOfBenefitItemDetail, True, None, False), - ("diagnosisLinkId", "diagnosisLinkId", int, True, None, False), + ("diagnosisSequence", "diagnosisSequence", int, True, None, False), ("encounter", "encounter", fhirreference.FHIRReference, True, None, False), ("factor", "factor", float, False, None, False), - ("informationLinkId", "informationLinkId", int, True, None, False), + ("informationSequence", "informationSequence", int, True, None, False), ("locationAddress", "locationAddress", address.Address, False, "location", False), ("locationCodeableConcept", "locationCodeableConcept", codeableconcept.CodeableConcept, False, "location", False), ("locationReference", "locationReference", fhirreference.FHIRReference, False, "location", False), ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), ("net", "net", money.Money, False, None, False), ("noteNumber", "noteNumber", int, True, None, False), - ("procedureLinkId", "procedureLinkId", int, True, None, False), + ("procedureSequence", "procedureSequence", int, True, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), ("servicedDate", "servicedDate", fhirdate.FHIRDate, False, "serviced", False), ("servicedPeriod", "servicedPeriod", period.Period, False, "serviced", False), ("subSite", "subSite", codeableconcept.CodeableConcept, True, None, False), @@ -902,7 +986,9 @@ def elementProperties(self): class ExplanationOfBenefitItemAdjudication(backboneelement.BackboneElement): """ Adjudication details. - The adjudications results. + If this item is a group then the values here are a summary of the + adjudication of the detail items. If this item is a simple product or + service then this is the result of the adjudication of this item. """ resource_type = "ExplanationOfBenefitItemAdjudication" @@ -920,15 +1006,15 @@ def __init__(self, jsondict=None, strict=True): Type `Money` (represented as `dict` in JSON). """ self.category = None - """ Adjudication category such as co-pay, eligible, benefit, etc.. + """ Type of adjudication information. Type `CodeableConcept` (represented as `dict` in JSON). """ self.reason = None - """ Explanation of Adjudication outcome. + """ Explanation of adjudication outcome. Type `CodeableConcept` (represented as `dict` in JSON). """ self.value = None - """ Non-monitory value. + """ Non-monitary value. Type `float`. """ super(ExplanationOfBenefitItemAdjudication, self).__init__(jsondict=jsondict, strict=strict) @@ -947,7 +1033,7 @@ def elementProperties(self): class ExplanationOfBenefitItemDetail(backboneelement.BackboneElement): """ Additional items. - Second tier of goods and services. + Second-tier of goods and services. """ resource_type = "ExplanationOfBenefitItemDetail" @@ -965,7 +1051,7 @@ def __init__(self, jsondict=None, strict=True): List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ self.category = None - """ Type of service or product. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.factor = None @@ -977,19 +1063,23 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.net = None - """ Total additional item cost. + """ Total item cost. Type `Money` (represented as `dict` in JSON). """ self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.programCode = None - """ Program specific reason for item inclusion. + """ Program the product or service is provided under. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.quantity = None - """ Count of Products or Services. + """ Count of products or services. Type `Quantity` (represented as `dict` in JSON). """ self.revenue = None @@ -997,27 +1087,19 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Service instance. + """ Product or service provided. Type `int`. """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.subDetail = None """ Additional items. List of `ExplanationOfBenefitItemDetailSubDetail` items (represented as `dict` in JSON). """ - self.type = None - """ Group or type of product or service. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.udi = None - """ Unique Device Identifier. - List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.unitPrice = None - """ Fee, charge or cost per point. + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ super(ExplanationOfBenefitItemDetail, self).__init__(jsondict=jsondict, strict=strict) @@ -1031,13 +1113,12 @@ def elementProperties(self): ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), ("net", "net", money.Money, False, None, False), ("noteNumber", "noteNumber", int, True, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), ("subDetail", "subDetail", ExplanationOfBenefitItemDetailSubDetail, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, True), ("udi", "udi", fhirreference.FHIRReference, True, None, False), ("unitPrice", "unitPrice", money.Money, False, None, False), ]) @@ -1047,7 +1128,7 @@ def elementProperties(self): class ExplanationOfBenefitItemDetailSubDetail(backboneelement.BackboneElement): """ Additional items. - Third tier of goods and services. + Third-tier of goods and services. """ resource_type = "ExplanationOfBenefitItemDetailSubDetail" @@ -1061,11 +1142,11 @@ def __init__(self, jsondict=None, strict=True): """ self.adjudication = None - """ Language if different from the resource. + """ Subdetail level adjudication details. List of `ExplanationOfBenefitItemAdjudication` items (represented as `dict` in JSON). """ self.category = None - """ Type of service or product. + """ Benefit classification. Type `CodeableConcept` (represented as `dict` in JSON). """ self.factor = None @@ -1077,19 +1158,23 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.net = None - """ Net additional item cost. + """ Total item cost. Type `Money` (represented as `dict` in JSON). """ self.noteNumber = None - """ List of note numbers which apply. + """ Applicable note numbers. List of `int` items. """ + self.productOrService = None + """ Billing, service, product, or drug code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.programCode = None - """ Program specific reason for item inclusion. + """ Program the product or service is provided under. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.quantity = None - """ Count of Products or Services. + """ Count of products or services. Type `Quantity` (represented as `dict` in JSON). """ self.revenue = None @@ -1097,23 +1182,15 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.sequence = None - """ Service instance. + """ Product or service provided. Type `int`. """ - self.service = None - """ Billing Code. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.type = None - """ Type of product or service. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.udi = None - """ Unique Device Identifier. - List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.unitPrice = None - """ Fee, charge or cost per point. + """ Fee, charge or cost per item. Type `Money` (represented as `dict` in JSON). """ super(ExplanationOfBenefitItemDetailSubDetail, self).__init__(jsondict=jsondict, strict=strict) @@ -1127,12 +1204,11 @@ def elementProperties(self): ("modifier", "modifier", codeableconcept.CodeableConcept, True, None, False), ("net", "net", money.Money, False, None, False), ("noteNumber", "noteNumber", int, True, None, False), + ("productOrService", "productOrService", codeableconcept.CodeableConcept, False, None, True), ("programCode", "programCode", codeableconcept.CodeableConcept, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("revenue", "revenue", codeableconcept.CodeableConcept, False, None, False), ("sequence", "sequence", int, False, None, True), - ("service", "service", codeableconcept.CodeableConcept, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, True), ("udi", "udi", fhirreference.FHIRReference, True, None, False), ("unitPrice", "unitPrice", money.Money, False, None, False), ]) @@ -1140,9 +1216,10 @@ def elementProperties(self): class ExplanationOfBenefitPayee(backboneelement.BackboneElement): - """ Party to be paid any benefits payable. + """ Recipient of benefits payable. - The party to be reimbursed for the services. + The party to be reimbursed for cost of the products and services according + to the terms of the policy. """ resource_type = "ExplanationOfBenefitPayee" @@ -1156,15 +1233,11 @@ def __init__(self, jsondict=None, strict=True): """ self.party = None - """ Party to receive the payable. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ - - self.resourceType = None - """ organization | patient | practitioner | relatedperson. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ Recipient reference. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None - """ Type of party: Subscriber, Provider, other. + """ Category of recipient. Type `CodeableConcept` (represented as `dict` in JSON). """ super(ExplanationOfBenefitPayee, self).__init__(jsondict=jsondict, strict=strict) @@ -1173,16 +1246,15 @@ def elementProperties(self): js = super(ExplanationOfBenefitPayee, self).elementProperties() js.extend([ ("party", "party", fhirreference.FHIRReference, False, None, False), - ("resourceType", "resourceType", codeableconcept.CodeableConcept, False, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js class ExplanationOfBenefitPayment(backboneelement.BackboneElement): - """ Payment (if paid). + """ Payment Details. - Payment details for the claim if the claim has been paid. + Payment details for the adjudication of the claim. """ resource_type = "ExplanationOfBenefitPayment" @@ -1196,11 +1268,11 @@ def __init__(self, jsondict=None, strict=True): """ self.adjustment = None - """ Payment adjustment for non-Claim issues. + """ Payment adjustment for non-claim issues. Type `Money` (represented as `dict` in JSON). """ self.adjustmentReason = None - """ Explanation for the non-claim adjustment. + """ Explanation for the variance. Type `CodeableConcept` (represented as `dict` in JSON). """ self.amount = None @@ -1208,15 +1280,15 @@ def __init__(self, jsondict=None, strict=True): Type `Money` (represented as `dict` in JSON). """ self.date = None - """ Expected date of Payment. + """ Expected date of payment. Type `FHIRDate` (represented as `str` in JSON). """ self.identifier = None - """ Identifier of the payment instrument. + """ Business identifier for the payment. Type `Identifier` (represented as `dict` in JSON). """ self.type = None - """ Partial or Complete. + """ Partial or complete payment. Type `CodeableConcept` (represented as `dict` in JSON). """ super(ExplanationOfBenefitPayment, self).__init__(jsondict=jsondict, strict=strict) @@ -1235,9 +1307,10 @@ def elementProperties(self): class ExplanationOfBenefitProcedure(backboneelement.BackboneElement): - """ Procedures performed. + """ Clinical procedures performed. - Ordered list of patient procedures performed to support the adjudication. + Procedures performed on the patient relevant to the billing items with the + claim. """ resource_type = "ExplanationOfBenefitProcedure" @@ -1255,17 +1328,25 @@ def __init__(self, jsondict=None, strict=True): Type `FHIRDate` (represented as `str` in JSON). """ self.procedureCodeableConcept = None - """ Patient's list of procedures performed. + """ Specific clinical procedure. Type `CodeableConcept` (represented as `dict` in JSON). """ self.procedureReference = None - """ Patient's list of procedures performed. - Type `FHIRReference` referencing `Procedure` (represented as `dict` in JSON). """ + """ Specific clinical procedure. + Type `FHIRReference` (represented as `dict` in JSON). """ self.sequence = None - """ Procedure sequence for reference. + """ Procedure instance identifier. Type `int`. """ + self.type = None + """ Category of Procedure. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.udi = None + """ Unique device identifier. + List of `FHIRReference` items (represented as `dict` in JSON). """ + super(ExplanationOfBenefitProcedure, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -1275,14 +1356,17 @@ def elementProperties(self): ("procedureCodeableConcept", "procedureCodeableConcept", codeableconcept.CodeableConcept, False, "procedure", True), ("procedureReference", "procedureReference", fhirreference.FHIRReference, False, "procedure", True), ("sequence", "sequence", int, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ("udi", "udi", fhirreference.FHIRReference, True, None, False), ]) return js class ExplanationOfBenefitProcessNote(backboneelement.BackboneElement): - """ Processing notes. + """ Note concerning adjudication. - Note text. + A note that describes or explains adjudication results in a human readable + form. """ resource_type = "ExplanationOfBenefitProcessNote" @@ -1296,20 +1380,20 @@ def __init__(self, jsondict=None, strict=True): """ self.language = None - """ Language if different from the resource. + """ Language of the text. Type `CodeableConcept` (represented as `dict` in JSON). """ self.number = None - """ Sequence number for this note. + """ Note instance identifier. Type `int`. """ self.text = None - """ Note explanitory text. + """ Note explanatory text. Type `str`. """ self.type = None """ display | print | printoper. - Type `CodeableConcept` (represented as `dict` in JSON). """ + Type `str`. """ super(ExplanationOfBenefitProcessNote, self).__init__(jsondict=jsondict, strict=strict) @@ -1319,16 +1403,16 @@ def elementProperties(self): ("language", "language", codeableconcept.CodeableConcept, False, None, False), ("number", "number", int, False, None, False), ("text", "text", str, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", str, False, None, False), ]) return js class ExplanationOfBenefitRelated(backboneelement.BackboneElement): - """ Related Claims which may be revelant to processing this claim. + """ Prior or corollary claims. - Other claims which are related to this claim such as prior claim versions - or for related services. + Other claims which are related to this claim such as prior submissions or + claims for related services or for the same event. """ resource_type = "ExplanationOfBenefitRelated" @@ -1343,10 +1427,10 @@ def __init__(self, jsondict=None, strict=True): self.claim = None """ Reference to the related claim. - Type `FHIRReference` referencing `Claim` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.reference = None - """ Related file or case reference. + """ File or case reference. Type `Identifier` (represented as `dict` in JSON). """ self.relationship = None @@ -1365,6 +1449,122 @@ def elementProperties(self): return js +class ExplanationOfBenefitSupportingInfo(backboneelement.BackboneElement): + """ Supporting information. + + Additional information codes regarding exceptions, special considerations, + the condition, situation, prior or concurrent issues. + """ + + resource_type = "ExplanationOfBenefitSupportingInfo" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.category = None + """ Classification of the supplied information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Type of information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.reason = None + """ Explanation for the information. + Type `Coding` (represented as `dict` in JSON). """ + + self.sequence = None + """ Information instance identifier. + Type `int`. """ + + self.timingDate = None + """ When it occurred. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.timingPeriod = None + """ When it occurred. + Type `Period` (represented as `dict` in JSON). """ + + self.valueAttachment = None + """ Data to be provided. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Data to be provided. + Type `bool`. """ + + self.valueQuantity = None + """ Data to be provided. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Data to be provided. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueString = None + """ Data to be provided. + Type `str`. """ + + super(ExplanationOfBenefitSupportingInfo, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitSupportingInfo, self).elementProperties() + js.extend([ + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("reason", "reason", coding.Coding, False, None, False), + ("sequence", "sequence", int, False, None, True), + ("timingDate", "timingDate", fhirdate.FHIRDate, False, "timing", False), + ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ]) + return js + + +class ExplanationOfBenefitTotal(backboneelement.BackboneElement): + """ Adjudication totals. + + Categorized monetary totals for the adjudication. + """ + + resource_type = "ExplanationOfBenefitTotal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Financial total for the category. + Type `Money` (represented as `dict` in JSON). """ + + self.category = None + """ Type of adjudication information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ExplanationOfBenefitTotal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ExplanationOfBenefitTotal, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, True), + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + import sys try: from . import address diff --git a/fhirclient/models/explanationofbenefit_tests.py b/fhirclient/models/explanationofbenefit_tests.py index 18d943130..b45c18c5e 100644 --- a/fhirclient/models/explanationofbenefit_tests.py +++ b/fhirclient/models/explanationofbenefit_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -39,41 +39,146 @@ def implExplanationOfBenefit1(self, inst): self.assertEqual(inst.id, "EB3500") self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/explanationofbenefit") self.assertEqual(inst.identifier[0].value, "987654321") - self.assertEqual(inst.item[0].adjudication[0].amount.code, "USD") - self.assertEqual(inst.item[0].adjudication[0].amount.system, "urn:iso:std:iso:4217") + self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.item[0].adjudication[0].amount.currency, "USD") self.assertEqual(inst.item[0].adjudication[0].amount.value, 120.0) self.assertEqual(inst.item[0].adjudication[0].category.coding[0].code, "eligible") self.assertEqual(inst.item[0].adjudication[1].category.coding[0].code, "eligpercent") self.assertEqual(inst.item[0].adjudication[1].value, 0.8) - self.assertEqual(inst.item[0].adjudication[2].amount.code, "USD") - self.assertEqual(inst.item[0].adjudication[2].amount.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].adjudication[2].amount.currency, "USD") self.assertEqual(inst.item[0].adjudication[2].amount.value, 96.0) self.assertEqual(inst.item[0].adjudication[2].category.coding[0].code, "benefit") - self.assertEqual(inst.item[0].careTeamLinkId[0], 1) - self.assertEqual(inst.item[0].net.code, "USD") - self.assertEqual(inst.item[0].net.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].careTeamSequence[0], 1) + self.assertEqual(inst.item[0].net.currency, "USD") self.assertEqual(inst.item[0].net.value, 135.57) + self.assertEqual(inst.item[0].productOrService.coding[0].code, "1205") + self.assertEqual(inst.item[0].productOrService.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-USCLS") self.assertEqual(inst.item[0].sequence, 1) - self.assertEqual(inst.item[0].service.coding[0].code, "1200") - self.assertEqual(inst.item[0].service.coding[0].system, "http://hl7.org/fhir/service-uscls") self.assertEqual(inst.item[0].servicedDate.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.item[0].servicedDate.as_json(), "2014-08-16") - self.assertEqual(inst.item[0].unitPrice.code, "USD") - self.assertEqual(inst.item[0].unitPrice.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.item[0].unitPrice.currency, "USD") self.assertEqual(inst.item[0].unitPrice.value, 135.57) - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") + self.assertEqual(inst.item[1].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[1].adjudication[0].amount.value, 180.0) + self.assertEqual(inst.item[1].adjudication[0].category.coding[0].code, "benefit") + self.assertEqual(inst.item[1].careTeamSequence[0], 1) + self.assertEqual(inst.item[1].detail[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[1].detail[0].adjudication[0].amount.value, 180.0) + self.assertEqual(inst.item[1].detail[0].adjudication[0].category.coding[0].code, "benefit") + self.assertEqual(inst.item[1].detail[0].net.currency, "USD") + self.assertEqual(inst.item[1].detail[0].net.value, 200.0) + self.assertEqual(inst.item[1].detail[0].productOrService.coding[0].code, "group") + self.assertEqual(inst.item[1].detail[0].sequence, 1) + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[0].amount.currency, "USD") + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[0].amount.value, 200.0) + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[0].category.coding[0].code, "eligible") + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[1].category.coding[0].code, "eligpercent") + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[1].value, 0.9) + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[2].amount.currency, "USD") + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[2].amount.value, 180.0) + self.assertEqual(inst.item[1].detail[0].subDetail[0].adjudication[2].category.coding[0].code, "benefit") + self.assertEqual(inst.item[1].detail[0].subDetail[0].net.currency, "USD") + self.assertEqual(inst.item[1].detail[0].subDetail[0].net.value, 200.0) + self.assertEqual(inst.item[1].detail[0].subDetail[0].productOrService.coding[0].code, "1205") + self.assertEqual(inst.item[1].detail[0].subDetail[0].productOrService.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-USCLS") + self.assertEqual(inst.item[1].detail[0].subDetail[0].sequence, 1) + self.assertEqual(inst.item[1].detail[0].subDetail[0].unitPrice.currency, "USD") + self.assertEqual(inst.item[1].detail[0].subDetail[0].unitPrice.value, 200.0) + self.assertEqual(inst.item[1].net.currency, "USD") + self.assertEqual(inst.item[1].net.value, 200.0) + self.assertEqual(inst.item[1].productOrService.coding[0].code, "group") + self.assertEqual(inst.item[1].sequence, 2) + self.assertEqual(inst.item[1].servicedDate.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.item[1].servicedDate.as_json(), "2014-08-16") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") self.assertEqual(inst.payee.type.coding[0].code, "provider") - self.assertEqual(inst.payee.type.coding[0].system, "http://hl7.org/fhir/payeetype") + self.assertEqual(inst.payee.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/payeetype") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
A human-readable rendering of the ExplanationOfBenefit
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.totalBenefit.code, "USD") - self.assertEqual(inst.totalBenefit.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.totalBenefit.value, 96.0) - self.assertEqual(inst.totalCost.code, "USD") - self.assertEqual(inst.totalCost.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.totalCost.value, 135.57) + self.assertEqual(inst.total[0].amount.currency, "USD") + self.assertEqual(inst.total[0].amount.value, 135.57) + self.assertEqual(inst.total[0].category.coding[0].code, "submitted") + self.assertEqual(inst.total[1].amount.currency, "USD") + self.assertEqual(inst.total[1].amount.value, 96.0) + self.assertEqual(inst.total[1].category.coding[0].code, "benefit") self.assertEqual(inst.type.coding[0].code, "oral") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/ex-claimtype") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") + + def testExplanationOfBenefit2(self): + inst = self.instantiate_from("explanationofbenefit-example-2.json") + self.assertIsNotNone(inst, "Must have instantiated a ExplanationOfBenefit instance") + self.implExplanationOfBenefit2(inst) + + js = inst.as_json() + self.assertEqual("ExplanationOfBenefit", js["resourceType"]) + inst2 = explanationofbenefit.ExplanationOfBenefit(js) + self.implExplanationOfBenefit2(inst2) + + def implExplanationOfBenefit2(self, inst): + self.assertEqual(inst.accident.date.date, FHIRDate("2014-02-14").date) + self.assertEqual(inst.accident.date.as_json(), "2014-02-14") + self.assertEqual(inst.accident.type.coding[0].code, "SPT") + self.assertEqual(inst.accident.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") + self.assertEqual(inst.billablePeriod.end.date, FHIRDate("2014-03-01").date) + self.assertEqual(inst.billablePeriod.end.as_json(), "2014-03-01") + self.assertEqual(inst.billablePeriod.start.date, FHIRDate("2014-02-01").date) + self.assertEqual(inst.billablePeriod.start.as_json(), "2014-02-01") + self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.created.as_json(), "2014-08-16") + self.assertEqual(inst.disposition, "Could not process.") + self.assertEqual(inst.formCode.coding[0].code, "2") + self.assertEqual(inst.formCode.coding[0].system, "http://terminology.hl7.org/CodeSystem/forms-codes") + self.assertEqual(inst.id, "EB3501") + self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/explanationofbenefit") + self.assertEqual(inst.identifier[0].value, "error-1") + self.assertTrue(inst.insurance[0].focal) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "error") + self.assertEqual(inst.precedence, 2) + self.assertEqual(inst.procedure[0].date.date, FHIRDate("2014-02-14").date) + self.assertEqual(inst.procedure[0].date.as_json(), "2014-02-14") + self.assertEqual(inst.procedure[0].procedureCodeableConcept.coding[0].code, "123001") + self.assertEqual(inst.procedure[0].procedureCodeableConcept.coding[0].system, "http://hl7.org/fhir/sid/ex-icd-10-procedures") + self.assertEqual(inst.procedure[0].sequence, 1) + self.assertEqual(inst.processNote[0].language.coding[0].code, "en-CA") + self.assertEqual(inst.processNote[0].language.coding[0].system, "urn:ietf:bcp:47") + self.assertEqual(inst.processNote[0].number, 1) + self.assertEqual(inst.processNote[0].text, "Invalid claim") + self.assertEqual(inst.processNote[0].type, "display") + self.assertEqual(inst.related[0].reference.system, "http://www.BenefitsInc.com/case-number") + self.assertEqual(inst.related[0].reference.value, "23-56Tu-XX-47-20150M14") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.subType.coding[0].code, "emergency") + self.assertEqual(inst.subType.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-claimsubtype") + self.assertEqual(inst.supportingInfo[0].category.coding[0].code, "employmentimpacted") + self.assertEqual(inst.supportingInfo[0].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/claiminformationcategory") + self.assertEqual(inst.supportingInfo[0].sequence, 1) + self.assertEqual(inst.supportingInfo[0].timingPeriod.end.date, FHIRDate("2014-02-28").date) + self.assertEqual(inst.supportingInfo[0].timingPeriod.end.as_json(), "2014-02-28") + self.assertEqual(inst.supportingInfo[0].timingPeriod.start.date, FHIRDate("2014-02-14").date) + self.assertEqual(inst.supportingInfo[0].timingPeriod.start.as_json(), "2014-02-14") + self.assertEqual(inst.supportingInfo[1].category.coding[0].code, "hospitalized") + self.assertEqual(inst.supportingInfo[1].category.coding[0].system, "http://terminology.hl7.org/CodeSystem/claiminformationcategory") + self.assertEqual(inst.supportingInfo[1].sequence, 2) + self.assertEqual(inst.supportingInfo[1].timingPeriod.end.date, FHIRDate("2014-02-16").date) + self.assertEqual(inst.supportingInfo[1].timingPeriod.end.as_json(), "2014-02-16") + self.assertEqual(inst.supportingInfo[1].timingPeriod.start.date, FHIRDate("2014-02-14").date) + self.assertEqual(inst.supportingInfo[1].timingPeriod.start.as_json(), "2014-02-14") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.total[0].amount.currency, "USD") + self.assertEqual(inst.total[0].amount.value, 2478.57) + self.assertEqual(inst.total[0].category.coding[0].code, "submitted") + self.assertEqual(inst.total[1].amount.currency, "USD") + self.assertEqual(inst.total[1].amount.value, 0.0) + self.assertEqual(inst.total[1].category.coding[0].code, "benefit") + self.assertEqual(inst.type.coding[0].code, "oral") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/claim-type") + self.assertEqual(inst.use, "claim") diff --git a/fhirclient/models/expression.py b/fhirclient/models/expression.py new file mode 100644 index 000000000..119206532 --- /dev/null +++ b/fhirclient/models/expression.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Expression) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import element + +class Expression(element.Element): + """ An expression that can be used to generate a value. + + A expression that is evaluated in a specified context and returns a value. + The context of use of the expression must specify the context in which the + expression is evaluated, and how the result of the expression is used. + """ + + resource_type = "Expression" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Natural language description of the condition. + Type `str`. """ + + self.expression = None + """ Expression in specified language. + Type `str`. """ + + self.language = None + """ text/cql | text/fhirpath | application/x-fhir-query | etc.. + Type `str`. """ + + self.name = None + """ Short name assigned to expression for reuse. + Type `str`. """ + + self.reference = None + """ Where the expression is found. + Type `str`. """ + + super(Expression, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Expression, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("expression", "expression", str, False, None, False), + ("language", "language", str, False, None, True), + ("name", "name", str, False, None, False), + ("reference", "reference", str, False, None, False), + ]) + return js + + diff --git a/fhirclient/models/extension.py b/fhirclient/models/extension.py index 5b9bc83a1..2dff366d8 100644 --- a/fhirclient/models/extension.py +++ b/fhirclient/models/extension.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Extension) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Extension) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -51,6 +51,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `bool`. """ + self.valueCanonical = None + """ Value of extension. + Type `str`. """ + self.valueCode = None """ Value of extension. Type `str`. """ @@ -63,14 +67,26 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `Coding` (represented as `dict` in JSON). """ + self.valueContactDetail = None + """ Value of extension. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.valueContactPoint = None """ Value of extension. Type `ContactPoint` (represented as `dict` in JSON). """ + self.valueContributor = None + """ Value of extension. + Type `Contributor` (represented as `dict` in JSON). """ + self.valueCount = None """ Value of extension. Type `Count` (represented as `dict` in JSON). """ + self.valueDataRequirement = None + """ Value of extension. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.valueDate = None """ Value of extension. Type `FHIRDate` (represented as `str` in JSON). """ @@ -87,10 +103,18 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `Distance` (represented as `dict` in JSON). """ + self.valueDosage = None + """ Value of extension. + Type `Dosage` (represented as `dict` in JSON). """ + self.valueDuration = None """ Value of extension. Type `Duration` (represented as `dict` in JSON). """ + self.valueExpression = None + """ Value of extension. + Type `Expression` (represented as `dict` in JSON). """ + self.valueHumanName = None """ Value of extension. Type `HumanName` (represented as `dict` in JSON). """ @@ -115,10 +139,6 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `str`. """ - self.valueMeta = None - """ Value of extension. - Type `Meta` (represented as `dict` in JSON). """ - self.valueMoney = None """ Value of extension. Type `Money` (represented as `dict` in JSON). """ @@ -127,6 +147,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `str`. """ + self.valueParameterDefinition = None + """ Value of extension. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.valuePeriod = None """ Value of extension. Type `Period` (represented as `dict` in JSON). """ @@ -151,6 +175,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `FHIRReference` (represented as `dict` in JSON). """ + self.valueRelatedArtifact = None + """ Value of extension. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.valueSampledData = None """ Value of extension. Type `SampledData` (represented as `dict` in JSON). """ @@ -171,6 +199,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `Timing` (represented as `dict` in JSON). """ + self.valueTriggerDefinition = None + """ Value of extension. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.valueUnsignedInt = None """ Value of extension. Type `int`. """ @@ -179,6 +211,18 @@ def __init__(self, jsondict=None, strict=True): """ Value of extension. Type `str`. """ + self.valueUrl = None + """ Value of extension. + Type `str`. """ + + self.valueUsageContext = None + """ Value of extension. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.valueUuid = None + """ Value of extension. + Type `str`. """ + super(Extension, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -191,38 +235,49 @@ def elementProperties(self): ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), ("valueBase64Binary", "valueBase64Binary", str, False, "value", False), ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCanonical", "valueCanonical", str, False, "value", False), ("valueCode", "valueCode", str, False, "value", False), ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueContactDetail", "valueContactDetail", contactdetail.ContactDetail, False, "value", False), ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", False), + ("valueContributor", "valueContributor", contributor.Contributor, False, "value", False), ("valueCount", "valueCount", count.Count, False, "value", False), + ("valueDataRequirement", "valueDataRequirement", datarequirement.DataRequirement, False, "value", False), ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), ("valueDecimal", "valueDecimal", float, False, "value", False), ("valueDistance", "valueDistance", distance.Distance, False, "value", False), + ("valueDosage", "valueDosage", dosage.Dosage, False, "value", False), ("valueDuration", "valueDuration", duration.Duration, False, "value", False), + ("valueExpression", "valueExpression", expression.Expression, False, "value", False), ("valueHumanName", "valueHumanName", humanname.HumanName, False, "value", False), ("valueId", "valueId", str, False, "value", False), ("valueIdentifier", "valueIdentifier", identifier.Identifier, False, "value", False), ("valueInstant", "valueInstant", fhirdate.FHIRDate, False, "value", False), ("valueInteger", "valueInteger", int, False, "value", False), ("valueMarkdown", "valueMarkdown", str, False, "value", False), - ("valueMeta", "valueMeta", meta.Meta, False, "value", False), ("valueMoney", "valueMoney", money.Money, False, "value", False), ("valueOid", "valueOid", str, False, "value", False), + ("valueParameterDefinition", "valueParameterDefinition", parameterdefinition.ParameterDefinition, False, "value", False), ("valuePeriod", "valuePeriod", period.Period, False, "value", False), ("valuePositiveInt", "valuePositiveInt", int, False, "value", False), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), ("valueRange", "valueRange", range.Range, False, "value", False), ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), + ("valueRelatedArtifact", "valueRelatedArtifact", relatedartifact.RelatedArtifact, False, "value", False), ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), ("valueSignature", "valueSignature", signature.Signature, False, "value", False), ("valueString", "valueString", str, False, "value", False), ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), ("valueTiming", "valueTiming", timing.Timing, False, "value", False), + ("valueTriggerDefinition", "valueTriggerDefinition", triggerdefinition.TriggerDefinition, False, "value", False), ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", False), ("valueUri", "valueUri", str, False, "value", False), + ("valueUrl", "valueUrl", str, False, "value", False), + ("valueUsageContext", "valueUsageContext", usagecontext.UsageContext, False, "value", False), + ("valueUuid", "valueUuid", str, False, "value", False), ]) return js @@ -252,22 +307,42 @@ def elementProperties(self): from . import coding except ImportError: coding = sys.modules[__package__ + '.coding'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] try: from . import contactpoint except ImportError: contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import contributor +except ImportError: + contributor = sys.modules[__package__ + '.contributor'] try: from . import count except ImportError: count = sys.modules[__package__ + '.count'] +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] try: from . import distance except ImportError: distance = sys.modules[__package__ + '.distance'] +try: + from . import dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] try: from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: @@ -284,14 +359,14 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] -try: - from . import meta -except ImportError: - meta = sys.modules[__package__ + '.meta'] try: from . import money except ImportError: money = sys.modules[__package__ + '.money'] +try: + from . import parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] try: from . import period except ImportError: @@ -308,6 +383,10 @@ def elementProperties(self): from . import ratio except ImportError: ratio = sys.modules[__package__ + '.ratio'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] try: from . import sampleddata except ImportError: @@ -320,3 +399,11 @@ def elementProperties(self): from . import timing except ImportError: timing = sys.modules[__package__ + '.timing'] +try: + from . import triggerdefinition +except ImportError: + triggerdefinition = sys.modules[__package__ + '.triggerdefinition'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/familymemberhistory.py b/fhirclient/models/familymemberhistory.py index 1913d8938..176c089f7 100644 --- a/fhirclient/models/familymemberhistory.py +++ b/fhirclient/models/familymemberhistory.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,8 +10,8 @@ class FamilyMemberHistory(domainresource.DomainResource): """ Information about patient's relatives, relevant for patient. - Significant health events and conditions for a person related to the - patient relevant in the context of care for the patient. + Significant health conditions for a person related to the patient relevant + in the context of care for the patient. """ resource_type = "FamilyMemberHistory" @@ -52,8 +52,12 @@ def __init__(self, jsondict=None, strict=True): """ Condition that the related person had. List of `FamilyMemberHistoryCondition` items (represented as `dict` in JSON). """ + self.dataAbsentReason = None + """ subject-unknown | withheld | unable-to-obtain | deferred. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.date = None - """ When history was captured/updated. + """ When history was recorded or last updated. Type `FHIRDate` (represented as `str` in JSON). """ self.deceasedAge = None @@ -76,41 +80,33 @@ def __init__(self, jsondict=None, strict=True): """ Dead? How old/when?. Type `str`. """ - self.definition = None - """ Instantiates protocol or definition. - List of `FHIRReference` items referencing `PlanDefinition, Questionnaire` (represented as `dict` in JSON). """ - self.estimatedAge = None """ Age is estimated?. Type `bool`. """ - self.gender = None - """ male | female | other | unknown. - Type `str`. """ - self.identifier = None """ External Id(s) for this record. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + self.name = None """ The family member described. Type `str`. """ - self.notDone = None - """ The taking of a family member's history did not occur. - Type `bool`. """ - - self.notDoneReason = None - """ subject-unknown | withheld | unable-to-obtain | deferred. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.note = None """ General note about related person. List of `Annotation` items (represented as `dict` in JSON). """ self.patient = None """ Patient history is about. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.reasonCode = None """ Why was family member history performed?. @@ -118,12 +114,16 @@ def __init__(self, jsondict=None, strict=True): self.reasonReference = None """ Why was family member history performed?. - List of `FHIRReference` items referencing `Condition, Observation, AllergyIntolerance, QuestionnaireResponse` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.relationship = None """ Relationship to the subject. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.sex = None + """ male | female | other | unknown. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.status = None """ partial | completed | entered-in-error | health-unknown. Type `str`. """ @@ -140,24 +140,24 @@ def elementProperties(self): ("bornPeriod", "bornPeriod", period.Period, False, "born", False), ("bornString", "bornString", str, False, "born", False), ("condition", "condition", FamilyMemberHistoryCondition, True, None, False), + ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("deceasedAge", "deceasedAge", age.Age, False, "deceased", False), ("deceasedBoolean", "deceasedBoolean", bool, False, "deceased", False), ("deceasedDate", "deceasedDate", fhirdate.FHIRDate, False, "deceased", False), ("deceasedRange", "deceasedRange", range.Range, False, "deceased", False), ("deceasedString", "deceasedString", str, False, "deceased", False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), ("estimatedAge", "estimatedAge", bool, False, None, False), - ("gender", "gender", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), ("name", "name", str, False, None, False), - ("notDone", "notDone", bool, False, None, False), - ("notDoneReason", "notDoneReason", codeableconcept.CodeableConcept, False, None, False), ("note", "note", annotation.Annotation, True, None, False), ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, True), + ("sex", "sex", codeableconcept.CodeableConcept, False, None, False), ("status", "status", str, False, None, True), ]) return js @@ -188,6 +188,10 @@ def __init__(self, jsondict=None, strict=True): """ Condition suffered by relation. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.contributedToDeath = None + """ Whether the condition contributed to the cause of death. + Type `bool`. """ + self.note = None """ Extra information about condition. List of `Annotation` items (represented as `dict` in JSON). """ @@ -218,6 +222,7 @@ def elementProperties(self): js = super(FamilyMemberHistoryCondition, self).elementProperties() js.extend([ ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("contributedToDeath", "contributedToDeath", bool, False, None, False), ("note", "note", annotation.Annotation, True, None, False), ("onsetAge", "onsetAge", age.Age, False, "onset", False), ("onsetPeriod", "onsetPeriod", period.Period, False, "onset", False), diff --git a/fhirclient/models/familymemberhistory_tests.py b/fhirclient/models/familymemberhistory_tests.py index fd3521c5a..5345cb4e7 100644 --- a/fhirclient/models/familymemberhistory_tests.py +++ b/fhirclient/models/familymemberhistory_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return familymemberhistory.FamilyMemberHistory(js) def testFamilyMemberHistory1(self): - inst = self.instantiate_from("familymemberhistory-example-mother.json") + inst = self.instantiate_from("familymemberhistory-example.json") self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") self.implFamilyMemberHistory1(inst) @@ -32,24 +32,36 @@ def testFamilyMemberHistory1(self): self.implFamilyMemberHistory1(inst2) def implFamilyMemberHistory1(self, inst): - self.assertEqual(inst.condition[0].code.coding[0].code, "371041009") - self.assertEqual(inst.condition[0].code.coding[0].display, "Embolic Stroke") + self.assertEqual(inst.condition[0].code.coding[0].code, "315619001") + self.assertEqual(inst.condition[0].code.coding[0].display, "Myocardial Infarction") self.assertEqual(inst.condition[0].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.condition[0].code.text, "Stroke") + self.assertEqual(inst.condition[0].code.text, "Heart Attack") + self.assertTrue(inst.condition[0].contributedToDeath) + self.assertEqual(inst.condition[0].note[0].text, "Was fishing at the time. At least he went doing someting he loved.") self.assertEqual(inst.condition[0].onsetAge.code, "a") self.assertEqual(inst.condition[0].onsetAge.system, "http://unitsofmeasure.org") self.assertEqual(inst.condition[0].onsetAge.unit, "yr") - self.assertEqual(inst.condition[0].onsetAge.value, 56) - self.assertEqual(inst.id, "mother") - self.assertEqual(inst.relationship.coding[0].code, "MTH") - self.assertEqual(inst.relationship.coding[0].display, "mother") - self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.condition[0].onsetAge.value, 74) + self.assertEqual(inst.date.date, FHIRDate("2011-03-18").date) + self.assertEqual(inst.date.as_json(), "2011-03-18") + self.assertEqual(inst.id, "father") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.instantiatesUri[0], "http://example.org/family-member-history-questionnaire") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.relationship.coding[0].code, "FTH") + self.assertEqual(inst.relationship.coding[0].display, "father") + self.assertEqual(inst.relationship.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") + self.assertEqual(inst.sex.coding[0].code, "male") + self.assertEqual(inst.sex.coding[0].display, "Male") + self.assertEqual(inst.sex.coding[0].system, "http://hl7.org/fhir/administrative-gender") self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.div, "
Mother died of a stroke aged 56
") + self.assertEqual(inst.text.div, "
Father died of a heart attack aged 74
") self.assertEqual(inst.text.status, "generated") def testFamilyMemberHistory2(self): - inst = self.instantiate_from("familymemberhistory-example.json") + inst = self.instantiate_from("familymemberhistory-example-mother.json") self.assertIsNotNone(inst, "Must have instantiated a FamilyMemberHistory instance") self.implFamilyMemberHistory2(inst) @@ -59,25 +71,22 @@ def testFamilyMemberHistory2(self): self.implFamilyMemberHistory2(inst2) def implFamilyMemberHistory2(self, inst): - self.assertEqual(inst.condition[0].code.coding[0].code, "315619001") - self.assertEqual(inst.condition[0].code.coding[0].display, "Myocardial Infarction") + self.assertEqual(inst.condition[0].code.coding[0].code, "371041009") + self.assertEqual(inst.condition[0].code.coding[0].display, "Embolic Stroke") self.assertEqual(inst.condition[0].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.condition[0].code.text, "Heart Attack") - self.assertEqual(inst.condition[0].note[0].text, "Was fishing at the time. At least he went doing someting he loved.") + self.assertEqual(inst.condition[0].code.text, "Stroke") self.assertEqual(inst.condition[0].onsetAge.code, "a") self.assertEqual(inst.condition[0].onsetAge.system, "http://unitsofmeasure.org") self.assertEqual(inst.condition[0].onsetAge.unit, "yr") - self.assertEqual(inst.condition[0].onsetAge.value, 74) - self.assertEqual(inst.date.date, FHIRDate("2011-03-18").date) - self.assertEqual(inst.date.as_json(), "2011-03-18") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "father") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertFalse(inst.notDone) - self.assertEqual(inst.relationship.coding[0].code, "FTH") - self.assertEqual(inst.relationship.coding[0].display, "father") - self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.condition[0].onsetAge.value, 56) + self.assertEqual(inst.id, "mother") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.relationship.coding[0].code, "MTH") + self.assertEqual(inst.relationship.coding[0].display, "mother") + self.assertEqual(inst.relationship.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.div, "
Father died of a heart attack aged 74
") + self.assertEqual(inst.text.div, "
Mother died of a stroke aged 56
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/fhirelementfactory.py b/fhirclient/models/fhirelementfactory.py index 0fa2355aa..0016e3eeb 100644 --- a/fhirclient/models/fhirelementfactory.py +++ b/fhirclient/models/fhirelementfactory.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. class FHIRElementFactory(object): @@ -44,6 +44,9 @@ def instantiate(cls, resource_type, jsondict): if "AdverseEventSuspectEntity" == resource_type: from . import adverseevent return adverseevent.AdverseEventSuspectEntity(jsondict) + if "AdverseEventSuspectEntityCausality" == resource_type: + from . import adverseevent + return adverseevent.AdverseEventSuspectEntityCausality(jsondict) if "Age" == resource_type: from . import age return age.Age(jsondict) @@ -95,9 +98,24 @@ def instantiate(cls, resource_type, jsondict): if "Binary" == resource_type: from . import binary return binary.Binary(jsondict) - if "BodySite" == resource_type: - from . import bodysite - return bodysite.BodySite(jsondict) + if "BiologicallyDerivedProduct" == resource_type: + from . import biologicallyderivedproduct + return biologicallyderivedproduct.BiologicallyDerivedProduct(jsondict) + if "BiologicallyDerivedProductCollection" == resource_type: + from . import biologicallyderivedproduct + return biologicallyderivedproduct.BiologicallyDerivedProductCollection(jsondict) + if "BiologicallyDerivedProductManipulation" == resource_type: + from . import biologicallyderivedproduct + return biologicallyderivedproduct.BiologicallyDerivedProductManipulation(jsondict) + if "BiologicallyDerivedProductProcessing" == resource_type: + from . import biologicallyderivedproduct + return biologicallyderivedproduct.BiologicallyDerivedProductProcessing(jsondict) + if "BiologicallyDerivedProductStorage" == resource_type: + from . import biologicallyderivedproduct + return biologicallyderivedproduct.BiologicallyDerivedProductStorage(jsondict) + if "BodyStructure" == resource_type: + from . import bodystructure + return bodystructure.BodyStructure(jsondict) if "Bundle" == resource_type: from . import bundle return bundle.Bundle(jsondict) @@ -131,9 +149,6 @@ def instantiate(cls, resource_type, jsondict): if "CapabilityStatementMessagingEndpoint" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementMessagingEndpoint(jsondict) - if "CapabilityStatementMessagingEvent" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementMessagingEvent(jsondict) if "CapabilityStatementMessagingSupportedMessage" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementMessagingSupportedMessage(jsondict) @@ -143,24 +158,21 @@ def instantiate(cls, resource_type, jsondict): if "CapabilityStatementRestInteraction" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementRestInteraction(jsondict) - if "CapabilityStatementRestOperation" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementRestOperation(jsondict) if "CapabilityStatementRestResource" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementRestResource(jsondict) if "CapabilityStatementRestResourceInteraction" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementRestResourceInteraction(jsondict) + if "CapabilityStatementRestResourceOperation" == resource_type: + from . import capabilitystatement + return capabilitystatement.CapabilityStatementRestResourceOperation(jsondict) if "CapabilityStatementRestResourceSearchParam" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementRestResourceSearchParam(jsondict) if "CapabilityStatementRestSecurity" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementRestSecurity(jsondict) - if "CapabilityStatementRestSecurityCertificate" == resource_type: - from . import capabilitystatement - return capabilitystatement.CapabilityStatementRestSecurityCertificate(jsondict) if "CapabilityStatementSoftware" == resource_type: from . import capabilitystatement return capabilitystatement.CapabilityStatementSoftware(jsondict) @@ -179,12 +191,30 @@ def instantiate(cls, resource_type, jsondict): if "CareTeamParticipant" == resource_type: from . import careteam return careteam.CareTeamParticipant(jsondict) + if "CatalogEntry" == resource_type: + from . import catalogentry + return catalogentry.CatalogEntry(jsondict) + if "CatalogEntryRelatedEntry" == resource_type: + from . import catalogentry + return catalogentry.CatalogEntryRelatedEntry(jsondict) if "ChargeItem" == resource_type: from . import chargeitem return chargeitem.ChargeItem(jsondict) - if "ChargeItemParticipant" == resource_type: + if "ChargeItemDefinition" == resource_type: + from . import chargeitemdefinition + return chargeitemdefinition.ChargeItemDefinition(jsondict) + if "ChargeItemDefinitionApplicability" == resource_type: + from . import chargeitemdefinition + return chargeitemdefinition.ChargeItemDefinitionApplicability(jsondict) + if "ChargeItemDefinitionPropertyGroup" == resource_type: + from . import chargeitemdefinition + return chargeitemdefinition.ChargeItemDefinitionPropertyGroup(jsondict) + if "ChargeItemDefinitionPropertyGroupPriceComponent" == resource_type: + from . import chargeitemdefinition + return chargeitemdefinition.ChargeItemDefinitionPropertyGroupPriceComponent(jsondict) + if "ChargeItemPerformer" == resource_type: from . import chargeitem - return chargeitem.ChargeItemParticipant(jsondict) + return chargeitem.ChargeItemPerformer(jsondict) if "Claim" == resource_type: from . import claim return claim.Claim(jsondict) @@ -197,9 +227,6 @@ def instantiate(cls, resource_type, jsondict): if "ClaimDiagnosis" == resource_type: from . import claim return claim.ClaimDiagnosis(jsondict) - if "ClaimInformation" == resource_type: - from . import claim - return claim.ClaimInformation(jsondict) if "ClaimInsurance" == resource_type: from . import claim return claim.ClaimInsurance(jsondict) @@ -230,6 +257,9 @@ def instantiate(cls, resource_type, jsondict): if "ClaimResponseAddItemDetail" == resource_type: from . import claimresponse return claimresponse.ClaimResponseAddItemDetail(jsondict) + if "ClaimResponseAddItemDetailSubDetail" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseAddItemDetailSubDetail(jsondict) if "ClaimResponseError" == resource_type: from . import claimresponse return claimresponse.ClaimResponseError(jsondict) @@ -254,6 +284,12 @@ def instantiate(cls, resource_type, jsondict): if "ClaimResponseProcessNote" == resource_type: from . import claimresponse return claimresponse.ClaimResponseProcessNote(jsondict) + if "ClaimResponseTotal" == resource_type: + from . import claimresponse + return claimresponse.ClaimResponseTotal(jsondict) + if "ClaimSupportingInfo" == resource_type: + from . import claim + return claim.ClaimSupportingInfo(jsondict) if "ClinicalImpression" == resource_type: from . import clinicalimpression return clinicalimpression.ClinicalImpression(jsondict) @@ -299,9 +335,6 @@ def instantiate(cls, resource_type, jsondict): if "CommunicationRequestPayload" == resource_type: from . import communicationrequest return communicationrequest.CommunicationRequestPayload(jsondict) - if "CommunicationRequestRequester" == resource_type: - from . import communicationrequest - return communicationrequest.CommunicationRequestRequester(jsondict) if "CompartmentDefinition" == resource_type: from . import compartmentdefinition return compartmentdefinition.CompartmentDefinition(jsondict) @@ -353,24 +386,21 @@ def instantiate(cls, resource_type, jsondict): if "Consent" == resource_type: from . import consent return consent.Consent(jsondict) - if "ConsentActor" == resource_type: + if "ConsentPolicy" == resource_type: from . import consent - return consent.ConsentActor(jsondict) - if "ConsentData" == resource_type: + return consent.ConsentPolicy(jsondict) + if "ConsentProvision" == resource_type: from . import consent - return consent.ConsentData(jsondict) - if "ConsentExcept" == resource_type: + return consent.ConsentProvision(jsondict) + if "ConsentProvisionActor" == resource_type: from . import consent - return consent.ConsentExcept(jsondict) - if "ConsentExceptActor" == resource_type: + return consent.ConsentProvisionActor(jsondict) + if "ConsentProvisionData" == resource_type: from . import consent - return consent.ConsentExceptActor(jsondict) - if "ConsentExceptData" == resource_type: + return consent.ConsentProvisionData(jsondict) + if "ConsentVerification" == resource_type: from . import consent - return consent.ConsentExceptData(jsondict) - if "ConsentPolicy" == resource_type: - from . import consent - return consent.ConsentPolicy(jsondict) + return consent.ConsentVerification(jsondict) if "ContactDetail" == resource_type: from . import contactdetail return contactdetail.ContactDetail(jsondict) @@ -380,9 +410,9 @@ def instantiate(cls, resource_type, jsondict): if "Contract" == resource_type: from . import contract return contract.Contract(jsondict) - if "ContractAgent" == resource_type: + if "ContractContentDefinition" == resource_type: from . import contract - return contract.ContractAgent(jsondict) + return contract.ContractContentDefinition(jsondict) if "ContractFriendly" == resource_type: from . import contract return contract.ContractFriendly(jsondict) @@ -398,15 +428,33 @@ def instantiate(cls, resource_type, jsondict): if "ContractTerm" == resource_type: from . import contract return contract.ContractTerm(jsondict) - if "ContractTermAgent" == resource_type: + if "ContractTermAction" == resource_type: + from . import contract + return contract.ContractTermAction(jsondict) + if "ContractTermActionSubject" == resource_type: + from . import contract + return contract.ContractTermActionSubject(jsondict) + if "ContractTermAsset" == resource_type: + from . import contract + return contract.ContractTermAsset(jsondict) + if "ContractTermAssetContext" == resource_type: + from . import contract + return contract.ContractTermAssetContext(jsondict) + if "ContractTermAssetValuedItem" == resource_type: + from . import contract + return contract.ContractTermAssetValuedItem(jsondict) + if "ContractTermOffer" == resource_type: from . import contract - return contract.ContractTermAgent(jsondict) - if "ContractTermValuedItem" == resource_type: + return contract.ContractTermOffer(jsondict) + if "ContractTermOfferAnswer" == resource_type: from . import contract - return contract.ContractTermValuedItem(jsondict) - if "ContractValuedItem" == resource_type: + return contract.ContractTermOfferAnswer(jsondict) + if "ContractTermOfferParty" == resource_type: from . import contract - return contract.ContractValuedItem(jsondict) + return contract.ContractTermOfferParty(jsondict) + if "ContractTermSecurityLabel" == resource_type: + from . import contract + return contract.ContractTermSecurityLabel(jsondict) if "Contributor" == resource_type: from . import contributor return contributor.Contributor(jsondict) @@ -416,15 +464,45 @@ def instantiate(cls, resource_type, jsondict): if "Coverage" == resource_type: from . import coverage return coverage.Coverage(jsondict) - if "CoverageGrouping" == resource_type: + if "CoverageClass" == resource_type: + from . import coverage + return coverage.CoverageClass(jsondict) + if "CoverageCostToBeneficiary" == resource_type: + from . import coverage + return coverage.CoverageCostToBeneficiary(jsondict) + if "CoverageCostToBeneficiaryException" == resource_type: from . import coverage - return coverage.CoverageGrouping(jsondict) - if "DataElement" == resource_type: - from . import dataelement - return dataelement.DataElement(jsondict) - if "DataElementMapping" == resource_type: - from . import dataelement - return dataelement.DataElementMapping(jsondict) + return coverage.CoverageCostToBeneficiaryException(jsondict) + if "CoverageEligibilityRequest" == resource_type: + from . import coverageeligibilityrequest + return coverageeligibilityrequest.CoverageEligibilityRequest(jsondict) + if "CoverageEligibilityRequestInsurance" == resource_type: + from . import coverageeligibilityrequest + return coverageeligibilityrequest.CoverageEligibilityRequestInsurance(jsondict) + if "CoverageEligibilityRequestItem" == resource_type: + from . import coverageeligibilityrequest + return coverageeligibilityrequest.CoverageEligibilityRequestItem(jsondict) + if "CoverageEligibilityRequestItemDiagnosis" == resource_type: + from . import coverageeligibilityrequest + return coverageeligibilityrequest.CoverageEligibilityRequestItemDiagnosis(jsondict) + if "CoverageEligibilityRequestSupportingInfo" == resource_type: + from . import coverageeligibilityrequest + return coverageeligibilityrequest.CoverageEligibilityRequestSupportingInfo(jsondict) + if "CoverageEligibilityResponse" == resource_type: + from . import coverageeligibilityresponse + return coverageeligibilityresponse.CoverageEligibilityResponse(jsondict) + if "CoverageEligibilityResponseError" == resource_type: + from . import coverageeligibilityresponse + return coverageeligibilityresponse.CoverageEligibilityResponseError(jsondict) + if "CoverageEligibilityResponseInsurance" == resource_type: + from . import coverageeligibilityresponse + return coverageeligibilityresponse.CoverageEligibilityResponseInsurance(jsondict) + if "CoverageEligibilityResponseInsuranceItem" == resource_type: + from . import coverageeligibilityresponse + return coverageeligibilityresponse.CoverageEligibilityResponseInsuranceItem(jsondict) + if "CoverageEligibilityResponseInsuranceItemBenefit" == resource_type: + from . import coverageeligibilityresponse + return coverageeligibilityresponse.CoverageEligibilityResponseInsuranceItemBenefit(jsondict) if "DataRequirement" == resource_type: from . import datarequirement return datarequirement.DataRequirement(jsondict) @@ -434,57 +512,84 @@ def instantiate(cls, resource_type, jsondict): if "DataRequirementDateFilter" == resource_type: from . import datarequirement return datarequirement.DataRequirementDateFilter(jsondict) + if "DataRequirementSort" == resource_type: + from . import datarequirement + return datarequirement.DataRequirementSort(jsondict) if "DetectedIssue" == resource_type: from . import detectedissue return detectedissue.DetectedIssue(jsondict) + if "DetectedIssueEvidence" == resource_type: + from . import detectedissue + return detectedissue.DetectedIssueEvidence(jsondict) if "DetectedIssueMitigation" == resource_type: from . import detectedissue return detectedissue.DetectedIssueMitigation(jsondict) if "Device" == resource_type: from . import device return device.Device(jsondict) - if "DeviceComponent" == resource_type: - from . import devicecomponent - return devicecomponent.DeviceComponent(jsondict) - if "DeviceComponentProductionSpecification" == resource_type: - from . import devicecomponent - return devicecomponent.DeviceComponentProductionSpecification(jsondict) + if "DeviceDefinition" == resource_type: + from . import devicedefinition + return devicedefinition.DeviceDefinition(jsondict) + if "DeviceDefinitionCapability" == resource_type: + from . import devicedefinition + return devicedefinition.DeviceDefinitionCapability(jsondict) + if "DeviceDefinitionDeviceName" == resource_type: + from . import devicedefinition + return devicedefinition.DeviceDefinitionDeviceName(jsondict) + if "DeviceDefinitionMaterial" == resource_type: + from . import devicedefinition + return devicedefinition.DeviceDefinitionMaterial(jsondict) + if "DeviceDefinitionProperty" == resource_type: + from . import devicedefinition + return devicedefinition.DeviceDefinitionProperty(jsondict) + if "DeviceDefinitionSpecialization" == resource_type: + from . import devicedefinition + return devicedefinition.DeviceDefinitionSpecialization(jsondict) + if "DeviceDefinitionUdiDeviceIdentifier" == resource_type: + from . import devicedefinition + return devicedefinition.DeviceDefinitionUdiDeviceIdentifier(jsondict) + if "DeviceDeviceName" == resource_type: + from . import device + return device.DeviceDeviceName(jsondict) if "DeviceMetric" == resource_type: from . import devicemetric return devicemetric.DeviceMetric(jsondict) if "DeviceMetricCalibration" == resource_type: from . import devicemetric return devicemetric.DeviceMetricCalibration(jsondict) + if "DeviceProperty" == resource_type: + from . import device + return device.DeviceProperty(jsondict) if "DeviceRequest" == resource_type: from . import devicerequest return devicerequest.DeviceRequest(jsondict) - if "DeviceRequestRequester" == resource_type: + if "DeviceRequestParameter" == resource_type: from . import devicerequest - return devicerequest.DeviceRequestRequester(jsondict) - if "DeviceUdi" == resource_type: + return devicerequest.DeviceRequestParameter(jsondict) + if "DeviceSpecialization" == resource_type: + from . import device + return device.DeviceSpecialization(jsondict) + if "DeviceUdiCarrier" == resource_type: from . import device - return device.DeviceUdi(jsondict) + return device.DeviceUdiCarrier(jsondict) if "DeviceUseStatement" == resource_type: from . import deviceusestatement return deviceusestatement.DeviceUseStatement(jsondict) + if "DeviceVersion" == resource_type: + from . import device + return device.DeviceVersion(jsondict) if "DiagnosticReport" == resource_type: from . import diagnosticreport return diagnosticreport.DiagnosticReport(jsondict) - if "DiagnosticReportImage" == resource_type: - from . import diagnosticreport - return diagnosticreport.DiagnosticReportImage(jsondict) - if "DiagnosticReportPerformer" == resource_type: + if "DiagnosticReportMedia" == resource_type: from . import diagnosticreport - return diagnosticreport.DiagnosticReportPerformer(jsondict) + return diagnosticreport.DiagnosticReportMedia(jsondict) if "Distance" == resource_type: from . import distance return distance.Distance(jsondict) if "DocumentManifest" == resource_type: from . import documentmanifest return documentmanifest.DocumentManifest(jsondict) - if "DocumentManifestContent" == resource_type: - from . import documentmanifest - return documentmanifest.DocumentManifestContent(jsondict) if "DocumentManifestRelated" == resource_type: from . import documentmanifest return documentmanifest.DocumentManifestRelated(jsondict) @@ -497,9 +602,6 @@ def instantiate(cls, resource_type, jsondict): if "DocumentReferenceContext" == resource_type: from . import documentreference return documentreference.DocumentReferenceContext(jsondict) - if "DocumentReferenceContextRelated" == resource_type: - from . import documentreference - return documentreference.DocumentReferenceContextRelated(jsondict) if "DocumentReferenceRelatesTo" == resource_type: from . import documentreference return documentreference.DocumentReferenceRelatesTo(jsondict) @@ -509,9 +611,33 @@ def instantiate(cls, resource_type, jsondict): if "Dosage" == resource_type: from . import dosage return dosage.Dosage(jsondict) + if "DosageDoseAndRate" == resource_type: + from . import dosage + return dosage.DosageDoseAndRate(jsondict) if "Duration" == resource_type: from . import duration return duration.Duration(jsondict) + if "EffectEvidenceSynthesis" == resource_type: + from . import effectevidencesynthesis + return effectevidencesynthesis.EffectEvidenceSynthesis(jsondict) + if "EffectEvidenceSynthesisCertainty" == resource_type: + from . import effectevidencesynthesis + return effectevidencesynthesis.EffectEvidenceSynthesisCertainty(jsondict) + if "EffectEvidenceSynthesisCertaintyCertaintySubcomponent" == resource_type: + from . import effectevidencesynthesis + return effectevidencesynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponent(jsondict) + if "EffectEvidenceSynthesisEffectEstimate" == resource_type: + from . import effectevidencesynthesis + return effectevidencesynthesis.EffectEvidenceSynthesisEffectEstimate(jsondict) + if "EffectEvidenceSynthesisEffectEstimatePrecisionEstimate" == resource_type: + from . import effectevidencesynthesis + return effectevidencesynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimate(jsondict) + if "EffectEvidenceSynthesisResultsByExposure" == resource_type: + from . import effectevidencesynthesis + return effectevidencesynthesis.EffectEvidenceSynthesisResultsByExposure(jsondict) + if "EffectEvidenceSynthesisSampleSize" == resource_type: + from . import effectevidencesynthesis + return effectevidencesynthesis.EffectEvidenceSynthesisSampleSize(jsondict) if "Element" == resource_type: from . import element return element.Element(jsondict) @@ -542,24 +668,6 @@ def instantiate(cls, resource_type, jsondict): if "ElementDefinitionType" == resource_type: from . import elementdefinition return elementdefinition.ElementDefinitionType(jsondict) - if "EligibilityRequest" == resource_type: - from . import eligibilityrequest - return eligibilityrequest.EligibilityRequest(jsondict) - if "EligibilityResponse" == resource_type: - from . import eligibilityresponse - return eligibilityresponse.EligibilityResponse(jsondict) - if "EligibilityResponseError" == resource_type: - from . import eligibilityresponse - return eligibilityresponse.EligibilityResponseError(jsondict) - if "EligibilityResponseInsurance" == resource_type: - from . import eligibilityresponse - return eligibilityresponse.EligibilityResponseInsurance(jsondict) - if "EligibilityResponseInsuranceBenefitBalance" == resource_type: - from . import eligibilityresponse - return eligibilityresponse.EligibilityResponseInsuranceBenefitBalance(jsondict) - if "EligibilityResponseInsuranceBenefitBalanceFinancial" == resource_type: - from . import eligibilityresponse - return eligibilityresponse.EligibilityResponseInsuranceBenefitBalanceFinancial(jsondict) if "Encounter" == resource_type: from . import encounter return encounter.Encounter(jsondict) @@ -599,30 +707,45 @@ def instantiate(cls, resource_type, jsondict): if "EpisodeOfCareStatusHistory" == resource_type: from . import episodeofcare return episodeofcare.EpisodeOfCareStatusHistory(jsondict) - if "ExpansionProfile" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfile(jsondict) - if "ExpansionProfileDesignation" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfileDesignation(jsondict) - if "ExpansionProfileDesignationExclude" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfileDesignationExclude(jsondict) - if "ExpansionProfileDesignationExcludeDesignation" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfileDesignationExcludeDesignation(jsondict) - if "ExpansionProfileDesignationInclude" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfileDesignationInclude(jsondict) - if "ExpansionProfileDesignationIncludeDesignation" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfileDesignationIncludeDesignation(jsondict) - if "ExpansionProfileExcludedSystem" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfileExcludedSystem(jsondict) - if "ExpansionProfileFixedVersion" == resource_type: - from . import expansionprofile - return expansionprofile.ExpansionProfileFixedVersion(jsondict) + if "EventDefinition" == resource_type: + from . import eventdefinition + return eventdefinition.EventDefinition(jsondict) + if "Evidence" == resource_type: + from . import evidence + return evidence.Evidence(jsondict) + if "EvidenceVariable" == resource_type: + from . import evidencevariable + return evidencevariable.EvidenceVariable(jsondict) + if "EvidenceVariableCharacteristic" == resource_type: + from . import evidencevariable + return evidencevariable.EvidenceVariableCharacteristic(jsondict) + if "ExampleScenario" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenario(jsondict) + if "ExampleScenarioActor" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioActor(jsondict) + if "ExampleScenarioInstance" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioInstance(jsondict) + if "ExampleScenarioInstanceContainedInstance" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioInstanceContainedInstance(jsondict) + if "ExampleScenarioInstanceVersion" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioInstanceVersion(jsondict) + if "ExampleScenarioProcess" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioProcess(jsondict) + if "ExampleScenarioProcessStep" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioProcessStep(jsondict) + if "ExampleScenarioProcessStepAlternative" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioProcessStepAlternative(jsondict) + if "ExampleScenarioProcessStepOperation" == resource_type: + from . import examplescenario + return examplescenario.ExampleScenarioProcessStepOperation(jsondict) if "ExplanationOfBenefit" == resource_type: from . import explanationofbenefit return explanationofbenefit.ExplanationOfBenefit(jsondict) @@ -635,6 +758,9 @@ def instantiate(cls, resource_type, jsondict): if "ExplanationOfBenefitAddItemDetail" == resource_type: from . import explanationofbenefit return explanationofbenefit.ExplanationOfBenefitAddItemDetail(jsondict) + if "ExplanationOfBenefitAddItemDetailSubDetail" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitAddItemDetailSubDetail(jsondict) if "ExplanationOfBenefitBenefitBalance" == resource_type: from . import explanationofbenefit return explanationofbenefit.ExplanationOfBenefitBenefitBalance(jsondict) @@ -647,9 +773,6 @@ def instantiate(cls, resource_type, jsondict): if "ExplanationOfBenefitDiagnosis" == resource_type: from . import explanationofbenefit return explanationofbenefit.ExplanationOfBenefitDiagnosis(jsondict) - if "ExplanationOfBenefitInformation" == resource_type: - from . import explanationofbenefit - return explanationofbenefit.ExplanationOfBenefitInformation(jsondict) if "ExplanationOfBenefitInsurance" == resource_type: from . import explanationofbenefit return explanationofbenefit.ExplanationOfBenefitInsurance(jsondict) @@ -680,6 +803,15 @@ def instantiate(cls, resource_type, jsondict): if "ExplanationOfBenefitRelated" == resource_type: from . import explanationofbenefit return explanationofbenefit.ExplanationOfBenefitRelated(jsondict) + if "ExplanationOfBenefitSupportingInfo" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitSupportingInfo(jsondict) + if "ExplanationOfBenefitTotal" == resource_type: + from . import explanationofbenefit + return explanationofbenefit.ExplanationOfBenefitTotal(jsondict) + if "Expression" == resource_type: + from . import expression + return expression.Expression(jsondict) if "Extension" == resource_type: from . import extension return extension.Extension(jsondict) @@ -728,6 +860,9 @@ def instantiate(cls, resource_type, jsondict): if "HealthcareServiceAvailableTime" == resource_type: from . import healthcareservice return healthcareservice.HealthcareServiceAvailableTime(jsondict) + if "HealthcareServiceEligibility" == resource_type: + from . import healthcareservice + return healthcareservice.HealthcareServiceEligibility(jsondict) if "HealthcareServiceNotAvailable" == resource_type: from . import healthcareservice return healthcareservice.HealthcareServiceNotAvailable(jsondict) @@ -737,18 +872,6 @@ def instantiate(cls, resource_type, jsondict): if "Identifier" == resource_type: from . import identifier return identifier.Identifier(jsondict) - if "ImagingManifest" == resource_type: - from . import imagingmanifest - return imagingmanifest.ImagingManifest(jsondict) - if "ImagingManifestStudy" == resource_type: - from . import imagingmanifest - return imagingmanifest.ImagingManifestStudy(jsondict) - if "ImagingManifestStudySeries" == resource_type: - from . import imagingmanifest - return imagingmanifest.ImagingManifestStudySeries(jsondict) - if "ImagingManifestStudySeriesInstance" == resource_type: - from . import imagingmanifest - return imagingmanifest.ImagingManifestStudySeriesInstance(jsondict) if "ImagingStudy" == resource_type: from . import imagingstudy return imagingstudy.ImagingStudy(jsondict) @@ -758,15 +881,24 @@ def instantiate(cls, resource_type, jsondict): if "ImagingStudySeriesInstance" == resource_type: from . import imagingstudy return imagingstudy.ImagingStudySeriesInstance(jsondict) + if "ImagingStudySeriesPerformer" == resource_type: + from . import imagingstudy + return imagingstudy.ImagingStudySeriesPerformer(jsondict) if "Immunization" == resource_type: from . import immunization return immunization.Immunization(jsondict) - if "ImmunizationExplanation" == resource_type: + if "ImmunizationEducation" == resource_type: from . import immunization - return immunization.ImmunizationExplanation(jsondict) - if "ImmunizationPractitioner" == resource_type: + return immunization.ImmunizationEducation(jsondict) + if "ImmunizationEvaluation" == resource_type: + from . import immunizationevaluation + return immunizationevaluation.ImmunizationEvaluation(jsondict) + if "ImmunizationPerformer" == resource_type: from . import immunization - return immunization.ImmunizationPractitioner(jsondict) + return immunization.ImmunizationPerformer(jsondict) + if "ImmunizationProtocolApplied" == resource_type: + from . import immunization + return immunization.ImmunizationProtocolApplied(jsondict) if "ImmunizationReaction" == resource_type: from . import immunization return immunization.ImmunizationReaction(jsondict) @@ -779,30 +911,84 @@ def instantiate(cls, resource_type, jsondict): if "ImmunizationRecommendationRecommendationDateCriterion" == resource_type: from . import immunizationrecommendation return immunizationrecommendation.ImmunizationRecommendationRecommendationDateCriterion(jsondict) - if "ImmunizationRecommendationRecommendationProtocol" == resource_type: - from . import immunizationrecommendation - return immunizationrecommendation.ImmunizationRecommendationRecommendationProtocol(jsondict) - if "ImmunizationVaccinationProtocol" == resource_type: - from . import immunization - return immunization.ImmunizationVaccinationProtocol(jsondict) if "ImplementationGuide" == resource_type: from . import implementationguide return implementationguide.ImplementationGuide(jsondict) - if "ImplementationGuideDependency" == resource_type: + if "ImplementationGuideDefinition" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideDefinition(jsondict) + if "ImplementationGuideDefinitionGrouping" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideDefinitionGrouping(jsondict) + if "ImplementationGuideDefinitionPage" == resource_type: from . import implementationguide - return implementationguide.ImplementationGuideDependency(jsondict) + return implementationguide.ImplementationGuideDefinitionPage(jsondict) + if "ImplementationGuideDefinitionParameter" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideDefinitionParameter(jsondict) + if "ImplementationGuideDefinitionResource" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideDefinitionResource(jsondict) + if "ImplementationGuideDefinitionTemplate" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideDefinitionTemplate(jsondict) + if "ImplementationGuideDependsOn" == resource_type: + from . import implementationguide + return implementationguide.ImplementationGuideDependsOn(jsondict) if "ImplementationGuideGlobal" == resource_type: from . import implementationguide return implementationguide.ImplementationGuideGlobal(jsondict) - if "ImplementationGuidePackage" == resource_type: + if "ImplementationGuideManifest" == resource_type: from . import implementationguide - return implementationguide.ImplementationGuidePackage(jsondict) - if "ImplementationGuidePackageResource" == resource_type: + return implementationguide.ImplementationGuideManifest(jsondict) + if "ImplementationGuideManifestPage" == resource_type: from . import implementationguide - return implementationguide.ImplementationGuidePackageResource(jsondict) - if "ImplementationGuidePage" == resource_type: + return implementationguide.ImplementationGuideManifestPage(jsondict) + if "ImplementationGuideManifestResource" == resource_type: from . import implementationguide - return implementationguide.ImplementationGuidePage(jsondict) + return implementationguide.ImplementationGuideManifestResource(jsondict) + if "InsurancePlan" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlan(jsondict) + if "InsurancePlanContact" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanContact(jsondict) + if "InsurancePlanCoverage" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanCoverage(jsondict) + if "InsurancePlanCoverageBenefit" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanCoverageBenefit(jsondict) + if "InsurancePlanCoverageBenefitLimit" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanCoverageBenefitLimit(jsondict) + if "InsurancePlanPlan" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanPlan(jsondict) + if "InsurancePlanPlanGeneralCost" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanPlanGeneralCost(jsondict) + if "InsurancePlanPlanSpecificCost" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanPlanSpecificCost(jsondict) + if "InsurancePlanPlanSpecificCostBenefit" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanPlanSpecificCostBenefit(jsondict) + if "InsurancePlanPlanSpecificCostBenefitCost" == resource_type: + from . import insuranceplan + return insuranceplan.InsurancePlanPlanSpecificCostBenefitCost(jsondict) + if "Invoice" == resource_type: + from . import invoice + return invoice.Invoice(jsondict) + if "InvoiceLineItem" == resource_type: + from . import invoice + return invoice.InvoiceLineItem(jsondict) + if "InvoiceLineItemPriceComponent" == resource_type: + from . import invoice + return invoice.InvoiceLineItemPriceComponent(jsondict) + if "InvoiceParticipant" == resource_type: + from . import invoice + return invoice.InvoiceParticipant(jsondict) if "Library" == resource_type: from . import library return library.Library(jsondict) @@ -821,9 +1007,15 @@ def instantiate(cls, resource_type, jsondict): if "Location" == resource_type: from . import location return location.Location(jsondict) + if "LocationHoursOfOperation" == resource_type: + from . import location + return location.LocationHoursOfOperation(jsondict) if "LocationPosition" == resource_type: from . import location return location.LocationPosition(jsondict) + if "MarketingStatus" == resource_type: + from . import marketingstatus + return marketingstatus.MarketingStatus(jsondict) if "Measure" == resource_type: from . import measure return measure.Measure(jsondict) @@ -836,6 +1028,9 @@ def instantiate(cls, resource_type, jsondict): if "MeasureGroupStratifier" == resource_type: from . import measure return measure.MeasureGroupStratifier(jsondict) + if "MeasureGroupStratifierComponent" == resource_type: + from . import measure + return measure.MeasureGroupStratifierComponent(jsondict) if "MeasureReport" == resource_type: from . import measurereport return measurereport.MeasureReport(jsondict) @@ -851,6 +1046,9 @@ def instantiate(cls, resource_type, jsondict): if "MeasureReportGroupStratifierStratum" == resource_type: from . import measurereport return measurereport.MeasureReportGroupStratifierStratum(jsondict) + if "MeasureReportGroupStratifierStratumComponent" == resource_type: + from . import measurereport + return measurereport.MeasureReportGroupStratifierStratumComponent(jsondict) if "MeasureReportGroupStratifierStratumPopulation" == resource_type: from . import measurereport return measurereport.MeasureReportGroupStratifierStratumPopulation(jsondict) @@ -872,6 +1070,9 @@ def instantiate(cls, resource_type, jsondict): if "MedicationAdministrationPerformer" == resource_type: from . import medicationadministration return medicationadministration.MedicationAdministrationPerformer(jsondict) + if "MedicationBatch" == resource_type: + from . import medication + return medication.MedicationBatch(jsondict) if "MedicationDispense" == resource_type: from . import medicationdispense return medicationdispense.MedicationDispense(jsondict) @@ -884,30 +1085,162 @@ def instantiate(cls, resource_type, jsondict): if "MedicationIngredient" == resource_type: from . import medication return medication.MedicationIngredient(jsondict) - if "MedicationPackage" == resource_type: - from . import medication - return medication.MedicationPackage(jsondict) - if "MedicationPackageBatch" == resource_type: - from . import medication - return medication.MedicationPackageBatch(jsondict) - if "MedicationPackageContent" == resource_type: - from . import medication - return medication.MedicationPackageContent(jsondict) + if "MedicationKnowledge" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledge(jsondict) + if "MedicationKnowledgeAdministrationGuidelines" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeAdministrationGuidelines(jsondict) + if "MedicationKnowledgeAdministrationGuidelinesDosage" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeAdministrationGuidelinesDosage(jsondict) + if "MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics(jsondict) + if "MedicationKnowledgeCost" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeCost(jsondict) + if "MedicationKnowledgeDrugCharacteristic" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeDrugCharacteristic(jsondict) + if "MedicationKnowledgeIngredient" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeIngredient(jsondict) + if "MedicationKnowledgeKinetics" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeKinetics(jsondict) + if "MedicationKnowledgeMedicineClassification" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeMedicineClassification(jsondict) + if "MedicationKnowledgeMonitoringProgram" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeMonitoringProgram(jsondict) + if "MedicationKnowledgeMonograph" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeMonograph(jsondict) + if "MedicationKnowledgePackaging" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgePackaging(jsondict) + if "MedicationKnowledgeRegulatory" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeRegulatory(jsondict) + if "MedicationKnowledgeRegulatoryMaxDispense" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeRegulatoryMaxDispense(jsondict) + if "MedicationKnowledgeRegulatorySchedule" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeRegulatorySchedule(jsondict) + if "MedicationKnowledgeRegulatorySubstitution" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeRegulatorySubstitution(jsondict) + if "MedicationKnowledgeRelatedMedicationKnowledge" == resource_type: + from . import medicationknowledge + return medicationknowledge.MedicationKnowledgeRelatedMedicationKnowledge(jsondict) if "MedicationRequest" == resource_type: from . import medicationrequest return medicationrequest.MedicationRequest(jsondict) if "MedicationRequestDispenseRequest" == resource_type: from . import medicationrequest return medicationrequest.MedicationRequestDispenseRequest(jsondict) - if "MedicationRequestRequester" == resource_type: + if "MedicationRequestDispenseRequestInitialFill" == resource_type: from . import medicationrequest - return medicationrequest.MedicationRequestRequester(jsondict) + return medicationrequest.MedicationRequestDispenseRequestInitialFill(jsondict) if "MedicationRequestSubstitution" == resource_type: from . import medicationrequest return medicationrequest.MedicationRequestSubstitution(jsondict) if "MedicationStatement" == resource_type: from . import medicationstatement return medicationstatement.MedicationStatement(jsondict) + if "MedicinalProduct" == resource_type: + from . import medicinalproduct + return medicinalproduct.MedicinalProduct(jsondict) + if "MedicinalProductAuthorization" == resource_type: + from . import medicinalproductauthorization + return medicinalproductauthorization.MedicinalProductAuthorization(jsondict) + if "MedicinalProductAuthorizationJurisdictionalAuthorization" == resource_type: + from . import medicinalproductauthorization + return medicinalproductauthorization.MedicinalProductAuthorizationJurisdictionalAuthorization(jsondict) + if "MedicinalProductAuthorizationProcedure" == resource_type: + from . import medicinalproductauthorization + return medicinalproductauthorization.MedicinalProductAuthorizationProcedure(jsondict) + if "MedicinalProductContraindication" == resource_type: + from . import medicinalproductcontraindication + return medicinalproductcontraindication.MedicinalProductContraindication(jsondict) + if "MedicinalProductContraindicationOtherTherapy" == resource_type: + from . import medicinalproductcontraindication + return medicinalproductcontraindication.MedicinalProductContraindicationOtherTherapy(jsondict) + if "MedicinalProductIndication" == resource_type: + from . import medicinalproductindication + return medicinalproductindication.MedicinalProductIndication(jsondict) + if "MedicinalProductIndicationOtherTherapy" == resource_type: + from . import medicinalproductindication + return medicinalproductindication.MedicinalProductIndicationOtherTherapy(jsondict) + if "MedicinalProductIngredient" == resource_type: + from . import medicinalproductingredient + return medicinalproductingredient.MedicinalProductIngredient(jsondict) + if "MedicinalProductIngredientSpecifiedSubstance" == resource_type: + from . import medicinalproductingredient + return medicinalproductingredient.MedicinalProductIngredientSpecifiedSubstance(jsondict) + if "MedicinalProductIngredientSpecifiedSubstanceStrength" == resource_type: + from . import medicinalproductingredient + return medicinalproductingredient.MedicinalProductIngredientSpecifiedSubstanceStrength(jsondict) + if "MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength" == resource_type: + from . import medicinalproductingredient + return medicinalproductingredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength(jsondict) + if "MedicinalProductIngredientSubstance" == resource_type: + from . import medicinalproductingredient + return medicinalproductingredient.MedicinalProductIngredientSubstance(jsondict) + if "MedicinalProductInteraction" == resource_type: + from . import medicinalproductinteraction + return medicinalproductinteraction.MedicinalProductInteraction(jsondict) + if "MedicinalProductInteractionInteractant" == resource_type: + from . import medicinalproductinteraction + return medicinalproductinteraction.MedicinalProductInteractionInteractant(jsondict) + if "MedicinalProductManufactured" == resource_type: + from . import medicinalproductmanufactured + return medicinalproductmanufactured.MedicinalProductManufactured(jsondict) + if "MedicinalProductManufacturingBusinessOperation" == resource_type: + from . import medicinalproduct + return medicinalproduct.MedicinalProductManufacturingBusinessOperation(jsondict) + if "MedicinalProductName" == resource_type: + from . import medicinalproduct + return medicinalproduct.MedicinalProductName(jsondict) + if "MedicinalProductNameCountryLanguage" == resource_type: + from . import medicinalproduct + return medicinalproduct.MedicinalProductNameCountryLanguage(jsondict) + if "MedicinalProductNameNamePart" == resource_type: + from . import medicinalproduct + return medicinalproduct.MedicinalProductNameNamePart(jsondict) + if "MedicinalProductPackaged" == resource_type: + from . import medicinalproductpackaged + return medicinalproductpackaged.MedicinalProductPackaged(jsondict) + if "MedicinalProductPackagedBatchIdentifier" == resource_type: + from . import medicinalproductpackaged + return medicinalproductpackaged.MedicinalProductPackagedBatchIdentifier(jsondict) + if "MedicinalProductPackagedPackageItem" == resource_type: + from . import medicinalproductpackaged + return medicinalproductpackaged.MedicinalProductPackagedPackageItem(jsondict) + if "MedicinalProductPharmaceutical" == resource_type: + from . import medicinalproductpharmaceutical + return medicinalproductpharmaceutical.MedicinalProductPharmaceutical(jsondict) + if "MedicinalProductPharmaceuticalCharacteristics" == resource_type: + from . import medicinalproductpharmaceutical + return medicinalproductpharmaceutical.MedicinalProductPharmaceuticalCharacteristics(jsondict) + if "MedicinalProductPharmaceuticalRouteOfAdministration" == resource_type: + from . import medicinalproductpharmaceutical + return medicinalproductpharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministration(jsondict) + if "MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies" == resource_type: + from . import medicinalproductpharmaceutical + return medicinalproductpharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies(jsondict) + if "MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod" == resource_type: + from . import medicinalproductpharmaceutical + return medicinalproductpharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod(jsondict) + if "MedicinalProductSpecialDesignation" == resource_type: + from . import medicinalproduct + return medicinalproduct.MedicinalProductSpecialDesignation(jsondict) + if "MedicinalProductUndesirableEffect" == resource_type: + from . import medicinalproductundesirableeffect + return medicinalproductundesirableeffect.MedicinalProductUndesirableEffect(jsondict) if "MessageDefinition" == resource_type: from . import messagedefinition return messagedefinition.MessageDefinition(jsondict) @@ -935,6 +1268,33 @@ def instantiate(cls, resource_type, jsondict): if "MetadataResource" == resource_type: from . import metadataresource return metadataresource.MetadataResource(jsondict) + if "MolecularSequence" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequence(jsondict) + if "MolecularSequenceQuality" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceQuality(jsondict) + if "MolecularSequenceQualityRoc" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceQualityRoc(jsondict) + if "MolecularSequenceReferenceSeq" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceReferenceSeq(jsondict) + if "MolecularSequenceRepository" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceRepository(jsondict) + if "MolecularSequenceStructureVariant" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceStructureVariant(jsondict) + if "MolecularSequenceStructureVariantInner" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceStructureVariantInner(jsondict) + if "MolecularSequenceStructureVariantOuter" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceStructureVariantOuter(jsondict) + if "MolecularSequenceVariant" == resource_type: + from . import molecularsequence + return molecularsequence.MolecularSequenceVariant(jsondict) if "Money" == resource_type: from . import money return money.Money(jsondict) @@ -974,12 +1334,18 @@ def instantiate(cls, resource_type, jsondict): if "ObservationComponent" == resource_type: from . import observation return observation.ObservationComponent(jsondict) + if "ObservationDefinition" == resource_type: + from . import observationdefinition + return observationdefinition.ObservationDefinition(jsondict) + if "ObservationDefinitionQualifiedInterval" == resource_type: + from . import observationdefinition + return observationdefinition.ObservationDefinitionQualifiedInterval(jsondict) + if "ObservationDefinitionQuantitativeDetails" == resource_type: + from . import observationdefinition + return observationdefinition.ObservationDefinitionQuantitativeDetails(jsondict) if "ObservationReferenceRange" == resource_type: from . import observation return observation.ObservationReferenceRange(jsondict) - if "ObservationRelated" == resource_type: - from . import observation - return observation.ObservationRelated(jsondict) if "OperationDefinition" == resource_type: from . import operationdefinition return operationdefinition.OperationDefinition(jsondict) @@ -992,6 +1358,9 @@ def instantiate(cls, resource_type, jsondict): if "OperationDefinitionParameterBinding" == resource_type: from . import operationdefinition return operationdefinition.OperationDefinitionParameterBinding(jsondict) + if "OperationDefinitionParameterReferencedFrom" == resource_type: + from . import operationdefinition + return operationdefinition.OperationDefinitionParameterReferencedFrom(jsondict) if "OperationOutcome" == resource_type: from . import operationoutcome return operationoutcome.OperationOutcome(jsondict) @@ -1001,6 +1370,9 @@ def instantiate(cls, resource_type, jsondict): if "Organization" == resource_type: from . import organization return organization.Organization(jsondict) + if "OrganizationAffiliation" == resource_type: + from . import organizationaffiliation + return organizationaffiliation.OrganizationAffiliation(jsondict) if "OrganizationContact" == resource_type: from . import organization return organization.OrganizationContact(jsondict) @@ -1016,9 +1388,6 @@ def instantiate(cls, resource_type, jsondict): if "Patient" == resource_type: from . import patient return patient.Patient(jsondict) - if "PatientAnimal" == resource_type: - from . import patient - return patient.PatientAnimal(jsondict) if "PatientCommunication" == resource_type: from . import patient return patient.PatientCommunication(jsondict) @@ -1073,6 +1442,9 @@ def instantiate(cls, resource_type, jsondict): if "PlanDefinitionGoalTarget" == resource_type: from . import plandefinition return plandefinition.PlanDefinitionGoalTarget(jsondict) + if "Population" == resource_type: + from . import population + return population.Population(jsondict) if "Practitioner" == resource_type: from . import practitioner return practitioner.Practitioner(jsondict) @@ -1097,24 +1469,12 @@ def instantiate(cls, resource_type, jsondict): if "ProcedurePerformer" == resource_type: from . import procedure return procedure.ProcedurePerformer(jsondict) - if "ProcedureRequest" == resource_type: - from . import procedurerequest - return procedurerequest.ProcedureRequest(jsondict) - if "ProcedureRequestRequester" == resource_type: - from . import procedurerequest - return procedurerequest.ProcedureRequestRequester(jsondict) - if "ProcessRequest" == resource_type: - from . import processrequest - return processrequest.ProcessRequest(jsondict) - if "ProcessRequestItem" == resource_type: - from . import processrequest - return processrequest.ProcessRequestItem(jsondict) - if "ProcessResponse" == resource_type: - from . import processresponse - return processresponse.ProcessResponse(jsondict) - if "ProcessResponseProcessNote" == resource_type: - from . import processresponse - return processresponse.ProcessResponseProcessNote(jsondict) + if "ProdCharacteristic" == resource_type: + from . import prodcharacteristic + return prodcharacteristic.ProdCharacteristic(jsondict) + if "ProductShelfLife" == resource_type: + from . import productshelflife + return productshelflife.ProductShelfLife(jsondict) if "Provenance" == resource_type: from . import provenance return provenance.Provenance(jsondict) @@ -1127,18 +1487,24 @@ def instantiate(cls, resource_type, jsondict): if "Quantity" == resource_type: from . import quantity return quantity.Quantity(jsondict) + if "Quantity" == resource_type: + from . import quantity + return quantity.Quantity(jsondict) if "Questionnaire" == resource_type: from . import questionnaire return questionnaire.Questionnaire(jsondict) if "QuestionnaireItem" == resource_type: from . import questionnaire return questionnaire.QuestionnaireItem(jsondict) + if "QuestionnaireItemAnswerOption" == resource_type: + from . import questionnaire + return questionnaire.QuestionnaireItemAnswerOption(jsondict) if "QuestionnaireItemEnableWhen" == resource_type: from . import questionnaire return questionnaire.QuestionnaireItemEnableWhen(jsondict) - if "QuestionnaireItemOption" == resource_type: + if "QuestionnaireItemInitial" == resource_type: from . import questionnaire - return questionnaire.QuestionnaireItemOption(jsondict) + return questionnaire.QuestionnaireItemInitial(jsondict) if "QuestionnaireResponse" == resource_type: from . import questionnaireresponse return questionnaireresponse.QuestionnaireResponse(jsondict) @@ -1157,18 +1523,15 @@ def instantiate(cls, resource_type, jsondict): if "Reference" == resource_type: from . import reference return reference.Reference(jsondict) - if "ReferralRequest" == resource_type: - from . import referralrequest - return referralrequest.ReferralRequest(jsondict) - if "ReferralRequestRequester" == resource_type: - from . import referralrequest - return referralrequest.ReferralRequestRequester(jsondict) if "RelatedArtifact" == resource_type: from . import relatedartifact return relatedartifact.RelatedArtifact(jsondict) if "RelatedPerson" == resource_type: from . import relatedperson return relatedperson.RelatedPerson(jsondict) + if "RelatedPersonCommunication" == resource_type: + from . import relatedperson + return relatedperson.RelatedPersonCommunication(jsondict) if "RequestGroup" == resource_type: from . import requestgroup return requestgroup.RequestGroup(jsondict) @@ -1181,12 +1544,24 @@ def instantiate(cls, resource_type, jsondict): if "RequestGroupActionRelatedAction" == resource_type: from . import requestgroup return requestgroup.RequestGroupActionRelatedAction(jsondict) + if "ResearchDefinition" == resource_type: + from . import researchdefinition + return researchdefinition.ResearchDefinition(jsondict) + if "ResearchElementDefinition" == resource_type: + from . import researchelementdefinition + return researchelementdefinition.ResearchElementDefinition(jsondict) + if "ResearchElementDefinitionCharacteristic" == resource_type: + from . import researchelementdefinition + return researchelementdefinition.ResearchElementDefinitionCharacteristic(jsondict) if "ResearchStudy" == resource_type: from . import researchstudy return researchstudy.ResearchStudy(jsondict) if "ResearchStudyArm" == resource_type: from . import researchstudy return researchstudy.ResearchStudyArm(jsondict) + if "ResearchStudyObjective" == resource_type: + from . import researchstudy + return researchstudy.ResearchStudyObjective(jsondict) if "ResearchSubject" == resource_type: from . import researchsubject return researchsubject.ResearchSubject(jsondict) @@ -1199,6 +1574,24 @@ def instantiate(cls, resource_type, jsondict): if "RiskAssessmentPrediction" == resource_type: from . import riskassessment return riskassessment.RiskAssessmentPrediction(jsondict) + if "RiskEvidenceSynthesis" == resource_type: + from . import riskevidencesynthesis + return riskevidencesynthesis.RiskEvidenceSynthesis(jsondict) + if "RiskEvidenceSynthesisCertainty" == resource_type: + from . import riskevidencesynthesis + return riskevidencesynthesis.RiskEvidenceSynthesisCertainty(jsondict) + if "RiskEvidenceSynthesisCertaintyCertaintySubcomponent" == resource_type: + from . import riskevidencesynthesis + return riskevidencesynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponent(jsondict) + if "RiskEvidenceSynthesisRiskEstimate" == resource_type: + from . import riskevidencesynthesis + return riskevidencesynthesis.RiskEvidenceSynthesisRiskEstimate(jsondict) + if "RiskEvidenceSynthesisRiskEstimatePrecisionEstimate" == resource_type: + from . import riskevidencesynthesis + return riskevidencesynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimate(jsondict) + if "RiskEvidenceSynthesisSampleSize" == resource_type: + from . import riskevidencesynthesis + return riskevidencesynthesis.RiskEvidenceSynthesisSampleSize(jsondict) if "SampledData" == resource_type: from . import sampleddata return sampleddata.SampledData(jsondict) @@ -1211,24 +1604,9 @@ def instantiate(cls, resource_type, jsondict): if "SearchParameterComponent" == resource_type: from . import searchparameter return searchparameter.SearchParameterComponent(jsondict) - if "Sequence" == resource_type: - from . import sequence - return sequence.Sequence(jsondict) - if "SequenceQuality" == resource_type: - from . import sequence - return sequence.SequenceQuality(jsondict) - if "SequenceReferenceSeq" == resource_type: - from . import sequence - return sequence.SequenceReferenceSeq(jsondict) - if "SequenceRepository" == resource_type: - from . import sequence - return sequence.SequenceRepository(jsondict) - if "SequenceVariant" == resource_type: - from . import sequence - return sequence.SequenceVariant(jsondict) - if "ServiceDefinition" == resource_type: - from . import servicedefinition - return servicedefinition.ServiceDefinition(jsondict) + if "ServiceRequest" == resource_type: + from . import servicerequest + return servicerequest.ServiceRequest(jsondict) if "Signature" == resource_type: from . import signature return signature.Signature(jsondict) @@ -1244,12 +1622,30 @@ def instantiate(cls, resource_type, jsondict): if "SpecimenContainer" == resource_type: from . import specimen return specimen.SpecimenContainer(jsondict) + if "SpecimenDefinition" == resource_type: + from . import specimendefinition + return specimendefinition.SpecimenDefinition(jsondict) + if "SpecimenDefinitionTypeTested" == resource_type: + from . import specimendefinition + return specimendefinition.SpecimenDefinitionTypeTested(jsondict) + if "SpecimenDefinitionTypeTestedContainer" == resource_type: + from . import specimendefinition + return specimendefinition.SpecimenDefinitionTypeTestedContainer(jsondict) + if "SpecimenDefinitionTypeTestedContainerAdditive" == resource_type: + from . import specimendefinition + return specimendefinition.SpecimenDefinitionTypeTestedContainerAdditive(jsondict) + if "SpecimenDefinitionTypeTestedHandling" == resource_type: + from . import specimendefinition + return specimendefinition.SpecimenDefinitionTypeTestedHandling(jsondict) if "SpecimenProcessing" == resource_type: from . import specimen return specimen.SpecimenProcessing(jsondict) if "StructureDefinition" == resource_type: from . import structuredefinition return structuredefinition.StructureDefinition(jsondict) + if "StructureDefinitionContext" == resource_type: + from . import structuredefinition + return structuredefinition.StructureDefinitionContext(jsondict) if "StructureDefinitionDifferential" == resource_type: from . import structuredefinition return structuredefinition.StructureDefinitionDifferential(jsondict) @@ -1295,12 +1691,126 @@ def instantiate(cls, resource_type, jsondict): if "Substance" == resource_type: from . import substance return substance.Substance(jsondict) + if "SubstanceAmount" == resource_type: + from . import substanceamount + return substanceamount.SubstanceAmount(jsondict) + if "SubstanceAmountReferenceRange" == resource_type: + from . import substanceamount + return substanceamount.SubstanceAmountReferenceRange(jsondict) if "SubstanceIngredient" == resource_type: from . import substance return substance.SubstanceIngredient(jsondict) if "SubstanceInstance" == resource_type: from . import substance return substance.SubstanceInstance(jsondict) + if "SubstanceNucleicAcid" == resource_type: + from . import substancenucleicacid + return substancenucleicacid.SubstanceNucleicAcid(jsondict) + if "SubstanceNucleicAcidSubunit" == resource_type: + from . import substancenucleicacid + return substancenucleicacid.SubstanceNucleicAcidSubunit(jsondict) + if "SubstanceNucleicAcidSubunitLinkage" == resource_type: + from . import substancenucleicacid + return substancenucleicacid.SubstanceNucleicAcidSubunitLinkage(jsondict) + if "SubstanceNucleicAcidSubunitSugar" == resource_type: + from . import substancenucleicacid + return substancenucleicacid.SubstanceNucleicAcidSubunitSugar(jsondict) + if "SubstancePolymer" == resource_type: + from . import substancepolymer + return substancepolymer.SubstancePolymer(jsondict) + if "SubstancePolymerMonomerSet" == resource_type: + from . import substancepolymer + return substancepolymer.SubstancePolymerMonomerSet(jsondict) + if "SubstancePolymerMonomerSetStartingMaterial" == resource_type: + from . import substancepolymer + return substancepolymer.SubstancePolymerMonomerSetStartingMaterial(jsondict) + if "SubstancePolymerRepeat" == resource_type: + from . import substancepolymer + return substancepolymer.SubstancePolymerRepeat(jsondict) + if "SubstancePolymerRepeatRepeatUnit" == resource_type: + from . import substancepolymer + return substancepolymer.SubstancePolymerRepeatRepeatUnit(jsondict) + if "SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation" == resource_type: + from . import substancepolymer + return substancepolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation(jsondict) + if "SubstancePolymerRepeatRepeatUnitStructuralRepresentation" == resource_type: + from . import substancepolymer + return substancepolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentation(jsondict) + if "SubstanceProtein" == resource_type: + from . import substanceprotein + return substanceprotein.SubstanceProtein(jsondict) + if "SubstanceProteinSubunit" == resource_type: + from . import substanceprotein + return substanceprotein.SubstanceProteinSubunit(jsondict) + if "SubstanceReferenceInformation" == resource_type: + from . import substancereferenceinformation + return substancereferenceinformation.SubstanceReferenceInformation(jsondict) + if "SubstanceReferenceInformationClassification" == resource_type: + from . import substancereferenceinformation + return substancereferenceinformation.SubstanceReferenceInformationClassification(jsondict) + if "SubstanceReferenceInformationGene" == resource_type: + from . import substancereferenceinformation + return substancereferenceinformation.SubstanceReferenceInformationGene(jsondict) + if "SubstanceReferenceInformationGeneElement" == resource_type: + from . import substancereferenceinformation + return substancereferenceinformation.SubstanceReferenceInformationGeneElement(jsondict) + if "SubstanceReferenceInformationTarget" == resource_type: + from . import substancereferenceinformation + return substancereferenceinformation.SubstanceReferenceInformationTarget(jsondict) + if "SubstanceSourceMaterial" == resource_type: + from . import substancesourcematerial + return substancesourcematerial.SubstanceSourceMaterial(jsondict) + if "SubstanceSourceMaterialFractionDescription" == resource_type: + from . import substancesourcematerial + return substancesourcematerial.SubstanceSourceMaterialFractionDescription(jsondict) + if "SubstanceSourceMaterialOrganism" == resource_type: + from . import substancesourcematerial + return substancesourcematerial.SubstanceSourceMaterialOrganism(jsondict) + if "SubstanceSourceMaterialOrganismAuthor" == resource_type: + from . import substancesourcematerial + return substancesourcematerial.SubstanceSourceMaterialOrganismAuthor(jsondict) + if "SubstanceSourceMaterialOrganismHybrid" == resource_type: + from . import substancesourcematerial + return substancesourcematerial.SubstanceSourceMaterialOrganismHybrid(jsondict) + if "SubstanceSourceMaterialOrganismOrganismGeneral" == resource_type: + from . import substancesourcematerial + return substancesourcematerial.SubstanceSourceMaterialOrganismOrganismGeneral(jsondict) + if "SubstanceSourceMaterialPartDescription" == resource_type: + from . import substancesourcematerial + return substancesourcematerial.SubstanceSourceMaterialPartDescription(jsondict) + if "SubstanceSpecification" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecification(jsondict) + if "SubstanceSpecificationMoiety" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationMoiety(jsondict) + if "SubstanceSpecificationName" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationName(jsondict) + if "SubstanceSpecificationNameOfficial" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationNameOfficial(jsondict) + if "SubstanceSpecificationProperty" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationProperty(jsondict) + if "SubstanceSpecificationRelationship" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationRelationship(jsondict) + if "SubstanceSpecificationStructure" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationStructure(jsondict) + if "SubstanceSpecificationStructureIsotope" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationStructureIsotope(jsondict) + if "SubstanceSpecificationStructureIsotopeMolecularWeight" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationStructureIsotopeMolecularWeight(jsondict) + if "SubstanceSpecificationStructureRepresentation" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationStructureRepresentation(jsondict) + if "SubstanceSpecificationstr" == resource_type: + from . import substancespecification + return substancespecification.SubstanceSpecificationstr(jsondict) if "SupplyDelivery" == resource_type: from . import supplydelivery return supplydelivery.SupplyDelivery(jsondict) @@ -1310,12 +1820,9 @@ def instantiate(cls, resource_type, jsondict): if "SupplyRequest" == resource_type: from . import supplyrequest return supplyrequest.SupplyRequest(jsondict) - if "SupplyRequestOrderedItem" == resource_type: - from . import supplyrequest - return supplyrequest.SupplyRequestOrderedItem(jsondict) - if "SupplyRequestRequester" == resource_type: + if "SupplyRequestParameter" == resource_type: from . import supplyrequest - return supplyrequest.SupplyRequestRequester(jsondict) + return supplyrequest.SupplyRequestParameter(jsondict) if "Task" == resource_type: from . import task return task.Task(jsondict) @@ -1325,12 +1832,42 @@ def instantiate(cls, resource_type, jsondict): if "TaskOutput" == resource_type: from . import task return task.TaskOutput(jsondict) - if "TaskRequester" == resource_type: - from . import task - return task.TaskRequester(jsondict) if "TaskRestriction" == resource_type: from . import task return task.TaskRestriction(jsondict) + if "TerminologyCapabilities" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilities(jsondict) + if "TerminologyCapabilitiesClosure" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesClosure(jsondict) + if "TerminologyCapabilitiesCodeSystem" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesCodeSystem(jsondict) + if "TerminologyCapabilitiesCodeSystemVersion" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesCodeSystemVersion(jsondict) + if "TerminologyCapabilitiesCodeSystemVersionFilter" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesCodeSystemVersionFilter(jsondict) + if "TerminologyCapabilitiesExpansion" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesExpansion(jsondict) + if "TerminologyCapabilitiesExpansionParameter" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesExpansionParameter(jsondict) + if "TerminologyCapabilitiesImplementation" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesImplementation(jsondict) + if "TerminologyCapabilitiesSoftware" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesSoftware(jsondict) + if "TerminologyCapabilitiesTranslation" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesTranslation(jsondict) + if "TerminologyCapabilitiesValidateCode" == resource_type: + from . import terminologycapabilities + return terminologycapabilities.TerminologyCapabilitiesValidateCode(jsondict) if "TestReport" == resource_type: from . import testreport return testreport.TestReport(jsondict) @@ -1382,21 +1919,6 @@ def instantiate(cls, resource_type, jsondict): if "TestScriptOrigin" == resource_type: from . import testscript return testscript.TestScriptOrigin(jsondict) - if "TestScriptRule" == resource_type: - from . import testscript - return testscript.TestScriptRule(jsondict) - if "TestScriptRuleParam" == resource_type: - from . import testscript - return testscript.TestScriptRuleParam(jsondict) - if "TestScriptRuleset" == resource_type: - from . import testscript - return testscript.TestScriptRuleset(jsondict) - if "TestScriptRulesetRule" == resource_type: - from . import testscript - return testscript.TestScriptRulesetRule(jsondict) - if "TestScriptRulesetRuleParam" == resource_type: - from . import testscript - return testscript.TestScriptRulesetRuleParam(jsondict) if "TestScriptSetup" == resource_type: from . import testscript return testscript.TestScriptSetup(jsondict) @@ -1406,21 +1928,6 @@ def instantiate(cls, resource_type, jsondict): if "TestScriptSetupActionAssert" == resource_type: from . import testscript return testscript.TestScriptSetupActionAssert(jsondict) - if "TestScriptSetupActionAssertRule" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionAssertRule(jsondict) - if "TestScriptSetupActionAssertRuleParam" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionAssertRuleParam(jsondict) - if "TestScriptSetupActionAssertRuleset" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionAssertRuleset(jsondict) - if "TestScriptSetupActionAssertRulesetRule" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionAssertRulesetRule(jsondict) - if "TestScriptSetupActionAssertRulesetRuleParam" == resource_type: - from . import testscript - return testscript.TestScriptSetupActionAssertRulesetRuleParam(jsondict) if "TestScriptSetupActionOperation" == resource_type: from . import testscript return testscript.TestScriptSetupActionOperation(jsondict) @@ -1481,11 +1988,26 @@ def instantiate(cls, resource_type, jsondict): if "ValueSetExpansionParameter" == resource_type: from . import valueset return valueset.ValueSetExpansionParameter(jsondict) + if "VerificationResult" == resource_type: + from . import verificationresult + return verificationresult.VerificationResult(jsondict) + if "VerificationResultAttestation" == resource_type: + from . import verificationresult + return verificationresult.VerificationResultAttestation(jsondict) + if "VerificationResultPrimarySource" == resource_type: + from . import verificationresult + return verificationresult.VerificationResultPrimarySource(jsondict) + if "VerificationResultValidator" == resource_type: + from . import verificationresult + return verificationresult.VerificationResultValidator(jsondict) if "VisionPrescription" == resource_type: from . import visionprescription return visionprescription.VisionPrescription(jsondict) - if "VisionPrescriptionDispense" == resource_type: + if "VisionPrescriptionLensSpecification" == resource_type: + from . import visionprescription + return visionprescription.VisionPrescriptionLensSpecification(jsondict) + if "VisionPrescriptionLensSpecificationPrism" == resource_type: from . import visionprescription - return visionprescription.VisionPrescriptionDispense(jsondict) + return visionprescription.VisionPrescriptionLensSpecificationPrism(jsondict) from . import element return element.Element(jsondict) diff --git a/fhirclient/models/flag.py b/fhirclient/models/flag.py index bf0864faa..5c76ae4c1 100644 --- a/fhirclient/models/flag.py +++ b/fhirclient/models/flag.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Flag) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Flag) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -26,11 +26,11 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ Flag creator. - Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.category = None """ Clinical, administrative, etc.. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.code = None """ Coded or textual message to display to user. @@ -38,7 +38,7 @@ def __init__(self, jsondict=None, strict=True): self.encounter = None """ Alert relevant during encounter. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ Business identifier. @@ -54,7 +54,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Who/What is flag about?. - Type `FHIRReference` referencing `Patient, Location, Group, Organization, Practitioner, PlanDefinition, Medication, Procedure` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(Flag, self).__init__(jsondict=jsondict, strict=strict) @@ -62,7 +62,7 @@ def elementProperties(self): js = super(Flag, self).elementProperties() js.extend([ ("author", "author", fhirreference.FHIRReference, False, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, True), ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), diff --git a/fhirclient/models/flag_tests.py b/fhirclient/models/flag_tests.py index 600752ff4..624deee6e 100644 --- a/fhirclient/models/flag_tests.py +++ b/fhirclient/models/flag_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return flag.Flag(js) def testFlag1(self): - inst = self.instantiate_from("flag-example-encounter.json") + inst = self.instantiate_from("flag-example.json") self.assertIsNotNone(inst, "Must have instantiated a Flag instance") self.implFlag1(inst) @@ -32,38 +32,19 @@ def testFlag1(self): self.implFlag1(inst2) def implFlag1(self, inst): - self.assertEqual(inst.category.coding[0].code, "infection") - self.assertEqual(inst.category.coding[0].display, "Infection Control Level") - self.assertEqual(inst.category.coding[0].system, "http://example.org/local") - self.assertEqual(inst.code.coding[0].code, "l3") - self.assertEqual(inst.code.coding[0].display, "Follow Level 3 Protocol") - self.assertEqual(inst.code.coding[0].system, "http://example.org/local/if1") - self.assertEqual(inst.id, "example-encounter") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
Follow Infection Control Level 3 Protocol
") - self.assertEqual(inst.text.status, "generated") - - def testFlag2(self): - inst = self.instantiate_from("flag-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Flag instance") - self.implFlag2(inst) - - js = inst.as_json() - self.assertEqual("Flag", js["resourceType"]) - inst2 = flag.Flag(js) - self.implFlag2(inst2) - - def implFlag2(self, inst): - self.assertEqual(inst.category.coding[0].code, "admin") - self.assertEqual(inst.category.coding[0].display, "Admin") - self.assertEqual(inst.category.coding[0].system, "http://example.org/local") - self.assertEqual(inst.category.text, "admin") + self.assertEqual(inst.category[0].coding[0].code, "safety") + self.assertEqual(inst.category[0].coding[0].display, "Safety") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/flag-category") + self.assertEqual(inst.category[0].text, "Safety") self.assertEqual(inst.code.coding[0].code, "bigdog") self.assertEqual(inst.code.coding[0].display, "Big dog") self.assertEqual(inst.code.coding[0].system, "http://example.org/local") self.assertEqual(inst.code.text, "Patient has a big dog at his home. Always always wear a suit of armor or take other active counter-measures") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2016-12-01").date) self.assertEqual(inst.period.end.as_json(), "2016-12-01") self.assertEqual(inst.period.start.date, FHIRDate("2015-01-17").date) @@ -71,4 +52,29 @@ def implFlag2(self, inst): self.assertEqual(inst.status, "inactive") self.assertEqual(inst.text.div, "
Large Dog warning for Peter Patient
") self.assertEqual(inst.text.status, "generated") + + def testFlag2(self): + inst = self.instantiate_from("flag-example-encounter.json") + self.assertIsNotNone(inst, "Must have instantiated a Flag instance") + self.implFlag2(inst) + + js = inst.as_json() + self.assertEqual("Flag", js["resourceType"]) + inst2 = flag.Flag(js) + self.implFlag2(inst2) + + def implFlag2(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "infection") + self.assertEqual(inst.category[0].coding[0].display, "Infection Control Level") + self.assertEqual(inst.category[0].coding[0].system, "http://example.org/local") + self.assertEqual(inst.code.coding[0].code, "l3") + self.assertEqual(inst.code.coding[0].display, "Follow Level 3 Protocol") + self.assertEqual(inst.code.coding[0].system, "http://example.org/local/if1") + self.assertEqual(inst.id, "example-encounter") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
Follow Infection Control Level 3 Protocol
") + self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/goal.py b/fhirclient/models/goal.py index 7a8c40432..432b1f576 100644 --- a/fhirclient/models/goal.py +++ b/fhirclient/models/goal.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Goal) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Goal) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -26,9 +26,14 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.achievementStatus = None + """ in-progress | improving | worsening | no-change | achieved | + sustaining | not-achieved | no-progress | not-attainable. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.addresses = None """ Issues addressed by this goal. - List of `FHIRReference` items referencing `Condition, Observation, MedicationStatement, NutritionOrder, ProcedureRequest, RiskAssessment` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ E.g. Treatment, dietary, behavioral, etc.. @@ -40,12 +45,17 @@ def __init__(self, jsondict=None, strict=True): self.expressedBy = None """ Who's responsible for creating Goal?. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ External Ids for this goal. List of `Identifier` items (represented as `dict` in JSON). """ + self.lifecycleStatus = None + """ proposed | planned | accepted | active | on-hold | completed | + cancelled | entered-in-error | rejected. + Type `str`. """ + self.note = None """ Comments about the goal. List of `Annotation` items (represented as `dict` in JSON). """ @@ -56,7 +66,7 @@ def __init__(self, jsondict=None, strict=True): self.outcomeReference = None """ Observation that resulted from goal. - List of `FHIRReference` items referencing `Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.priority = None """ high-priority | medium-priority | low-priority. @@ -70,12 +80,6 @@ def __init__(self, jsondict=None, strict=True): """ When goal pursuit begins. Type `FHIRDate` (represented as `str` in JSON). """ - self.status = None - """ proposed | accepted | planned | in-progress | on-target | ahead-of- - target | behind-target | sustaining | achieved | on-hold | - cancelled | entered-in-error | rejected. - Type `str`. """ - self.statusDate = None """ When goal status took effect. Type `FHIRDate` (represented as `str` in JSON). """ @@ -86,33 +90,34 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Who this goal is intended for. - Type `FHIRReference` referencing `Patient, Group, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.target = None """ Target outcome for the goal. - Type `GoalTarget` (represented as `dict` in JSON). """ + List of `GoalTarget` items (represented as `dict` in JSON). """ super(Goal, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Goal, self).elementProperties() js.extend([ + ("achievementStatus", "achievementStatus", codeableconcept.CodeableConcept, False, None, False), ("addresses", "addresses", fhirreference.FHIRReference, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("description", "description", codeableconcept.CodeableConcept, False, None, True), ("expressedBy", "expressedBy", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("lifecycleStatus", "lifecycleStatus", str, False, None, True), ("note", "note", annotation.Annotation, True, None, False), ("outcomeCode", "outcomeCode", codeableconcept.CodeableConcept, True, None, False), ("outcomeReference", "outcomeReference", fhirreference.FHIRReference, True, None, False), ("priority", "priority", codeableconcept.CodeableConcept, False, None, False), ("startCodeableConcept", "startCodeableConcept", codeableconcept.CodeableConcept, False, "start", False), ("startDate", "startDate", fhirdate.FHIRDate, False, "start", False), - ("status", "status", str, False, None, True), ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), ("statusReason", "statusReason", str, False, None, False), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("target", "target", GoalTarget, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("target", "target", GoalTarget, True, None, False), ]) return js @@ -135,10 +140,18 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.detailBoolean = None + """ The target value to be achieved. + Type `bool`. """ + self.detailCodeableConcept = None """ The target value to be achieved. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.detailInteger = None + """ The target value to be achieved. + Type `int`. """ + self.detailQuantity = None """ The target value to be achieved. Type `Quantity` (represented as `dict` in JSON). """ @@ -147,6 +160,14 @@ def __init__(self, jsondict=None, strict=True): """ The target value to be achieved. Type `Range` (represented as `dict` in JSON). """ + self.detailRatio = None + """ The target value to be achieved. + Type `Ratio` (represented as `dict` in JSON). """ + + self.detailString = None + """ The target value to be achieved. + Type `str`. """ + self.dueDate = None """ Reach goal on or before. Type `FHIRDate` (represented as `str` in JSON). """ @@ -164,9 +185,13 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(GoalTarget, self).elementProperties() js.extend([ + ("detailBoolean", "detailBoolean", bool, False, "detail", False), ("detailCodeableConcept", "detailCodeableConcept", codeableconcept.CodeableConcept, False, "detail", False), + ("detailInteger", "detailInteger", int, False, "detail", False), ("detailQuantity", "detailQuantity", quantity.Quantity, False, "detail", False), ("detailRange", "detailRange", range.Range, False, "detail", False), + ("detailRatio", "detailRatio", ratio.Ratio, False, "detail", False), + ("detailString", "detailString", str, False, "detail", False), ("dueDate", "dueDate", fhirdate.FHIRDate, False, "due", False), ("dueDuration", "dueDuration", duration.Duration, False, "due", False), ("measure", "measure", codeableconcept.CodeableConcept, False, None, False), @@ -207,3 +232,7 @@ def elementProperties(self): from . import range except ImportError: range = sys.modules[__package__ + '.range'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/goal_tests.py b/fhirclient/models/goal_tests.py index de47f5b4b..3f39c17ae 100644 --- a/fhirclient/models/goal_tests.py +++ b/fhirclient/models/goal_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return goal.Goal(js) def testGoal1(self): - inst = self.instantiate_from("goal-example-stop-smoking.json") + inst = self.instantiate_from("goal-example.json") self.assertIsNotNone(inst, "Must have instantiated a Goal instance") self.implGoal1(inst) @@ -32,20 +32,41 @@ def testGoal1(self): self.implGoal1(inst2) def implGoal1(self, inst): - self.assertEqual(inst.description.text, "Stop smoking") - self.assertEqual(inst.id, "stop-smoking") + self.assertEqual(inst.category[0].coding[0].code, "dietary") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/goal-category") + self.assertEqual(inst.description.text, "Target weight is 160 to 180 lbs.") + self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].value, "123") - self.assertEqual(inst.outcomeCode[0].coding[0].code, "8517006") - self.assertEqual(inst.outcomeCode[0].coding[0].display, "Ex-smoker (finding)") - self.assertEqual(inst.outcomeCode[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.outcomeCode[0].text, "Former smoker") + self.assertEqual(inst.lifecycleStatus, "on-hold") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority.coding[0].code, "high-priority") + self.assertEqual(inst.priority.coding[0].display, "High Priority") + self.assertEqual(inst.priority.coding[0].system, "http://terminology.hl7.org/CodeSystem/goal-priority") + self.assertEqual(inst.priority.text, "high") self.assertEqual(inst.startDate.date, FHIRDate("2015-04-05").date) self.assertEqual(inst.startDate.as_json(), "2015-04-05") - self.assertEqual(inst.status, "achieved") + self.assertEqual(inst.statusDate.date, FHIRDate("2016-02-14").date) + self.assertEqual(inst.statusDate.as_json(), "2016-02-14") + self.assertEqual(inst.statusReason, "Patient wants to defer weight loss until after honeymoon.") + self.assertEqual(inst.target[0].detailRange.high.code, "[lb_av]") + self.assertEqual(inst.target[0].detailRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.target[0].detailRange.high.unit, "lbs") + self.assertEqual(inst.target[0].detailRange.high.value, 180) + self.assertEqual(inst.target[0].detailRange.low.code, "[lb_av]") + self.assertEqual(inst.target[0].detailRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.target[0].detailRange.low.unit, "lbs") + self.assertEqual(inst.target[0].detailRange.low.value, 160) + self.assertEqual(inst.target[0].dueDate.date, FHIRDate("2016-04-05").date) + self.assertEqual(inst.target[0].dueDate.as_json(), "2016-04-05") + self.assertEqual(inst.target[0].measure.coding[0].code, "3141-9") + self.assertEqual(inst.target[0].measure.coding[0].display, "Weight Measured") + self.assertEqual(inst.target[0].measure.coding[0].system, "http://loinc.org") self.assertEqual(inst.text.status, "additional") def testGoal2(self): - inst = self.instantiate_from("goal-example.json") + inst = self.instantiate_from("goal-example-stop-smoking.json") self.assertIsNotNone(inst, "Must have instantiated a Goal instance") self.implGoal2(inst) @@ -55,33 +76,22 @@ def testGoal2(self): self.implGoal2(inst2) def implGoal2(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "dietary") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/goal-category") - self.assertEqual(inst.description.text, "Target weight is 160 to 180 lbs.") - self.assertEqual(inst.id, "example") + self.assertEqual(inst.achievementStatus.coding[0].code, "achieved") + self.assertEqual(inst.achievementStatus.coding[0].display, "Achieved") + self.assertEqual(inst.achievementStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/goal-achievement") + self.assertEqual(inst.achievementStatus.text, "Achieved") + self.assertEqual(inst.description.text, "Stop smoking") + self.assertEqual(inst.id, "stop-smoking") self.assertEqual(inst.identifier[0].value, "123") - self.assertEqual(inst.priority.coding[0].code, "high-priority") - self.assertEqual(inst.priority.coding[0].display, "High Priority") - self.assertEqual(inst.priority.coding[0].system, "http://hl7.org/fhir/goal-priority") - self.assertEqual(inst.priority.text, "high") + self.assertEqual(inst.lifecycleStatus, "completed") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcomeCode[0].coding[0].code, "8517006") + self.assertEqual(inst.outcomeCode[0].coding[0].display, "Ex-smoker (finding)") + self.assertEqual(inst.outcomeCode[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.outcomeCode[0].text, "Former smoker") self.assertEqual(inst.startDate.date, FHIRDate("2015-04-05").date) self.assertEqual(inst.startDate.as_json(), "2015-04-05") - self.assertEqual(inst.status, "on-hold") - self.assertEqual(inst.statusDate.date, FHIRDate("2016-02-14").date) - self.assertEqual(inst.statusDate.as_json(), "2016-02-14") - self.assertEqual(inst.statusReason, "Patient wants to defer weight loss until after honeymoon.") - self.assertEqual(inst.target.detailRange.high.code, "[lb_av]") - self.assertEqual(inst.target.detailRange.high.system, "http://unitsofmeasure.org") - self.assertEqual(inst.target.detailRange.high.unit, "lbs") - self.assertEqual(inst.target.detailRange.high.value, 180) - self.assertEqual(inst.target.detailRange.low.code, "[lb_av]") - self.assertEqual(inst.target.detailRange.low.system, "http://unitsofmeasure.org") - self.assertEqual(inst.target.detailRange.low.unit, "lbs") - self.assertEqual(inst.target.detailRange.low.value, 160) - self.assertEqual(inst.target.dueDate.date, FHIRDate("2016-04-05").date) - self.assertEqual(inst.target.dueDate.as_json(), "2016-04-05") - self.assertEqual(inst.target.measure.coding[0].code, "3141-9") - self.assertEqual(inst.target.measure.coding[0].display, "Weight Measured") - self.assertEqual(inst.target.measure.coding[0].system, "http://loinc.org") self.assertEqual(inst.text.status, "additional") diff --git a/fhirclient/models/graphdefinition.py b/fhirclient/models/graphdefinition.py index 539ea04f8..5e6832e30 100644 --- a/fhirclient/models/graphdefinition.py +++ b/fhirclient/models/graphdefinition.py @@ -1,14 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/GraphDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/GraphDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class GraphDefinition(domainresource.DomainResource): - """ Definition of an graph of resources. + """ Definition of a graph of resources. A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The @@ -30,7 +30,7 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -74,11 +74,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this graph definition (globally unique). + """ Canonical identifier for this graph definition, represented as a + URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -157,9 +158,9 @@ def elementProperties(self): ("description", "description", str, False, None, False), ("max", "max", str, False, None, False), ("min", "min", int, False, None, False), - ("path", "path", str, False, None, True), + ("path", "path", str, False, None, False), ("sliceName", "sliceName", str, False, None, False), - ("target", "target", GraphDefinitionLinkTarget, True, None, True), + ("target", "target", GraphDefinitionLinkTarget, True, None, False), ]) return js @@ -186,6 +187,10 @@ def __init__(self, jsondict=None, strict=True): """ Additional links from target resource. List of `GraphDefinitionLink` items (represented as `dict` in JSON). """ + self.params = None + """ Criteria for reverse lookup. + Type `str`. """ + self.profile = None """ Profile for the target resource. Type `str`. """ @@ -201,6 +206,7 @@ def elementProperties(self): js.extend([ ("compartment", "compartment", GraphDefinitionLinkTargetCompartment, True, None, False), ("link", "link", GraphDefinitionLink, True, None, False), + ("params", "params", str, False, None, False), ("profile", "profile", str, False, None, False), ("type", "type", str, False, None, True), ]) @@ -237,6 +243,10 @@ def __init__(self, jsondict=None, strict=True): """ identical | matching | different | custom. Type `str`. """ + self.use = None + """ condition | requirement. + Type `str`. """ + super(GraphDefinitionLinkTargetCompartment, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -246,6 +256,7 @@ def elementProperties(self): ("description", "description", str, False, None, False), ("expression", "expression", str, False, None, False), ("rule", "rule", str, False, None, True), + ("use", "use", str, False, None, True), ]) return js diff --git a/fhirclient/models/graphdefinition_tests.py b/fhirclient/models/graphdefinition_tests.py index 3ffd42855..5c147c2f8 100644 --- a/fhirclient/models/graphdefinition_tests.py +++ b/fhirclient/models/graphdefinition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -42,10 +42,12 @@ def implGraphDefinition1(self, inst): self.assertEqual(inst.link[0].path, "Composition.section.entry") self.assertEqual(inst.link[0].target[0].compartment[0].code, "Patient") self.assertEqual(inst.link[0].target[0].compartment[0].rule, "identical") + self.assertEqual(inst.link[0].target[0].compartment[0].use, "requirement") self.assertEqual(inst.link[0].target[0].link[0].description, "Include any list entries") self.assertEqual(inst.link[0].target[0].link[0].path, "List.entry.item") self.assertEqual(inst.link[0].target[0].link[0].target[0].compartment[0].code, "Patient") self.assertEqual(inst.link[0].target[0].link[0].target[0].compartment[0].rule, "identical") + self.assertEqual(inst.link[0].target[0].link[0].target[0].compartment[0].use, "requirement") self.assertEqual(inst.link[0].target[0].link[0].target[0].type, "Resource") self.assertEqual(inst.link[0].target[0].type, "List") self.assertEqual(inst.name, "Document Generation Template") diff --git a/fhirclient/models/group.py b/fhirclient/models/group.py index 174d28474..08eda14cd 100644 --- a/fhirclient/models/group.py +++ b/fhirclient/models/group.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Group) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Group) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,7 +11,7 @@ class Group(domainresource.DomainResource): """ Group of multiple entities. Represents a defined collection of entities that may be discussed or acted - upon collectively but which are not expected to act collectively and are + upon collectively but which are not expected to act collectively, and are not formally or legally recognized; i.e. a collection of entities that isn't an Organization. """ @@ -35,7 +35,7 @@ def __init__(self, jsondict=None, strict=True): Type `bool`. """ self.characteristic = None - """ Trait of group members. + """ Include / Exclude group members by Trait. List of `GroupCharacteristic` items (represented as `dict` in JSON). """ self.code = None @@ -46,6 +46,10 @@ def __init__(self, jsondict=None, strict=True): """ Unique id. List of `Identifier` items (represented as `dict` in JSON). """ + self.managingEntity = None + """ Entity that is the custodian of the Group's definition. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.member = None """ Who or what is in group. List of `GroupMember` items (represented as `dict` in JSON). """ @@ -72,6 +76,7 @@ def elementProperties(self): ("characteristic", "characteristic", GroupCharacteristic, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("managingEntity", "managingEntity", fhirreference.FHIRReference, False, None, False), ("member", "member", GroupMember, True, None, False), ("name", "name", str, False, None, False), ("quantity", "quantity", int, False, None, False), @@ -83,9 +88,10 @@ def elementProperties(self): from . import backboneelement class GroupCharacteristic(backboneelement.BackboneElement): - """ Trait of group members. + """ Include / Exclude group members by Trait. - Identifies the traits shared by members of the group. + Identifies traits whose presence r absence is shared by members of the + group. """ resource_type = "GroupCharacteristic" @@ -126,6 +132,10 @@ def __init__(self, jsondict=None, strict=True): """ Value held by characteristic. Type `Range` (represented as `dict` in JSON). """ + self.valueReference = None + """ Value held by characteristic. + Type `FHIRReference` (represented as `dict` in JSON). """ + super(GroupCharacteristic, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -138,6 +148,7 @@ def elementProperties(self): ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), ("valueRange", "valueRange", range.Range, False, "value", True), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), ]) return js @@ -160,7 +171,7 @@ def __init__(self, jsondict=None, strict=True): self.entity = None """ Reference to the group member. - Type `FHIRReference` referencing `Patient, Practitioner, Device, Medication, Substance` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.inactive = None """ If member is no longer in group. diff --git a/fhirclient/models/group_tests.py b/fhirclient/models/group_tests.py index 03f08f81b..1c7b47599 100644 --- a/fhirclient/models/group_tests.py +++ b/fhirclient/models/group_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return group.Group(js) def testGroup1(self): - inst = self.instantiate_from("group-example-member.json") + inst = self.instantiate_from("group-example.json") self.assertIsNotNone(inst, "Must have instantiated a Group instance") self.implGroup1(inst) @@ -32,6 +32,36 @@ def testGroup1(self): self.implGroup1(inst2) def implGroup1(self, inst): + self.assertTrue(inst.actual) + self.assertEqual(inst.characteristic[0].code.text, "gender") + self.assertFalse(inst.characteristic[0].exclude) + self.assertEqual(inst.characteristic[0].valueCodeableConcept.text, "mixed") + self.assertEqual(inst.characteristic[1].code.text, "owner") + self.assertFalse(inst.characteristic[1].exclude) + self.assertEqual(inst.characteristic[1].valueCodeableConcept.text, "John Smith") + self.assertEqual(inst.code.text, "Horse") + self.assertEqual(inst.id, "101") + self.assertEqual(inst.identifier[0].system, "http://someveterinarianclinic.org/fhir/NamingSystem/herds") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "John's herd") + self.assertEqual(inst.quantity, 25) + self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.type, "animal") + + def testGroup2(self): + inst = self.instantiate_from("group-example-member.json") + self.assertIsNotNone(inst, "Must have instantiated a Group instance") + self.implGroup2(inst) + + js = inst.as_json() + self.assertEqual("Group", js["resourceType"]) + inst2 = group.Group(js) + self.implGroup2(inst2) + + def implGroup2(self, inst): self.assertTrue(inst.actual) self.assertEqual(inst.id, "102") self.assertEqual(inst.member[0].period.start.date, FHIRDate("2014-10-08").date) @@ -43,33 +73,67 @@ def implGroup1(self, inst): self.assertEqual(inst.member[2].period.start.as_json(), "2015-08-06") self.assertEqual(inst.member[3].period.start.date, FHIRDate("2015-08-06").date) self.assertEqual(inst.member[3].period.start.as_json(), "2015-08-06") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "additional") self.assertEqual(inst.type, "person") - def testGroup2(self): - inst = self.instantiate_from("group-example.json") + def testGroup3(self): + inst = self.instantiate_from("group-example-patientlist.json") self.assertIsNotNone(inst, "Must have instantiated a Group instance") - self.implGroup2(inst) + self.implGroup3(inst) js = inst.as_json() self.assertEqual("Group", js["resourceType"]) inst2 = group.Group(js) - self.implGroup2(inst2) + self.implGroup3(inst2) - def implGroup2(self, inst): + def implGroup3(self, inst): self.assertTrue(inst.actual) - self.assertEqual(inst.characteristic[0].code.text, "gender") + self.assertEqual(inst.characteristic[0].code.coding[0].code, "attributed-to") + self.assertEqual(inst.characteristic[0].code.coding[0].system, "http://example.org") + self.assertEqual(inst.characteristic[0].code.text, "Patients primarily attributed to") self.assertFalse(inst.characteristic[0].exclude) - self.assertEqual(inst.characteristic[0].valueCodeableConcept.text, "mixed") - self.assertEqual(inst.characteristic[1].code.text, "owner") - self.assertFalse(inst.characteristic[1].exclude) - self.assertEqual(inst.characteristic[1].valueCodeableConcept.text, "John Smith") - self.assertEqual(inst.code.text, "Horse") - self.assertEqual(inst.id, "101") - self.assertEqual(inst.identifier[0].system, "http://someveterinarianclinic.org/fhir/NamingSystem/herds") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertEqual(inst.name, "John's herd") - self.assertEqual(inst.quantity, 25) + self.assertEqual(inst.id, "example-patientlist") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.type, "person") + + def testGroup4(self): + inst = self.instantiate_from("group-example-herd1.json") + self.assertIsNotNone(inst, "Must have instantiated a Group instance") + self.implGroup4(inst) + + js = inst.as_json() + self.assertEqual("Group", js["resourceType"]) + inst2 = group.Group(js) + self.implGroup4(inst2) + + def implGroup4(self, inst): + self.assertTrue(inst.active) + self.assertTrue(inst.actual) + self.assertEqual(inst.characteristic[0].code.text, "gender") + self.assertFalse(inst.characteristic[0].exclude) + self.assertEqual(inst.characteristic[0].valueCodeableConcept.text, "female") + self.assertEqual(inst.code.coding[0].code, "388393002") + self.assertEqual(inst.code.coding[0].display, "Genus Sus (organism)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.coding[1].code, "POR") + self.assertEqual(inst.code.coding[1].display, "porcine") + self.assertEqual(inst.code.coding[1].system, "https://www.aphis.usda.gov") + self.assertEqual(inst.code.text, "Porcine") + self.assertEqual(inst.extension[0].url, "http://example.org/fhir/StructureDefinition/owner") + self.assertEqual(inst.id, "herd1") + self.assertEqual(inst.identifier[0].system, "https://vetmed.iastate.edu/vdl") + self.assertEqual(inst.identifier[0].value, "20171120-1234") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Breeding herd") + self.assertEqual(inst.quantity, 2500) + self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type, "animal") diff --git a/fhirclient/models/guidanceresponse.py b/fhirclient/models/guidanceresponse.py index 1c8633e6d..9cf35993c 100644 --- a/fhirclient/models/guidanceresponse.py +++ b/fhirclient/models/guidanceresponse.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/GuidanceResponse) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/GuidanceResponse) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -25,25 +25,33 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.context = None - """ Encounter or Episode during which the response was returned. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - self.dataRequirement = None """ Additional required data. List of `DataRequirement` items (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter during which the response was returned. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.evaluationMessage = None """ Messages resulting from the evaluation of the artifact or artifacts. - List of `FHIRReference` items referencing `OperationOutcome` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None """ Business identifier. - Type `Identifier` (represented as `dict` in JSON). """ + List of `Identifier` items (represented as `dict` in JSON). """ - self.module = None - """ A reference to a knowledge module. - Type `FHIRReference` referencing `ServiceDefinition` (represented as `dict` in JSON). """ + self.moduleCanonical = None + """ What guidance was requested. + Type `str`. """ + + self.moduleCodeableConcept = None + """ What guidance was requested. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.moduleUri = None + """ What guidance was requested. + Type `str`. """ self.note = None """ Additional notes about the response. @@ -55,27 +63,27 @@ def __init__(self, jsondict=None, strict=True): self.outputParameters = None """ The output parameters of the evaluation, if any. - Type `FHIRReference` referencing `Parameters` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.performer = None """ Device returning the guidance. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.reasonCodeableConcept = None - """ Reason for the response. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.reasonCode = None + """ Why guidance is needed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None - """ Reason for the response. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + """ Why guidance is needed. + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.requestId = None - """ The id of the request associated with this response, if any. - Type `str`. """ + self.requestIdentifier = None + """ The identifier of the request associated with this response, if any. + Type `Identifier` (represented as `dict` in JSON). """ self.result = None """ Proposed actions, if any. - Type `FHIRReference` referencing `CarePlan, RequestGroup` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ success | data-requested | data-required | in-progress | failure | @@ -84,25 +92,27 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Patient the request was performed for. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(GuidanceResponse, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(GuidanceResponse, self).elementProperties() js.extend([ - ("context", "context", fhirreference.FHIRReference, False, None, False), ("dataRequirement", "dataRequirement", datarequirement.DataRequirement, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("evaluationMessage", "evaluationMessage", fhirreference.FHIRReference, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("module", "module", fhirreference.FHIRReference, False, None, True), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("moduleCanonical", "moduleCanonical", str, False, "module", True), + ("moduleCodeableConcept", "moduleCodeableConcept", codeableconcept.CodeableConcept, False, "module", True), + ("moduleUri", "moduleUri", str, False, "module", True), ("note", "note", annotation.Annotation, True, None, False), ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, None, False), ("outputParameters", "outputParameters", fhirreference.FHIRReference, False, None, False), ("performer", "performer", fhirreference.FHIRReference, False, None, False), - ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), - ("requestId", "requestId", str, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("requestIdentifier", "requestIdentifier", identifier.Identifier, False, None, False), ("result", "result", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, True), ("subject", "subject", fhirreference.FHIRReference, False, None, False), diff --git a/fhirclient/models/guidanceresponse_tests.py b/fhirclient/models/guidanceresponse_tests.py index 3d19be7ef..d53054eb0 100644 --- a/fhirclient/models/guidanceresponse_tests.py +++ b/fhirclient/models/guidanceresponse_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -34,12 +34,17 @@ def testGuidanceResponse1(self): def implGuidanceResponse1(self, inst): self.assertEqual(inst.contained[0].id, "outputParameters1") self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.system, "http://example.org") - self.assertEqual(inst.identifier.value, "guidanceResponse1") + self.assertEqual(inst.identifier[0].system, "http://example.org") + self.assertEqual(inst.identifier[0].value, "guidanceResponse1") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.moduleUri, "http://someguidelineprovider.org/radiology-appropriateness-guidelines.html") self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2017-03-10T16:02:00Z").date) self.assertEqual(inst.occurrenceDateTime.as_json(), "2017-03-10T16:02:00Z") - self.assertEqual(inst.reasonCodeableConcept.text, "Guideline Appropriate Ordering Assessment") - self.assertEqual(inst.requestId, "guidanceRequest1") + self.assertEqual(inst.reasonCode[0].text, "Guideline Appropriate Ordering Assessment") + self.assertEqual(inst.requestIdentifier.system, "http://example.org") + self.assertEqual(inst.requestIdentifier.value, "guidanceRequest1") self.assertEqual(inst.status, "success") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/healthcareservice.py b/fhirclient/models/healthcareservice.py index f2078ba0b..08be149b9 100644 --- a/fhirclient/models/healthcareservice.py +++ b/fhirclient/models/healthcareservice.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -22,7 +22,7 @@ def __init__(self, jsondict=None, strict=True): """ self.active = None - """ Whether this healthcareservice is in active use. + """ Whether this HealthcareService record is in active use. Type `bool`. """ self.appointmentRequired = None @@ -39,7 +39,7 @@ def __init__(self, jsondict=None, strict=True): self.category = None """ Broad category of service being performed or delivered. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.characteristic = None """ Collection of characteristics (attributes). @@ -50,22 +50,22 @@ def __init__(self, jsondict=None, strict=True): elsewhere. Type `str`. """ + self.communication = None + """ The language that this service is offered in. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.coverageArea = None - """ Location(s) service is inteded for/available to. - List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + """ Location(s) service is intended for/available to. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.eligibility = None """ Specific eligibility requirements required to use the service. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.eligibilityNote = None - """ Describes the eligibility conditions for the service. - Type `str`. """ + List of `HealthcareServiceEligibility` items (represented as `dict` in JSON). """ self.endpoint = None - """ Technical endpoints providing access to services operated for the - location. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + """ Technical endpoints providing access to electronic services + operated for the healthcare service. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.extraDetails = None """ Extra details about the service that can't be placed in the other @@ -78,7 +78,7 @@ def __init__(self, jsondict=None, strict=True): self.location = None """ Location(s) where service may be provided. - List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.name = None """ Description of service as presented to a consumer while searching. @@ -92,13 +92,13 @@ def __init__(self, jsondict=None, strict=True): """ Facilitates quick identification of the service. Type `Attachment` (represented as `dict` in JSON). """ - self.programName = None - """ Program Names that categorize the service. - List of `str` items. """ + self.program = None + """ Programs that this service is applicable to. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.providedBy = None """ Organization that provides this service. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.referralMethod = None """ Ways that the service accepts referrals. @@ -129,12 +129,12 @@ def elementProperties(self): ("appointmentRequired", "appointmentRequired", bool, False, None, False), ("availabilityExceptions", "availabilityExceptions", str, False, None, False), ("availableTime", "availableTime", HealthcareServiceAvailableTime, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("characteristic", "characteristic", codeableconcept.CodeableConcept, True, None, False), ("comment", "comment", str, False, None, False), + ("communication", "communication", codeableconcept.CodeableConcept, True, None, False), ("coverageArea", "coverageArea", fhirreference.FHIRReference, True, None, False), - ("eligibility", "eligibility", codeableconcept.CodeableConcept, False, None, False), - ("eligibilityNote", "eligibilityNote", str, False, None, False), + ("eligibility", "eligibility", HealthcareServiceEligibility, True, None, False), ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), ("extraDetails", "extraDetails", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), @@ -142,7 +142,7 @@ def elementProperties(self): ("name", "name", str, False, None, False), ("notAvailable", "notAvailable", HealthcareServiceNotAvailable, True, None, False), ("photo", "photo", attachment.Attachment, False, None, False), - ("programName", "programName", str, True, None, False), + ("program", "program", codeableconcept.CodeableConcept, True, None, False), ("providedBy", "providedBy", fhirreference.FHIRReference, False, None, False), ("referralMethod", "referralMethod", codeableconcept.CodeableConcept, True, None, False), ("serviceProvisionCode", "serviceProvisionCode", codeableconcept.CodeableConcept, True, None, False), @@ -200,6 +200,42 @@ def elementProperties(self): return js +class HealthcareServiceEligibility(backboneelement.BackboneElement): + """ Specific eligibility requirements required to use the service. + + Does this service have specific eligibility requirements that need to be + met in order to use the service? + """ + + resource_type = "HealthcareServiceEligibility" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Coded value for the eligibility. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.comment = None + """ Describes the eligibility conditions for the service. + Type `str`. """ + + super(HealthcareServiceEligibility, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(HealthcareServiceEligibility, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("comment", "comment", str, False, None, False), + ]) + return js + + class HealthcareServiceNotAvailable(backboneelement.BackboneElement): """ Not available during this time due to provided reason. @@ -222,7 +258,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.during = None - """ Service not availablefrom this date. + """ Service not available from this date. Type `Period` (represented as `dict` in JSON). """ super(HealthcareServiceNotAvailable, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/healthcareservice_tests.py b/fhirclient/models/healthcareservice_tests.py index 58b5a1b8b..e1825fd65 100644 --- a/fhirclient/models/healthcareservice_tests.py +++ b/fhirclient/models/healthcareservice_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -51,18 +51,21 @@ def implHealthcareService1(self, inst): self.assertEqual(inst.availableTime[2].availableStartTime.as_json(), "09:30:00") self.assertEqual(inst.availableTime[2].daysOfWeek[0], "sat") self.assertEqual(inst.availableTime[2].daysOfWeek[1], "fri") - self.assertEqual(inst.category.coding[0].code, "8") - self.assertEqual(inst.category.coding[0].display, "Counselling") - self.assertEqual(inst.category.coding[0].system, "http://hl7.org/fhir/service-category") - self.assertEqual(inst.category.text, "Counselling") + self.assertEqual(inst.category[0].coding[0].code, "8") + self.assertEqual(inst.category[0].coding[0].display, "Counselling") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/service-category") + self.assertEqual(inst.category[0].text, "Counselling") self.assertEqual(inst.characteristic[0].coding[0].display, "Wheelchair access") self.assertEqual(inst.comment, "Providing Specialist psychology services to the greater Den Burg area, many years of experience dealing with PTSD issues") self.assertEqual(inst.contained[0].id, "DenBurg") - self.assertEqual(inst.eligibility.coding[0].display, "DVA Required") - self.assertEqual(inst.eligibilityNote, "Evidence of application for DVA status may be sufficient for commencing assessment") + self.assertEqual(inst.eligibility[0].code.coding[0].display, "DVA Required") + self.assertEqual(inst.eligibility[0].comment, "Evidence of application for DVA status may be sufficient for commencing assessment") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http://example.org/shared-ids") self.assertEqual(inst.identifier[0].value, "HS-12") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "Consulting psychologists and/or psychology services") self.assertEqual(inst.notAvailable[0].description, "Christmas/Boxing Day") self.assertEqual(inst.notAvailable[0].during.end.date, FHIRDate("2015-12-26").date) @@ -74,7 +77,7 @@ def implHealthcareService1(self, inst): self.assertEqual(inst.notAvailable[1].during.end.as_json(), "2016-01-01") self.assertEqual(inst.notAvailable[1].during.start.date, FHIRDate("2016-01-01").date) self.assertEqual(inst.notAvailable[1].during.start.as_json(), "2016-01-01") - self.assertEqual(inst.programName[0], "PTSD outreach") + self.assertEqual(inst.program[0].text, "PTSD outreach") self.assertEqual(inst.referralMethod[0].coding[0].code, "phone") self.assertEqual(inst.referralMethod[0].coding[0].display, "Phone") self.assertEqual(inst.referralMethod[1].coding[0].code, "fax") @@ -85,7 +88,7 @@ def implHealthcareService1(self, inst): self.assertEqual(inst.referralMethod[3].coding[0].display, "Secure Email") self.assertEqual(inst.serviceProvisionCode[0].coding[0].code, "cost") self.assertEqual(inst.serviceProvisionCode[0].coding[0].display, "Fees apply") - self.assertEqual(inst.serviceProvisionCode[0].coding[0].system, "http://hl7.org/fhir/service-provision-conditions") + self.assertEqual(inst.serviceProvisionCode[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/service-provision-conditions") self.assertEqual(inst.specialty[0].coding[0].code, "47505003") self.assertEqual(inst.specialty[0].coding[0].display, "Posttraumatic stress disorder") self.assertEqual(inst.specialty[0].coding[0].system, "http://snomed.info/sct") diff --git a/fhirclient/models/humanname.py b/fhirclient/models/humanname.py index 04c570a24..18b0d0d78 100644 --- a/fhirclient/models/humanname.py +++ b/fhirclient/models/humanname.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/HumanName) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/HumanName) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/identifier.py b/fhirclient/models/identifier.py index 3a55b8e1d..4cb86f75a 100644 --- a/fhirclient/models/identifier.py +++ b/fhirclient/models/identifier.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Identifier) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -10,7 +10,8 @@ class Identifier(element.Element): """ An identifier intended for computation. - A technical identifier - identifies some entity uniquely and unambiguously. + An identifier - identifies some entity uniquely and unambiguously. + Typically this is used for business identifiers. """ resource_type = "Identifier" @@ -25,7 +26,7 @@ def __init__(self, jsondict=None, strict=True): self.assigner = None """ Organization that issued id (may be just text). - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Time period when id is/was valid for use. @@ -40,7 +41,7 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.use = None - """ usual | official | temp | secondary (If known). + """ usual | official | temp | secondary | old (If known). Type `str`. """ self.value = None diff --git a/fhirclient/models/imagingmanifest.py b/fhirclient/models/imagingmanifest.py deleted file mode 100644 index 57304a3f3..000000000 --- a/fhirclient/models/imagingmanifest.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ImagingManifest) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class ImagingManifest(domainresource.DomainResource): - """ Key Object Selection. - - A text description of the DICOM SOP instances selected in the - ImagingManifest; or the reason for, or significance of, the selection. - """ - - resource_type = "ImagingManifest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.author = None - """ Author (human or machine). - Type `FHIRReference` referencing `Practitioner, Device, Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ - - self.authoringTime = None - """ Time when the selection of instances was made. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.description = None - """ Description text. - Type `str`. """ - - self.identifier = None - """ SOP Instance UID. - Type `Identifier` (represented as `dict` in JSON). """ - - self.patient = None - """ Patient of the selected objects. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ - - self.study = None - """ Study identity of the selected instances. - List of `ImagingManifestStudy` items (represented as `dict` in JSON). """ - - super(ImagingManifest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImagingManifest, self).elementProperties() - js.extend([ - ("author", "author", fhirreference.FHIRReference, False, None, False), - ("authoringTime", "authoringTime", fhirdate.FHIRDate, False, None, False), - ("description", "description", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, True), - ("study", "study", ImagingManifestStudy, True, None, True), - ]) - return js - - -from . import backboneelement - -class ImagingManifestStudy(backboneelement.BackboneElement): - """ Study identity of the selected instances. - - Study identity and locating information of the DICOM SOP instances in the - selection. - """ - - resource_type = "ImagingManifestStudy" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.endpoint = None - """ Study access service endpoint. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ - - self.imagingStudy = None - """ Reference to ImagingStudy. - Type `FHIRReference` referencing `ImagingStudy` (represented as `dict` in JSON). """ - - self.series = None - """ Series identity of the selected instances. - List of `ImagingManifestStudySeries` items (represented as `dict` in JSON). """ - - self.uid = None - """ Study instance UID. - Type `str`. """ - - super(ImagingManifestStudy, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImagingManifestStudy, self).elementProperties() - js.extend([ - ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), - ("imagingStudy", "imagingStudy", fhirreference.FHIRReference, False, None, False), - ("series", "series", ImagingManifestStudySeries, True, None, True), - ("uid", "uid", str, False, None, True), - ]) - return js - - -class ImagingManifestStudySeries(backboneelement.BackboneElement): - """ Series identity of the selected instances. - - Series identity and locating information of the DICOM SOP instances in the - selection. - """ - - resource_type = "ImagingManifestStudySeries" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.endpoint = None - """ Series access endpoint. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ - - self.instance = None - """ The selected instance. - List of `ImagingManifestStudySeriesInstance` items (represented as `dict` in JSON). """ - - self.uid = None - """ Series instance UID. - Type `str`. """ - - super(ImagingManifestStudySeries, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImagingManifestStudySeries, self).elementProperties() - js.extend([ - ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), - ("instance", "instance", ImagingManifestStudySeriesInstance, True, None, True), - ("uid", "uid", str, False, None, True), - ]) - return js - - -class ImagingManifestStudySeriesInstance(backboneelement.BackboneElement): - """ The selected instance. - - Identity and locating information of the selected DICOM SOP instances. - """ - - resource_type = "ImagingManifestStudySeriesInstance" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.sopClass = None - """ SOP class UID of instance. - Type `str`. """ - - self.uid = None - """ Selected instance UID. - Type `str`. """ - - super(ImagingManifestStudySeriesInstance, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImagingManifestStudySeriesInstance, self).elementProperties() - js.extend([ - ("sopClass", "sopClass", str, False, None, True), - ("uid", "uid", str, False, None, True), - ]) - return js - - -import sys -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/imagingmanifest_tests.py b/fhirclient/models/imagingmanifest_tests.py deleted file mode 100644 index 84abe2fa4..000000000 --- a/fhirclient/models/imagingmanifest_tests.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import imagingmanifest -from .fhirdate import FHIRDate - - -class ImagingManifestTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("ImagingManifest", js["resourceType"]) - return imagingmanifest.ImagingManifest(js) - - def testImagingManifest1(self): - inst = self.instantiate_from("imagingmanifest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ImagingManifest instance") - self.implImagingManifest1(inst) - - js = inst.as_json() - self.assertEqual("ImagingManifest", js["resourceType"]) - inst2 = imagingmanifest.ImagingManifest(js) - self.implImagingManifest1(inst2) - - def implImagingManifest1(self, inst): - self.assertEqual(inst.authoringTime.date, FHIRDate("2014-11-20T11:01:20-08:00").date) - self.assertEqual(inst.authoringTime.as_json(), "2014-11-20T11:01:20-08:00") - self.assertEqual(inst.description, "1 SC image (screen snapshot) and 2 CT images to share a chest CT exam") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.value, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092901") - self.assertEqual(inst.study[0].series[0].instance[0].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.7") - self.assertEqual(inst.study[0].series[0].instance[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092902") - self.assertEqual(inst.study[0].series[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16750.2599092901") - self.assertEqual(inst.study[0].series[1].instance[0].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.2") - self.assertEqual(inst.study[0].series[1].instance[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092903") - self.assertEqual(inst.study[0].series[1].instance[1].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.2") - self.assertEqual(inst.study[0].series[1].instance[1].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092904") - self.assertEqual(inst.study[0].series[1].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16750.2599092902") - self.assertEqual(inst.study[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16749.2599092904") - self.assertEqual(inst.text.div, "
A set of images to share accompanying an report document, including one SC image and two CT image
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/imagingstudy.py b/fhirclient/models/imagingstudy.py index d89fa3130..e73275e44 100644 --- a/fhirclient/models/imagingstudy.py +++ b/fhirclient/models/imagingstudy.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -28,42 +28,42 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.accession = None - """ Related workflow identifier ("Accession Number"). - Type `Identifier` (represented as `dict` in JSON). """ - - self.availability = None - """ ONLINE | OFFLINE | NEARLINE | UNAVAILABLE. - Type `str`. """ - self.basedOn = None """ Request fulfilled. - List of `FHIRReference` items referencing `ReferralRequest, CarePlan, ProcedureRequest` (represented as `dict` in JSON). """ - - self.context = None - """ Originating context. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.description = None """ Institution-generated description. Type `str`. """ + self.encounter = None + """ Encounter with which this imaging study is associated. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.endpoint = None """ Study access endpoint. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None - """ Other identifiers for the study. + """ Identifiers for the whole study. List of `Identifier` items (represented as `dict` in JSON). """ self.interpreter = None """ Who interpreted images. - List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.location = None + """ Where ImagingStudy occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.modalityList = None + self.modality = None """ All series modality if actual acquisition modalities. List of `Coding` items (represented as `dict` in JSON). """ + self.note = None + """ User-defined comments. + List of `Annotation` items (represented as `dict` in JSON). """ + self.numberOfInstances = None """ Number of Study Related Instances. Type `int`. """ @@ -72,25 +72,25 @@ def __init__(self, jsondict=None, strict=True): """ Number of Study Related Series. Type `int`. """ - self.patient = None - """ Who the images are of. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ - self.procedureCode = None """ The performed procedure code. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.procedureReference = None """ The performed Procedure reference. - List of `FHIRReference` items referencing `Procedure` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.reason = None + self.reasonCode = None """ Why the study was requested. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why was study performed. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.referrer = None """ Referring physician. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.series = None """ Each study has one or more series of instances. @@ -100,34 +100,39 @@ def __init__(self, jsondict=None, strict=True): """ When the study was started. Type `FHIRDate` (represented as `str` in JSON). """ - self.uid = None - """ Formal DICOM identifier for the study. + self.status = None + """ registered | available | cancelled | entered-in-error | unknown. Type `str`. """ + self.subject = None + """ Who or what is the subject of the study. + Type `FHIRReference` (represented as `dict` in JSON). """ + super(ImagingStudy, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ImagingStudy, self).elementProperties() js.extend([ - ("accession", "accession", identifier.Identifier, False, None, False), - ("availability", "availability", str, False, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), ("description", "description", str, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("interpreter", "interpreter", fhirreference.FHIRReference, True, None, False), - ("modalityList", "modalityList", coding.Coding, True, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), + ("modality", "modality", coding.Coding, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), ("numberOfInstances", "numberOfInstances", int, False, None, False), ("numberOfSeries", "numberOfSeries", int, False, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("procedureCode", "procedureCode", codeableconcept.CodeableConcept, True, None, False), - ("procedureReference", "procedureReference", fhirreference.FHIRReference, True, None, False), - ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("procedureReference", "procedureReference", fhirreference.FHIRReference, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("referrer", "referrer", fhirreference.FHIRReference, False, None, False), ("series", "series", ImagingStudySeries, True, None, False), ("started", "started", fhirdate.FHIRDate, False, None, False), - ("uid", "uid", str, False, None, True), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), ]) return js @@ -150,10 +155,6 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.availability = None - """ ONLINE | OFFLINE | NEARLINE | UNAVAILABLE. - Type `str`. """ - self.bodySite = None """ Body part examined. Type `Coding` (represented as `dict` in JSON). """ @@ -164,7 +165,7 @@ def __init__(self, jsondict=None, strict=True): self.endpoint = None """ Series access endpoint. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.instance = None """ A single SOP instance from the series. @@ -188,14 +189,18 @@ def __init__(self, jsondict=None, strict=True): self.performer = None """ Who performed the series. - List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + List of `ImagingStudySeriesPerformer` items (represented as `dict` in JSON). """ + + self.specimen = None + """ Specimen imaged. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.started = None """ When the series started. Type `FHIRDate` (represented as `str` in JSON). """ self.uid = None - """ Formal DICOM identifier for this series. + """ DICOM Series Instance UID for the series. Type `str`. """ super(ImagingStudySeries, self).__init__(jsondict=jsondict, strict=strict) @@ -203,7 +208,6 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(ImagingStudySeries, self).elementProperties() js.extend([ - ("availability", "availability", str, False, None, False), ("bodySite", "bodySite", coding.Coding, False, None, False), ("description", "description", str, False, None, False), ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), @@ -212,7 +216,8 @@ def elementProperties(self): ("modality", "modality", coding.Coding, False, None, True), ("number", "number", int, False, None, False), ("numberOfInstances", "numberOfInstances", int, False, None, False), - ("performer", "performer", fhirreference.FHIRReference, True, None, False), + ("performer", "performer", ImagingStudySeriesPerformer, True, None, False), + ("specimen", "specimen", fhirreference.FHIRReference, True, None, False), ("started", "started", fhirdate.FHIRDate, False, None, False), ("uid", "uid", str, False, None, True), ]) @@ -242,14 +247,14 @@ def __init__(self, jsondict=None, strict=True): self.sopClass = None """ DICOM class type. - Type `str`. """ + Type `Coding` (represented as `dict` in JSON). """ self.title = None """ Description of instance. Type `str`. """ self.uid = None - """ Formal DICOM identifier for this instance. + """ DICOM SOP Instance UID. Type `str`. """ super(ImagingStudySeriesInstance, self).__init__(jsondict=jsondict, strict=strict) @@ -258,14 +263,53 @@ def elementProperties(self): js = super(ImagingStudySeriesInstance, self).elementProperties() js.extend([ ("number", "number", int, False, None, False), - ("sopClass", "sopClass", str, False, None, True), + ("sopClass", "sopClass", coding.Coding, False, None, True), ("title", "title", str, False, None, False), ("uid", "uid", str, False, None, True), ]) return js +class ImagingStudySeriesPerformer(backboneelement.BackboneElement): + """ Who performed the series. + + Indicates who or what performed the series and how they were involved. + """ + + resource_type = "ImagingStudySeriesPerformer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actor = None + """ Who performed the series. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.function = None + """ Type of performance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ImagingStudySeriesPerformer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImagingStudySeriesPerformer, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] try: from . import codeableconcept except ImportError: diff --git a/fhirclient/models/imagingstudy_tests.py b/fhirclient/models/imagingstudy_tests.py index 3dd619087..e4cbf30fb 100644 --- a/fhirclient/models/imagingstudy_tests.py +++ b/fhirclient/models/imagingstudy_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,39 +32,45 @@ def testImagingStudy1(self): self.implImagingStudy1(inst2) def implImagingStudy1(self, inst): - self.assertEqual(inst.accession.type.coding[0].code, "ACSN") - self.assertEqual(inst.accession.type.coding[0].system, "http://hl7.org/fhir/v2/0203") - self.assertEqual(inst.accession.use, "usual") - self.assertEqual(inst.accession.value, "W12342398") - self.assertEqual(inst.availability, "ONLINE") - self.assertEqual(inst.description, "XR Wrist 3+ Views") self.assertEqual(inst.id, "example-xr") - self.assertEqual(inst.identifier[0].use, "secondary") - self.assertEqual(inst.identifier[0].value, "55551234") - self.assertEqual(inst.modalityList[0].code, "DX") - self.assertEqual(inst.modalityList[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.identifier[0].system, "urn:dicom:uid") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "urn:oid:2.16.124.113543.6003.1154777499.30246.19789.3503430046") + self.assertEqual(inst.identifier[1].type.coding[0].code, "ACSN") + self.assertEqual(inst.identifier[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[1].use, "usual") + self.assertEqual(inst.identifier[1].value, "W12342398") + self.assertEqual(inst.identifier[2].use, "secondary") + self.assertEqual(inst.identifier[2].value, "55551234") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.modality[0].code, "DX") + self.assertEqual(inst.modality[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.note[0].text, "XR Wrist 3+ Views") self.assertEqual(inst.numberOfInstances, 2) self.assertEqual(inst.numberOfSeries, 1) self.assertEqual(inst.procedureCode[0].coding[0].code, "RPID2589") self.assertEqual(inst.procedureCode[0].coding[0].display, "XR Wrist 3+ Views") self.assertEqual(inst.procedureCode[0].coding[0].system, "http://www.radlex.org") self.assertEqual(inst.procedureCode[0].text, "XR Wrist 3+ Views") - self.assertEqual(inst.reason.coding[0].code, "357009") - self.assertEqual(inst.reason.coding[0].display, "Closed fracture of trapezoidal bone of wrist") - self.assertEqual(inst.reason.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.series[0].availability, "ONLINE") + self.assertEqual(inst.reasonCode[0].coding[0].code, "357009") + self.assertEqual(inst.reasonCode[0].coding[0].display, "Closed fracture of trapezoidal bone of wrist") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.series[0].bodySite.code, "T-15460") self.assertEqual(inst.series[0].bodySite.display, "Wrist Joint") self.assertEqual(inst.series[0].bodySite.system, "http://snomed.info/sct") self.assertEqual(inst.series[0].description, "XR Wrist 3+ Views") self.assertEqual(inst.series[0].instance[0].number, 1) - self.assertEqual(inst.series[0].instance[0].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.2") + self.assertEqual(inst.series[0].instance[0].sopClass.code, "urn:oid:1.2.840.10008.5.1.4.1.1.2") + self.assertEqual(inst.series[0].instance[0].sopClass.system, "urn:ietf:rfc:3986") self.assertEqual(inst.series[0].instance[0].title, "PA VIEW") - self.assertEqual(inst.series[0].instance[0].uid, "urn:oid:2.16.124.113543.6003.1154777499.30246.19789.3503430045.1.1") + self.assertEqual(inst.series[0].instance[0].uid, "2.16.124.113543.6003.1154777499.30246.19789.3503430045.1.1") self.assertEqual(inst.series[0].instance[1].number, 2) - self.assertEqual(inst.series[0].instance[1].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.2") + self.assertEqual(inst.series[0].instance[1].sopClass.code, "urn:oid:1.2.840.10008.5.1.4.1.1.2") + self.assertEqual(inst.series[0].instance[1].sopClass.system, "urn:ietf:rfc:3986") self.assertEqual(inst.series[0].instance[1].title, "LL VIEW") - self.assertEqual(inst.series[0].instance[1].uid, "urn:oid:2.16.124.113543.6003.1154777499.30246.19789.3503430045.1.2") + self.assertEqual(inst.series[0].instance[1].uid, "2.16.124.113543.6003.1154777499.30246.19789.3503430045.1.2") self.assertEqual(inst.series[0].laterality.code, "419161000") self.assertEqual(inst.series[0].laterality.display, "Unilateral left") self.assertEqual(inst.series[0].laterality.system, "http://snomed.info/sct") @@ -72,14 +78,16 @@ def implImagingStudy1(self, inst): self.assertEqual(inst.series[0].modality.system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.series[0].number, 3) self.assertEqual(inst.series[0].numberOfInstances, 2) + self.assertEqual(inst.series[0].performer[0].function.coding[0].code, "PRF") + self.assertEqual(inst.series[0].performer[0].function.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.series[0].started.date, FHIRDate("2011-01-01T11:01:20+03:00").date) self.assertEqual(inst.series[0].started.as_json(), "2011-01-01T11:01:20+03:00") - self.assertEqual(inst.series[0].uid, "urn:oid:2.16.124.113543.6003.1154777499.30246.19789.3503430045.1") + self.assertEqual(inst.series[0].uid, "2.16.124.113543.6003.1154777499.30246.19789.3503430045.1") self.assertEqual(inst.started.date, FHIRDate("2017-01-01T11:01:20+03:00").date) self.assertEqual(inst.started.as_json(), "2017-01-01T11:01:20+03:00") + self.assertEqual(inst.status, "available") self.assertEqual(inst.text.div, "
XR Wrist 3+ Views. John Smith (MRN: 09236). Accession: W12342398. Performed: 2017-01-01. 1 series, 2 images.
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.uid, "urn:oid:2.16.124.113543.6003.1154777499.30246.19789.3503430046") def testImagingStudy2(self): inst = self.instantiate_from("imagingstudy-example.json") @@ -93,6 +101,11 @@ def testImagingStudy2(self): def implImagingStudy2(self, inst): self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "urn:dicom:uid") + self.assertEqual(inst.identifier[0].value, "urn:oid:2.16.124.113543.6003.1154777499.30246.19789.3503430045") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.numberOfInstances, 1) self.assertEqual(inst.numberOfSeries, 1) self.assertEqual(inst.series[0].bodySite.code, "67734004") @@ -100,16 +113,17 @@ def implImagingStudy2(self, inst): self.assertEqual(inst.series[0].bodySite.system, "http://snomed.info/sct") self.assertEqual(inst.series[0].description, "CT Surview 180") self.assertEqual(inst.series[0].instance[0].number, 1) - self.assertEqual(inst.series[0].instance[0].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.2") - self.assertEqual(inst.series[0].instance[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092903") + self.assertEqual(inst.series[0].instance[0].sopClass.code, "urn:oid:1.2.840.10008.5.1.4.1.1.2") + self.assertEqual(inst.series[0].instance[0].sopClass.system, "urn:ietf:rfc:3986") + self.assertEqual(inst.series[0].instance[0].uid, "2.16.124.113543.6003.189642796.63084.16748.2599092903") self.assertEqual(inst.series[0].modality.code, "CT") self.assertEqual(inst.series[0].modality.system, "http://dicom.nema.org/resources/ontology/DCM") self.assertEqual(inst.series[0].number, 3) self.assertEqual(inst.series[0].numberOfInstances, 1) - self.assertEqual(inst.series[0].uid, "urn:oid:2.16.124.113543.6003.2588828330.45298.17418.2723805630") + self.assertEqual(inst.series[0].uid, "2.16.124.113543.6003.2588828330.45298.17418.2723805630") self.assertEqual(inst.started.date, FHIRDate("2011-01-01T11:01:20+03:00").date) self.assertEqual(inst.started.as_json(), "2011-01-01T11:01:20+03:00") + self.assertEqual(inst.status, "available") self.assertEqual(inst.text.div, "
CT Chest. John Smith (MRN: 09236). Accession: W12342398. Performed: 2011-01-01. 3 series, 12 images.
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.uid, "urn:oid:2.16.124.113543.6003.1154777499.30246.19789.3503430045") diff --git a/fhirclient/models/immunization.py b/fhirclient/models/immunization.py index 95fde95cf..1c693f2ff 100644 --- a/fhirclient/models/immunization.py +++ b/fhirclient/models/immunization.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Immunization) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Immunization) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,10 +10,8 @@ class Immunization(domainresource.DomainResource): """ Immunization event information. - Describes the event of a patient being administered a vaccination or a - record of a vaccination as reported by a patient, a clinician or another - party and may include vaccine reaction information and what vaccination - protocol was followed. + Describes the event of a patient being administered a vaccine or a record + of an immunization as reported by a patient, a clinician or another party. """ resource_type = "Immunization" @@ -26,33 +24,37 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.date = None - """ Vaccination administration date. - Type `FHIRDate` (represented as `str` in JSON). """ - self.doseQuantity = None """ Amount of vaccine administered. Type `Quantity` (represented as `dict` in JSON). """ + self.education = None + """ Educational material presented to patient. + List of `ImmunizationEducation` items (represented as `dict` in JSON). """ + self.encounter = None - """ Encounter administered as part of. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + """ Encounter immunization was part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.expirationDate = None """ Vaccine expiration date. Type `FHIRDate` (represented as `str` in JSON). """ - self.explanation = None - """ Administration/non-administration reasons. - Type `ImmunizationExplanation` (represented as `dict` in JSON). """ + self.fundingSource = None + """ Funding source for the vaccine. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.identifier = None """ Business identifier. List of `Identifier` items (represented as `dict` in JSON). """ + self.isSubpotent = None + """ Dose potency. + Type `bool`. """ + self.location = None - """ Where vaccination occurred. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Where immunization occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ self.lotNumber = None """ Vaccine lot number. @@ -60,32 +62,56 @@ def __init__(self, jsondict=None, strict=True): self.manufacturer = None """ Vaccine manufacturer. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.notGiven = None - """ Flag for whether immunization was given. - Type `bool`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.note = None - """ Vaccination notes. + """ Additional immunization notes. List of `Annotation` items (represented as `dict` in JSON). """ + self.occurrenceDateTime = None + """ Vaccine administration date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.occurrenceString = None + """ Vaccine administration date. + Type `str`. """ + self.patient = None """ Who was immunized. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.practitioner = None + self.performer = None """ Who performed event. - List of `ImmunizationPractitioner` items (represented as `dict` in JSON). """ + List of `ImmunizationPerformer` items (represented as `dict` in JSON). """ self.primarySource = None """ Indicates context the data was recorded in. Type `bool`. """ + self.programEligibility = None + """ Patient eligibility for a vaccination program. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.protocolApplied = None + """ Protocol followed by the provider. + List of `ImmunizationProtocolApplied` items (represented as `dict` in JSON). """ + self.reaction = None """ Details of a reaction that follows immunization. List of `ImmunizationReaction` items (represented as `dict` in JSON). """ + self.reasonCode = None + """ Why immunization occurred. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.reasonReference = None + """ Why immunization occurred. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.recorded = None + """ When the immunization was first captured in the subject's record. + Type `FHIRDate` (represented as `str` in JSON). """ + self.reportOrigin = None """ Indicates the source of a secondarily reported record. Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -99,12 +125,16 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.status = None - """ completed | entered-in-error. + """ completed | entered-in-error | not-done. Type `str`. """ - self.vaccinationProtocol = None - """ What protocol was followed. - List of `ImmunizationVaccinationProtocol` items (represented as `dict` in JSON). """ + self.statusReason = None + """ Reason not done. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subpotentReason = None + """ Reason for being subpotent. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.vaccineCode = None """ Vaccine product administered. @@ -115,26 +145,34 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(Immunization, self).elementProperties() js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), ("doseQuantity", "doseQuantity", quantity.Quantity, False, None, False), + ("education", "education", ImmunizationEducation, True, None, False), ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), - ("explanation", "explanation", ImmunizationExplanation, False, None, False), + ("fundingSource", "fundingSource", codeableconcept.CodeableConcept, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("isSubpotent", "isSubpotent", bool, False, None, False), ("location", "location", fhirreference.FHIRReference, False, None, False), ("lotNumber", "lotNumber", str, False, None, False), ("manufacturer", "manufacturer", fhirreference.FHIRReference, False, None, False), - ("notGiven", "notGiven", bool, False, None, True), ("note", "note", annotation.Annotation, True, None, False), + ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", True), + ("occurrenceString", "occurrenceString", str, False, "occurrence", True), ("patient", "patient", fhirreference.FHIRReference, False, None, True), - ("practitioner", "practitioner", ImmunizationPractitioner, True, None, False), - ("primarySource", "primarySource", bool, False, None, True), + ("performer", "performer", ImmunizationPerformer, True, None, False), + ("primarySource", "primarySource", bool, False, None, False), + ("programEligibility", "programEligibility", codeableconcept.CodeableConcept, True, None, False), + ("protocolApplied", "protocolApplied", ImmunizationProtocolApplied, True, None, False), ("reaction", "reaction", ImmunizationReaction, True, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("recorded", "recorded", fhirdate.FHIRDate, False, None, False), ("reportOrigin", "reportOrigin", codeableconcept.CodeableConcept, False, None, False), ("route", "route", codeableconcept.CodeableConcept, False, None, False), ("site", "site", codeableconcept.CodeableConcept, False, None, False), ("status", "status", str, False, None, True), - ("vaccinationProtocol", "vaccinationProtocol", ImmunizationVaccinationProtocol, True, None, False), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), + ("subpotentReason", "subpotentReason", codeableconcept.CodeableConcept, True, None, False), ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, False, None, True), ]) return js @@ -142,13 +180,14 @@ def elementProperties(self): from . import backboneelement -class ImmunizationExplanation(backboneelement.BackboneElement): - """ Administration/non-administration reasons. +class ImmunizationEducation(backboneelement.BackboneElement): + """ Educational material presented to patient. - Reasons why a vaccine was or was not administered. + Educational material presented to the patient (or guardian) at the time of + vaccine administration. """ - resource_type = "ImmunizationExplanation" + resource_type = "ImmunizationEducation" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -158,32 +197,42 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.reason = None - """ Why immunization occurred. - List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.documentType = None + """ Educational material document identifier. + Type `str`. """ - self.reasonNotGiven = None - """ Why immunization did not occur. - List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.presentationDate = None + """ Educational material presentation date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.publicationDate = None + """ Educational material publication date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.reference = None + """ Educational material reference pointer. + Type `str`. """ - super(ImmunizationExplanation, self).__init__(jsondict=jsondict, strict=strict) + super(ImmunizationEducation, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImmunizationExplanation, self).elementProperties() + js = super(ImmunizationEducation, self).elementProperties() js.extend([ - ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), - ("reasonNotGiven", "reasonNotGiven", codeableconcept.CodeableConcept, True, None, False), + ("documentType", "documentType", str, False, None, False), + ("presentationDate", "presentationDate", fhirdate.FHIRDate, False, None, False), + ("publicationDate", "publicationDate", fhirdate.FHIRDate, False, None, False), + ("reference", "reference", str, False, None, False), ]) return js -class ImmunizationPractitioner(backboneelement.BackboneElement): +class ImmunizationPerformer(backboneelement.BackboneElement): """ Who performed event. - Indicates who or what performed the event. + Indicates who performed the immunization event. """ - resource_type = "ImmunizationPractitioner" + resource_type = "ImmunizationPerformer" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -194,32 +243,32 @@ def __init__(self, jsondict=None, strict=True): """ self.actor = None - """ Individual who was performing. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + """ Individual or organization who was performing. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.role = None + self.function = None """ What type of performance was done. Type `CodeableConcept` (represented as `dict` in JSON). """ - super(ImmunizationPractitioner, self).__init__(jsondict=jsondict, strict=strict) + super(ImmunizationPerformer, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImmunizationPractitioner, self).elementProperties() + js = super(ImmunizationPerformer, self).elementProperties() js.extend([ ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), ]) return js -class ImmunizationReaction(backboneelement.BackboneElement): - """ Details of a reaction that follows immunization. +class ImmunizationProtocolApplied(backboneelement.BackboneElement): + """ Protocol followed by the provider. - Categorical data indicating that an adverse event is associated in time to - an immunization. + The protocol (set of recommendations) being followed by the provider who + administered the dose. """ - resource_type = "ImmunizationReaction" + resource_type = "ImmunizationProtocolApplied" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -229,38 +278,58 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.date = None - """ When reaction started. - Type `FHIRDate` (represented as `str` in JSON). """ + self.authority = None + """ Who is responsible for publishing the recommendations. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.detail = None - """ Additional information on reaction. - Type `FHIRReference` referencing `Observation` (represented as `dict` in JSON). """ + self.doseNumberPositiveInt = None + """ Dose number within series. + Type `int`. """ - self.reported = None - """ Indicates self-reported reaction. - Type `bool`. """ + self.doseNumberString = None + """ Dose number within series. + Type `str`. """ - super(ImmunizationReaction, self).__init__(jsondict=jsondict, strict=strict) + self.series = None + """ Name of vaccine series. + Type `str`. """ + + self.seriesDosesPositiveInt = None + """ Recommended number of doses for immunity. + Type `int`. """ + + self.seriesDosesString = None + """ Recommended number of doses for immunity. + Type `str`. """ + + self.targetDisease = None + """ Vaccine preventatable disease being targetted. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(ImmunizationProtocolApplied, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImmunizationReaction, self).elementProperties() + js = super(ImmunizationProtocolApplied, self).elementProperties() js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, False), - ("detail", "detail", fhirreference.FHIRReference, False, None, False), - ("reported", "reported", bool, False, None, False), + ("authority", "authority", fhirreference.FHIRReference, False, None, False), + ("doseNumberPositiveInt", "doseNumberPositiveInt", int, False, "doseNumber", True), + ("doseNumberString", "doseNumberString", str, False, "doseNumber", True), + ("series", "series", str, False, None, False), + ("seriesDosesPositiveInt", "seriesDosesPositiveInt", int, False, "seriesDoses", False), + ("seriesDosesString", "seriesDosesString", str, False, "seriesDoses", False), + ("targetDisease", "targetDisease", codeableconcept.CodeableConcept, True, None, False), ]) return js -class ImmunizationVaccinationProtocol(backboneelement.BackboneElement): - """ What protocol was followed. +class ImmunizationReaction(backboneelement.BackboneElement): + """ Details of a reaction that follows immunization. - Contains information about the protocol(s) under which the vaccine was - administered. + Categorical data indicating that an adverse event is associated in time to + an immunization. """ - resource_type = "ImmunizationVaccinationProtocol" + resource_type = "ImmunizationReaction" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -270,51 +339,26 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.authority = None - """ Who is responsible for protocol. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.description = None - """ Details of vaccine protocol. - Type `str`. """ - - self.doseSequence = None - """ Dose number within series. - Type `int`. """ - - self.doseStatus = None - """ Indicates if dose counts towards immunity. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.doseStatusReason = None - """ Why dose does (not) count. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.series = None - """ Name of vaccine series. - Type `str`. """ + self.date = None + """ When reaction started. + Type `FHIRDate` (represented as `str` in JSON). """ - self.seriesDoses = None - """ Recommended number of doses for immunity. - Type `int`. """ + self.detail = None + """ Additional information on reaction. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.targetDisease = None - """ Disease immunized against. - List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.reported = None + """ Indicates self-reported reaction. + Type `bool`. """ - super(ImmunizationVaccinationProtocol, self).__init__(jsondict=jsondict, strict=strict) + super(ImmunizationReaction, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImmunizationVaccinationProtocol, self).elementProperties() + js = super(ImmunizationReaction, self).elementProperties() js.extend([ - ("authority", "authority", fhirreference.FHIRReference, False, None, False), - ("description", "description", str, False, None, False), - ("doseSequence", "doseSequence", int, False, None, False), - ("doseStatus", "doseStatus", codeableconcept.CodeableConcept, False, None, True), - ("doseStatusReason", "doseStatusReason", codeableconcept.CodeableConcept, False, None, False), - ("series", "series", str, False, None, False), - ("seriesDoses", "seriesDoses", int, False, None, False), - ("targetDisease", "targetDisease", codeableconcept.CodeableConcept, True, None, True), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("detail", "detail", fhirreference.FHIRReference, False, None, False), + ("reported", "reported", bool, False, None, False), ]) return js diff --git a/fhirclient/models/immunization_tests.py b/fhirclient/models/immunization_tests.py index 777b7d998..5359747b4 100644 --- a/fhirclient/models/immunization_tests.py +++ b/fhirclient/models/immunization_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return immunization.Immunization(js) def testImmunization1(self): - inst = self.instantiate_from("immunization-example-historical.json") + inst = self.instantiate_from("immunization-example.json") self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") self.implImmunization1(inst) @@ -32,16 +32,72 @@ def testImmunization1(self): self.implImmunization1(inst2) def implImmunization1(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2012-01-15").date) - self.assertEqual(inst.date.as_json(), "2012-01-15") + self.assertEqual(inst.doseQuantity.code, "mg") + self.assertEqual(inst.doseQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.doseQuantity.value, 5) + self.assertEqual(inst.education[0].documentType, "253088698300010311120702") + self.assertEqual(inst.education[0].presentationDate.date, FHIRDate("2013-01-10").date) + self.assertEqual(inst.education[0].presentationDate.as_json(), "2013-01-10") + self.assertEqual(inst.education[0].publicationDate.date, FHIRDate("2012-07-02").date) + self.assertEqual(inst.education[0].publicationDate.as_json(), "2012-07-02") + self.assertEqual(inst.expirationDate.date, FHIRDate("2015-02-15").date) + self.assertEqual(inst.expirationDate.as_json(), "2015-02-15") + self.assertEqual(inst.fundingSource.coding[0].code, "private") + self.assertEqual(inst.fundingSource.coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-funding-source") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1234") + self.assertTrue(inst.isSubpotent) + self.assertEqual(inst.lotNumber, "AAJN11K") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "Notes on adminstration of vaccine") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2013-01-10").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2013-01-10") + self.assertEqual(inst.performer[0].function.coding[0].code, "OP") + self.assertEqual(inst.performer[0].function.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0443") + self.assertEqual(inst.performer[1].function.coding[0].code, "AP") + self.assertEqual(inst.performer[1].function.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0443") + self.assertTrue(inst.primarySource) + self.assertEqual(inst.programEligibility[0].coding[0].code, "ineligible") + self.assertEqual(inst.programEligibility[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-program-eligibility") + self.assertEqual(inst.reasonCode[0].coding[0].code, "429060002") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.route.coding[0].code, "IM") + self.assertEqual(inst.route.coding[0].display, "Injection, intramuscular") + self.assertEqual(inst.route.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration") + self.assertEqual(inst.site.coding[0].code, "LA") + self.assertEqual(inst.site.coding[0].display, "left arm") + self.assertEqual(inst.site.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActSite") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.vaccineCode.coding[0].code, "FLUVAX") + self.assertEqual(inst.vaccineCode.coding[0].system, "urn:oid:1.2.36.1.2001.1005.17") + self.assertEqual(inst.vaccineCode.text, "Fluvax (Influenza)") + + def testImmunization2(self): + inst = self.instantiate_from("immunization-example-historical.json") + self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") + self.implImmunization2(inst) + + js = inst.as_json() + self.assertEqual("Immunization", js["resourceType"]) + inst2 = immunization.Immunization(js) + self.implImmunization2(inst2) + + def implImmunization2(self, inst): self.assertEqual(inst.id, "historical") self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1234") - self.assertFalse(inst.notGiven) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "Notes on adminstration of a historical vaccine") + self.assertEqual(inst.occurrenceString, "January 2012") self.assertFalse(inst.primarySource) self.assertEqual(inst.reportOrigin.coding[0].code, "record") - self.assertEqual(inst.reportOrigin.coding[0].system, "http://hl7.org/fhir/immunization-origin") + self.assertEqual(inst.reportOrigin.coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-origin") self.assertEqual(inst.reportOrigin.text, "Written Record") self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") @@ -49,86 +105,140 @@ def implImmunization1(self, inst): self.assertEqual(inst.vaccineCode.coding[0].system, "urn:oid:1.2.36.1.2001.1005.17") self.assertEqual(inst.vaccineCode.text, "Influenza") - def testImmunization2(self): + def testImmunization3(self): + inst = self.instantiate_from("immunization-example-protocol.json") + self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") + self.implImmunization3(inst) + + js = inst.as_json() + self.assertEqual("Immunization", js["resourceType"]) + inst2 = immunization.Immunization(js) + self.implImmunization3(inst2) + + def implImmunization3(self, inst): + self.assertEqual(inst.doseQuantity.code, "mg") + self.assertEqual(inst.doseQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.doseQuantity.value, 5) + self.assertEqual(inst.expirationDate.date, FHIRDate("2018-12-15").date) + self.assertEqual(inst.expirationDate.as_json(), "2018-12-15") + self.assertEqual(inst.fundingSource.coding[0].code, "private") + self.assertEqual(inst.fundingSource.coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-funding-source") + self.assertEqual(inst.id, "protocol") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1234") + self.assertFalse(inst.isSubpotent) + self.assertEqual(inst.lotNumber, "PT123F") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2018-06-18").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2018-06-18") + self.assertEqual(inst.performer[0].function.coding[0].code, "OP") + self.assertEqual(inst.performer[0].function.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0443") + self.assertEqual(inst.performer[1].function.coding[0].code, "AP") + self.assertEqual(inst.performer[1].function.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0443") + self.assertTrue(inst.primarySource) + self.assertEqual(inst.programEligibility[0].coding[0].code, "ineligible") + self.assertEqual(inst.programEligibility[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-program-eligibility") + self.assertEqual(inst.protocolApplied[0].doseNumberPositiveInt, 1) + self.assertEqual(inst.protocolApplied[0].series, "2-dose") + self.assertEqual(inst.protocolApplied[0].targetDisease[0].coding[0].code, "40468003") + self.assertEqual(inst.protocolApplied[0].targetDisease[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.protocolApplied[1].doseNumberPositiveInt, 2) + self.assertEqual(inst.protocolApplied[1].series, "3-dose") + self.assertEqual(inst.protocolApplied[1].targetDisease[0].coding[0].code, "66071002") + self.assertEqual(inst.protocolApplied[1].targetDisease[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.route.coding[0].code, "IM") + self.assertEqual(inst.route.coding[0].display, "Injection, intramuscular") + self.assertEqual(inst.route.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration") + self.assertEqual(inst.site.coding[0].code, "LA") + self.assertEqual(inst.site.coding[0].display, "left arm") + self.assertEqual(inst.site.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActSite") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.vaccineCode.coding[0].code, "104") + self.assertEqual(inst.vaccineCode.coding[0].system, "http://hl7.org/fhir/sid/cvx") + self.assertEqual(inst.vaccineCode.text, "Twinrix (HepA/HepB)") + + def testImmunization4(self): inst = self.instantiate_from("immunization-example-refused.json") self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") - self.implImmunization2(inst) + self.implImmunization4(inst) js = inst.as_json() self.assertEqual("Immunization", js["resourceType"]) inst2 = immunization.Immunization(js) - self.implImmunization2(inst2) + self.implImmunization4(inst2) - def implImmunization2(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2013-01-10").date) - self.assertEqual(inst.date.as_json(), "2013-01-10") - self.assertEqual(inst.explanation.reasonNotGiven[0].coding[0].code, "MEDPREC") - self.assertEqual(inst.explanation.reasonNotGiven[0].coding[0].display, "medical precaution") - self.assertEqual(inst.explanation.reasonNotGiven[0].coding[0].system, "http://hl7.org/fhir/v3/ActReason") + def implImmunization4(self, inst): self.assertEqual(inst.id, "notGiven") - self.assertTrue(inst.notGiven) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2013-01-10").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2013-01-10") self.assertTrue(inst.primarySource) - self.assertEqual(inst.status, "completed") + self.assertEqual(inst.status, "not-done") + self.assertEqual(inst.statusReason.coding[0].code, "MEDPREC") + self.assertEqual(inst.statusReason.coding[0].display, "medical precaution") + self.assertEqual(inst.statusReason.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.vaccineCode.coding[0].code, "01") self.assertEqual(inst.vaccineCode.coding[0].display, "DTP") self.assertEqual(inst.vaccineCode.coding[0].system, "http://hl7.org/fhir/sid/cvx") - def testImmunization3(self): - inst = self.instantiate_from("immunization-example.json") + def testImmunization5(self): + inst = self.instantiate_from("immunization-example-subpotent.json") self.assertIsNotNone(inst, "Must have instantiated a Immunization instance") - self.implImmunization3(inst) + self.implImmunization5(inst) js = inst.as_json() self.assertEqual("Immunization", js["resourceType"]) inst2 = immunization.Immunization(js) - self.implImmunization3(inst2) + self.implImmunization5(inst2) - def implImmunization3(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2013-01-10").date) - self.assertEqual(inst.date.as_json(), "2013-01-10") - self.assertEqual(inst.doseQuantity.code, "mg") + def implImmunization5(self, inst): + self.assertEqual(inst.doseQuantity.code, "ml") self.assertEqual(inst.doseQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.doseQuantity.value, 5) - self.assertEqual(inst.expirationDate.date, FHIRDate("2015-02-15").date) - self.assertEqual(inst.expirationDate.as_json(), "2015-02-15") - self.assertEqual(inst.explanation.reason[0].coding[0].code, "429060002") - self.assertEqual(inst.explanation.reason[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "example") + self.assertEqual(inst.doseQuantity.value, 0.5) + self.assertEqual(inst.education[0].documentType, "253088698300010311120702") + self.assertEqual(inst.education[0].presentationDate.date, FHIRDate("2013-01-10").date) + self.assertEqual(inst.education[0].presentationDate.as_json(), "2013-01-10") + self.assertEqual(inst.education[0].publicationDate.date, FHIRDate("2012-07-02").date) + self.assertEqual(inst.education[0].publicationDate.as_json(), "2012-07-02") + self.assertEqual(inst.expirationDate.date, FHIRDate("2015-02-28").date) + self.assertEqual(inst.expirationDate.as_json(), "2015-02-28") + self.assertEqual(inst.fundingSource.coding[0].code, "private") + self.assertEqual(inst.fundingSource.coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-funding-source") + self.assertEqual(inst.id, "subpotent") self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1234") + self.assertFalse(inst.isSubpotent) self.assertEqual(inst.lotNumber, "AAJN11K") - self.assertFalse(inst.notGiven) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "Notes on adminstration of vaccine") - self.assertEqual(inst.practitioner[0].role.coding[0].code, "OP") - self.assertEqual(inst.practitioner[0].role.coding[0].system, "http://hl7.org/fhir/v2/0443") - self.assertEqual(inst.practitioner[1].role.coding[0].code, "AP") - self.assertEqual(inst.practitioner[1].role.coding[0].system, "http://hl7.org/fhir/v2/0443") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2015-01-15").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2015-01-15") + self.assertEqual(inst.performer[0].function.coding[0].code, "OP") + self.assertEqual(inst.performer[0].function.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0443") + self.assertEqual(inst.performer[1].function.coding[0].code, "AP") + self.assertEqual(inst.performer[1].function.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0443") self.assertTrue(inst.primarySource) - self.assertEqual(inst.reaction[0].date.date, FHIRDate("2013-01-10").date) - self.assertEqual(inst.reaction[0].date.as_json(), "2013-01-10") - self.assertTrue(inst.reaction[0].reported) + self.assertEqual(inst.programEligibility[0].coding[0].code, "ineligible") + self.assertEqual(inst.programEligibility[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-program-eligibility") self.assertEqual(inst.route.coding[0].code, "IM") self.assertEqual(inst.route.coding[0].display, "Injection, intramuscular") - self.assertEqual(inst.route.coding[0].system, "http://hl7.org/fhir/v3/RouteOfAdministration") - self.assertEqual(inst.site.coding[0].code, "LA") - self.assertEqual(inst.site.coding[0].display, "left arm") - self.assertEqual(inst.site.coding[0].system, "http://hl7.org/fhir/v3/ActSite") + self.assertEqual(inst.route.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration") + self.assertEqual(inst.site.coding[0].code, "LT") + self.assertEqual(inst.site.coding[0].display, "left thigh") + self.assertEqual(inst.site.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActSite") self.assertEqual(inst.status, "completed") + self.assertEqual(inst.subpotentReason[0].coding[0].code, "partial") + self.assertEqual(inst.subpotentReason[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-subpotent-reason") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.vaccinationProtocol[0].description, "Vaccination Protocol Sequence 1") - self.assertEqual(inst.vaccinationProtocol[0].doseSequence, 1) - self.assertEqual(inst.vaccinationProtocol[0].doseStatus.coding[0].code, "count") - self.assertEqual(inst.vaccinationProtocol[0].doseStatus.coding[0].display, "Counts") - self.assertEqual(inst.vaccinationProtocol[0].doseStatus.coding[0].system, "http://hl7.org/fhir/vaccination-protocol-dose-status") - self.assertEqual(inst.vaccinationProtocol[0].doseStatusReason.coding[0].code, "coldchbrk") - self.assertEqual(inst.vaccinationProtocol[0].doseStatusReason.coding[0].display, "Cold chain break") - self.assertEqual(inst.vaccinationProtocol[0].doseStatusReason.coding[0].system, "http://hl7.org/fhir/vaccination-protocol-dose-status-reason") - self.assertEqual(inst.vaccinationProtocol[0].series, "Vaccination Series 1") - self.assertEqual(inst.vaccinationProtocol[0].seriesDoses, 2) - self.assertEqual(inst.vaccinationProtocol[0].targetDisease[0].coding[0].code, "1857005") - self.assertEqual(inst.vaccinationProtocol[0].targetDisease[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.vaccineCode.coding[0].code, "FLUVAX") + self.assertEqual(inst.vaccineCode.coding[0].code, "GNHEP") self.assertEqual(inst.vaccineCode.coding[0].system, "urn:oid:1.2.36.1.2001.1005.17") - self.assertEqual(inst.vaccineCode.text, "Fluvax (Influenza)") + self.assertEqual(inst.vaccineCode.text, "Hepatitis B") diff --git a/fhirclient/models/immunizationevaluation.py b/fhirclient/models/immunizationevaluation.py new file mode 100644 index 000000000..e0961c28a --- /dev/null +++ b/fhirclient/models/immunizationevaluation.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImmunizationEvaluation) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class ImmunizationEvaluation(domainresource.DomainResource): + """ Immunization evaluation information. + + Describes a comparison of an immunization event against published + recommendations to determine if the administration is "valid" in relation + to those recommendations. + """ + + resource_type = "ImmunizationEvaluation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authority = None + """ Who is responsible for publishing the recommendations. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.date = None + """ Date evaluation was performed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Evaluation notes. + Type `str`. """ + + self.doseNumberPositiveInt = None + """ Dose number within series. + Type `int`. """ + + self.doseNumberString = None + """ Dose number within series. + Type `str`. """ + + self.doseStatus = None + """ Status of the dose relative to published recommendations. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.doseStatusReason = None + """ Reason for the dose status. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.immunizationEvent = None + """ Immunization being evaluated. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.patient = None + """ Who this evaluation is for. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.series = None + """ Name of vaccine series. + Type `str`. """ + + self.seriesDosesPositiveInt = None + """ Recommended number of doses for immunity. + Type `int`. """ + + self.seriesDosesString = None + """ Recommended number of doses for immunity. + Type `str`. """ + + self.status = None + """ completed | entered-in-error. + Type `str`. """ + + self.targetDisease = None + """ Evaluation target disease. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ImmunizationEvaluation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImmunizationEvaluation, self).elementProperties() + js.extend([ + ("authority", "authority", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("doseNumberPositiveInt", "doseNumberPositiveInt", int, False, "doseNumber", False), + ("doseNumberString", "doseNumberString", str, False, "doseNumber", False), + ("doseStatus", "doseStatus", codeableconcept.CodeableConcept, False, None, True), + ("doseStatusReason", "doseStatusReason", codeableconcept.CodeableConcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("immunizationEvent", "immunizationEvent", fhirreference.FHIRReference, False, None, True), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("series", "series", str, False, None, False), + ("seriesDosesPositiveInt", "seriesDosesPositiveInt", int, False, "seriesDoses", False), + ("seriesDosesString", "seriesDosesString", str, False, "seriesDoses", False), + ("status", "status", str, False, None, True), + ("targetDisease", "targetDisease", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/immunizationevaluation_tests.py b/fhirclient/models/immunizationevaluation_tests.py new file mode 100644 index 000000000..8d810ec25 --- /dev/null +++ b/fhirclient/models/immunizationevaluation_tests.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import immunizationevaluation +from .fhirdate import FHIRDate + + +class ImmunizationEvaluationTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("ImmunizationEvaluation", js["resourceType"]) + return immunizationevaluation.ImmunizationEvaluation(js) + + def testImmunizationEvaluation1(self): + inst = self.instantiate_from("immunizationevaluation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ImmunizationEvaluation instance") + self.implImmunizationEvaluation1(inst) + + js = inst.as_json() + self.assertEqual("ImmunizationEvaluation", js["resourceType"]) + inst2 = immunizationevaluation.ImmunizationEvaluation(js) + self.implImmunizationEvaluation1(inst2) + + def implImmunizationEvaluation1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2013-01-10").date) + self.assertEqual(inst.date.as_json(), "2013-01-10") + self.assertEqual(inst.doseNumberPositiveInt, 1) + self.assertEqual(inst.doseStatus.coding[0].code, "valid") + self.assertEqual(inst.doseStatus.coding[0].display, "Valid") + self.assertEqual(inst.doseStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-evaluation-dose-status") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1234") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.series, "Vaccination Series 1") + self.assertEqual(inst.seriesDosesPositiveInt, 3) + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.targetDisease.coding[0].code, "1857005") + self.assertEqual(inst.targetDisease.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + + def testImmunizationEvaluation2(self): + inst = self.instantiate_from("immunizationevaluation-example-notvalid.json") + self.assertIsNotNone(inst, "Must have instantiated a ImmunizationEvaluation instance") + self.implImmunizationEvaluation2(inst) + + js = inst.as_json() + self.assertEqual("ImmunizationEvaluation", js["resourceType"]) + inst2 = immunizationevaluation.ImmunizationEvaluation(js) + self.implImmunizationEvaluation2(inst2) + + def implImmunizationEvaluation2(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2013-01-10").date) + self.assertEqual(inst.date.as_json(), "2013-01-10") + self.assertEqual(inst.doseNumberPositiveInt, 2) + self.assertEqual(inst.doseStatus.coding[0].code, "notvalid") + self.assertEqual(inst.doseStatus.coding[0].display, "Not Valid") + self.assertEqual(inst.doseStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-evaluation-dose-status") + self.assertEqual(inst.doseStatusReason[0].coding[0].code, "outsidesched") + self.assertEqual(inst.doseStatusReason[0].coding[0].display, "Administered outside recommended schedule") + self.assertEqual(inst.doseStatusReason[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/immunization-evaluation-dose-status-reason") + self.assertEqual(inst.id, "notValid") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1234") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.series, "Vaccination Series 1") + self.assertEqual(inst.seriesDosesPositiveInt, 3) + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.targetDisease.coding[0].code, "1857005") + self.assertEqual(inst.targetDisease.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/immunizationrecommendation.py b/fhirclient/models/immunizationrecommendation.py index 8573413ad..17d5cf7b4 100644 --- a/fhirclient/models/immunizationrecommendation.py +++ b/fhirclient/models/immunizationrecommendation.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,9 +10,8 @@ class ImmunizationRecommendation(domainresource.DomainResource): """ Guidance or advice relating to an immunization. - A patient's point-in-time immunization and recommendation (i.e. forecasting - a patient's immunization eligibility according to a published schedule) - with optional supporting justification. + A patient's point-in-time set of recommendations (i.e. forecasting) + according to a published schedule with optional supporting justification. """ resource_type = "ImmunizationRecommendation" @@ -25,13 +24,21 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.authority = None + """ Who is responsible for protocol. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.date = None + """ Date recommendation(s) created. + Type `FHIRDate` (represented as `str` in JSON). """ + self.identifier = None """ Business identifier. List of `Identifier` items (represented as `dict` in JSON). """ self.patient = None """ Who this profile is for. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.recommendation = None """ Vaccine administration recommendations. @@ -42,6 +49,8 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(ImmunizationRecommendation, self).elementProperties() js.extend([ + ("authority", "authority", fhirreference.FHIRReference, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), ("identifier", "identifier", identifier.Identifier, True, None, False), ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("recommendation", "recommendation", ImmunizationRecommendationRecommendation, True, None, True), @@ -65,56 +74,81 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.date = None - """ Date recommendation created. - Type `FHIRDate` (represented as `str` in JSON). """ + self.contraindicatedVaccineCode = None + """ Vaccine which is contraindicated to fulfill the recommendation. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.dateCriterion = None """ Dates governing proposed immunization. List of `ImmunizationRecommendationRecommendationDateCriterion` items (represented as `dict` in JSON). """ - self.doseNumber = None - """ Recommended dose number. + self.description = None + """ Protocol details. + Type `str`. """ + + self.doseNumberPositiveInt = None + """ Recommended dose number within series. Type `int`. """ + self.doseNumberString = None + """ Recommended dose number within series. + Type `str`. """ + + self.forecastReason = None + """ Vaccine administration status reason. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.forecastStatus = None - """ Vaccine administration status. + """ Vaccine recommendation status. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.protocol = None - """ Protocol used by recommendation. - Type `ImmunizationRecommendationRecommendationProtocol` (represented as `dict` in JSON). """ + self.series = None + """ Name of vaccination series. + Type `str`. """ + + self.seriesDosesPositiveInt = None + """ Recommended number of doses for immunity. + Type `int`. """ + + self.seriesDosesString = None + """ Recommended number of doses for immunity. + Type `str`. """ self.supportingImmunization = None """ Past immunizations supporting recommendation. - List of `FHIRReference` items referencing `Immunization` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.supportingPatientInformation = None """ Patient observations supporting recommendation. - List of `FHIRReference` items referencing `Observation, AllergyIntolerance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.targetDisease = None """ Disease to be immunized against. Type `CodeableConcept` (represented as `dict` in JSON). """ self.vaccineCode = None - """ Vaccine recommendation applies to. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ Vaccine or vaccine group recommendation applies to. + List of `CodeableConcept` items (represented as `dict` in JSON). """ super(ImmunizationRecommendationRecommendation, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ImmunizationRecommendationRecommendation, self).elementProperties() js.extend([ - ("date", "date", fhirdate.FHIRDate, False, None, True), + ("contraindicatedVaccineCode", "contraindicatedVaccineCode", codeableconcept.CodeableConcept, True, None, False), ("dateCriterion", "dateCriterion", ImmunizationRecommendationRecommendationDateCriterion, True, None, False), - ("doseNumber", "doseNumber", int, False, None, False), + ("description", "description", str, False, None, False), + ("doseNumberPositiveInt", "doseNumberPositiveInt", int, False, "doseNumber", False), + ("doseNumberString", "doseNumberString", str, False, "doseNumber", False), + ("forecastReason", "forecastReason", codeableconcept.CodeableConcept, True, None, False), ("forecastStatus", "forecastStatus", codeableconcept.CodeableConcept, False, None, True), - ("protocol", "protocol", ImmunizationRecommendationRecommendationProtocol, False, None, False), + ("series", "series", str, False, None, False), + ("seriesDosesPositiveInt", "seriesDosesPositiveInt", int, False, "seriesDoses", False), + ("seriesDosesString", "seriesDosesString", str, False, "seriesDoses", False), ("supportingImmunization", "supportingImmunization", fhirreference.FHIRReference, True, None, False), ("supportingPatientInformation", "supportingPatientInformation", fhirreference.FHIRReference, True, None, False), ("targetDisease", "targetDisease", codeableconcept.CodeableConcept, False, None, False), - ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, False, None, False), + ("vaccineCode", "vaccineCode", codeableconcept.CodeableConcept, True, None, False), ]) return js @@ -155,52 +189,6 @@ def elementProperties(self): return js -class ImmunizationRecommendationRecommendationProtocol(backboneelement.BackboneElement): - """ Protocol used by recommendation. - - Contains information about the protocol under which the vaccine was - administered. - """ - - resource_type = "ImmunizationRecommendationRecommendationProtocol" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.authority = None - """ Who is responsible for protocol. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.description = None - """ Protocol details. - Type `str`. """ - - self.doseSequence = None - """ Dose number within sequence. - Type `int`. """ - - self.series = None - """ Name of vaccination series. - Type `str`. """ - - super(ImmunizationRecommendationRecommendationProtocol, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ImmunizationRecommendationRecommendationProtocol, self).elementProperties() - js.extend([ - ("authority", "authority", fhirreference.FHIRReference, False, None, False), - ("description", "description", str, False, None, False), - ("doseSequence", "doseSequence", int, False, None, False), - ("series", "series", str, False, None, False), - ]) - return js - - import sys try: from . import codeableconcept diff --git a/fhirclient/models/immunizationrecommendation_tests.py b/fhirclient/models/immunizationrecommendation_tests.py index 3d35828d5..5088fd49f 100644 --- a/fhirclient/models/immunizationrecommendation_tests.py +++ b/fhirclient/models/immunizationrecommendation_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,39 +32,42 @@ def testImmunizationRecommendation1(self): self.implImmunizationRecommendation1(inst2) def implImmunizationRecommendation1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2015-02-09T11:04:15.817-05:00").date) + self.assertEqual(inst.date.as_json(), "2015-02-09T11:04:15.817-05:00") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1235") - self.assertEqual(inst.recommendation[0].date.date, FHIRDate("2015-02-09T11:04:15.817-05:00").date) - self.assertEqual(inst.recommendation[0].date.as_json(), "2015-02-09T11:04:15.817-05:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].code, "earliest") self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].display, "Earliest Date") - self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].system, "http://hl7.org/fhir/immunization-recommendation-date-criterion") + self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].system, "http://example.org/fhir/CodeSystem/immunization-recommendation-date-criterion") self.assertEqual(inst.recommendation[0].dateCriterion[0].value.date, FHIRDate("2015-12-01T00:00:00-05:00").date) self.assertEqual(inst.recommendation[0].dateCriterion[0].value.as_json(), "2015-12-01T00:00:00-05:00") self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].code, "recommended") self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].display, "Recommended") - self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].system, "http://hl7.org/fhir/immunization-recommendation-date-criterion") + self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].system, "http://example.org/fhir/CodeSystem/immunization-recommendation-date-criterion") self.assertEqual(inst.recommendation[0].dateCriterion[1].value.date, FHIRDate("2015-12-01T00:00:00-05:00").date) self.assertEqual(inst.recommendation[0].dateCriterion[1].value.as_json(), "2015-12-01T00:00:00-05:00") self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].code, "overdue") self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].display, "Past Due Date") - self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].system, "http://hl7.org/fhir/immunization-recommendation-date-criterion") + self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].system, "http://example.org/fhir/CodeSystem/immunization-recommendation-date-criterion") self.assertEqual(inst.recommendation[0].dateCriterion[2].value.date, FHIRDate("2016-12-28T00:00:00-05:00").date) self.assertEqual(inst.recommendation[0].dateCriterion[2].value.as_json(), "2016-12-28T00:00:00-05:00") - self.assertEqual(inst.recommendation[0].doseNumber, 1) + self.assertEqual(inst.recommendation[0].description, "First sequence in protocol") + self.assertEqual(inst.recommendation[0].doseNumberPositiveInt, 1) self.assertEqual(inst.recommendation[0].forecastStatus.text, "Not Complete") - self.assertEqual(inst.recommendation[0].protocol.description, "First sequence in protocol") - self.assertEqual(inst.recommendation[0].protocol.doseSequence, 1) - self.assertEqual(inst.recommendation[0].protocol.series, "Vaccination Series 1") - self.assertEqual(inst.recommendation[0].vaccineCode.coding[0].code, "14745005") - self.assertEqual(inst.recommendation[0].vaccineCode.coding[0].display, "Hepatitis A vaccine") - self.assertEqual(inst.recommendation[0].vaccineCode.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.recommendation[0].series, "Vaccination Series 1") + self.assertEqual(inst.recommendation[0].seriesDosesPositiveInt, 3) + self.assertEqual(inst.recommendation[0].vaccineCode[0].coding[0].code, "14745005") + self.assertEqual(inst.recommendation[0].vaccineCode[0].coding[0].display, "Hepatitis A vaccine") + self.assertEqual(inst.recommendation[0].vaccineCode[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.div, "
Authored by Joginder Madra
") self.assertEqual(inst.text.status, "generated") def testImmunizationRecommendation2(self): - inst = self.instantiate_from("immunizationrecommendation-target-disease-example.json") + inst = self.instantiate_from("immunizationrecommendation-example-target-disease.json") self.assertIsNotNone(inst, "Must have instantiated a ImmunizationRecommendation instance") self.implImmunizationRecommendation2(inst) @@ -74,31 +77,34 @@ def testImmunizationRecommendation2(self): self.implImmunizationRecommendation2(inst2) def implImmunizationRecommendation2(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2015-02-09T11:04:15.817-05:00").date) + self.assertEqual(inst.date.as_json(), "2015-02-09T11:04:15.817-05:00") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") self.assertEqual(inst.identifier[0].value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.1235") - self.assertEqual(inst.recommendation[0].date.date, FHIRDate("2015-02-09T11:04:15.817-05:00").date) - self.assertEqual(inst.recommendation[0].date.as_json(), "2015-02-09T11:04:15.817-05:00") - self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].code, "earliest") - self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].display, "Earliest Date") - self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].system, "http://hl7.org/fhir/immunization-recommendation-date-criterion") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].code, "30981-5") + self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].display, "Earliest date to give") + self.assertEqual(inst.recommendation[0].dateCriterion[0].code.coding[0].system, "http://loinc.org") self.assertEqual(inst.recommendation[0].dateCriterion[0].value.date, FHIRDate("2015-12-01T00:00:00-05:00").date) self.assertEqual(inst.recommendation[0].dateCriterion[0].value.as_json(), "2015-12-01T00:00:00-05:00") self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].code, "recommended") self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].display, "Recommended") - self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].system, "http://hl7.org/fhir/immunization-recommendation-date-criterion") + self.assertEqual(inst.recommendation[0].dateCriterion[1].code.coding[0].system, "http://example.org/fhir/CodeSystem/immunization-recommendation-date-criterion") self.assertEqual(inst.recommendation[0].dateCriterion[1].value.date, FHIRDate("2015-12-01T00:00:00-05:00").date) self.assertEqual(inst.recommendation[0].dateCriterion[1].value.as_json(), "2015-12-01T00:00:00-05:00") self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].code, "overdue") self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].display, "Past Due Date") - self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].system, "http://hl7.org/fhir/immunization-recommendation-date-criterion") + self.assertEqual(inst.recommendation[0].dateCriterion[2].code.coding[0].system, "http://example.org/fhir/CodeSystem/immunization-recommendation-date-criterion") self.assertEqual(inst.recommendation[0].dateCriterion[2].value.date, FHIRDate("2016-12-28T00:00:00-05:00").date) self.assertEqual(inst.recommendation[0].dateCriterion[2].value.as_json(), "2016-12-28T00:00:00-05:00") - self.assertEqual(inst.recommendation[0].doseNumber, 1) + self.assertEqual(inst.recommendation[0].description, "First sequence in protocol") + self.assertEqual(inst.recommendation[0].doseNumberPositiveInt, 1) self.assertEqual(inst.recommendation[0].forecastStatus.text, "Not Complete") - self.assertEqual(inst.recommendation[0].protocol.description, "First sequence in protocol") - self.assertEqual(inst.recommendation[0].protocol.doseSequence, 1) - self.assertEqual(inst.recommendation[0].protocol.series, "Vaccination Series 1") + self.assertEqual(inst.recommendation[0].series, "Vaccination Series 1") + self.assertEqual(inst.recommendation[0].seriesDosesPositiveInt, 3) self.assertEqual(inst.recommendation[0].targetDisease.coding[0].code, "40468003") self.assertEqual(inst.recommendation[0].targetDisease.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.text.div, "
Authored by Joginder Madra
") diff --git a/fhirclient/models/implementationguide.py b/fhirclient/models/implementationguide.py index 0bc061b83..c6aa1c2fc 100644 --- a/fhirclient/models/implementationguide.py +++ b/fhirclient/models/implementationguide.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,9 +10,10 @@ class ImplementationGuide(domainresource.DomainResource): """ A set of rules about how FHIR is used. - A set of rules of how FHIR is used to solve a particular problem. 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. + 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 = "ImplementationGuide" @@ -25,10 +26,6 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.binary = None - """ Image, css, script, etc.. - List of `str` items. """ - self.contact = None """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ @@ -38,12 +35,16 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ - self.dependency = None + self.definition = None + """ Information needed to build the IG. + Type `ImplementationGuideDefinition` (represented as `dict` in JSON). """ + + self.dependsOn = None """ Another Implementation guide this depends on. - List of `ImplementationGuideDependency` items (represented as `dict` in JSON). """ + List of `ImplementationGuideDependsOn` items (represented as `dict` in JSON). """ self.description = None """ Natural language description of the implementation guide. @@ -54,8 +55,8 @@ def __init__(self, jsondict=None, strict=True): Type `bool`. """ self.fhirVersion = None - """ FHIR Version this Implementation Guide targets. - Type `str`. """ + """ FHIR Version(s) this Implementation Guide targets. + List of `str` items. """ self.global_fhir = None """ Profiles that apply globally. @@ -65,17 +66,21 @@ def __init__(self, jsondict=None, strict=True): """ Intended jurisdiction for implementation guide (if applicable). List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.license = None + """ SPDX license code for this IG (or not-open-source). + Type `str`. """ + + self.manifest = None + """ Information about an assembled IG. + Type `ImplementationGuideManifest` (represented as `dict` in JSON). """ + self.name = None """ Name for this implementation guide (computer friendly). Type `str`. """ - self.package = None - """ Group of resources as used in .page.package. - List of `ImplementationGuidePackage` items (represented as `dict` in JSON). """ - - self.page = None - """ Page/Section in the Guide. - Type `ImplementationGuidePage` (represented as `dict` in JSON). """ + self.packageId = None + """ NPM Package name for IG. + Type `str`. """ self.publisher = None """ Name of the publisher (organization or individual). @@ -85,13 +90,17 @@ def __init__(self, jsondict=None, strict=True): """ draft | active | retired | unknown. Type `str`. """ + self.title = None + """ Name for this implementation guide (human friendly). + Type `str`. """ + self.url = None - """ Logical URI to reference this implementation guide (globally - unique). + """ Canonical identifier for this implementation guide, represented as + a URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -103,21 +112,23 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(ImplementationGuide, self).elementProperties() js.extend([ - ("binary", "binary", str, True, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), - ("dependency", "dependency", ImplementationGuideDependency, True, None, False), + ("definition", "definition", ImplementationGuideDefinition, False, None, False), + ("dependsOn", "dependsOn", ImplementationGuideDependsOn, True, None, False), ("description", "description", str, False, None, False), ("experimental", "experimental", bool, False, None, False), - ("fhirVersion", "fhirVersion", str, False, None, False), + ("fhirVersion", "fhirVersion", str, True, None, True), ("global_fhir", "global", ImplementationGuideGlobal, True, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("license", "license", str, False, None, False), + ("manifest", "manifest", ImplementationGuideManifest, False, None, False), ("name", "name", str, False, None, True), - ("package", "package", ImplementationGuidePackage, True, None, False), - ("page", "page", ImplementationGuidePage, False, None, False), + ("packageId", "packageId", str, False, None, True), ("publisher", "publisher", str, False, None, False), ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), ("url", "url", str, False, None, True), ("useContext", "useContext", usagecontext.UsageContext, True, None, False), ("version", "version", str, False, None, False), @@ -127,15 +138,14 @@ def elementProperties(self): from . import backboneelement -class ImplementationGuideDependency(backboneelement.BackboneElement): - """ Another Implementation guide this depends on. +class ImplementationGuideDefinition(backboneelement.BackboneElement): + """ Information needed to build the IG. - Another implementation guide that this implementation depends on. - Typically, an implementation guide uses value sets, profiles etc.defined in - other implementation guides. + The information needed by an IG publisher tool to publish the whole + implementation guide. """ - resource_type = "ImplementationGuideDependency" + resource_type = "ImplementationGuideDefinition" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -145,33 +155,48 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.type = None - """ reference | inclusion. - Type `str`. """ + self.grouping = None + """ Grouping used to present related resources in the IG. + List of `ImplementationGuideDefinitionGrouping` items (represented as `dict` in JSON). """ - self.uri = None - """ Where to find dependency. - Type `str`. """ + self.page = None + """ Page/Section in the Guide. + Type `ImplementationGuideDefinitionPage` (represented as `dict` in JSON). """ + + self.parameter = None + """ Defines how IG is built by tools. + List of `ImplementationGuideDefinitionParameter` items (represented as `dict` in JSON). """ - super(ImplementationGuideDependency, self).__init__(jsondict=jsondict, strict=strict) + self.resource = None + """ Resource in the implementation guide. + List of `ImplementationGuideDefinitionResource` items (represented as `dict` in JSON). """ + + self.template = None + """ A template for building resources. + List of `ImplementationGuideDefinitionTemplate` items (represented as `dict` in JSON). """ + + super(ImplementationGuideDefinition, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImplementationGuideDependency, self).elementProperties() + js = super(ImplementationGuideDefinition, self).elementProperties() js.extend([ - ("type", "type", str, False, None, True), - ("uri", "uri", str, False, None, True), + ("grouping", "grouping", ImplementationGuideDefinitionGrouping, True, None, False), + ("page", "page", ImplementationGuideDefinitionPage, False, None, False), + ("parameter", "parameter", ImplementationGuideDefinitionParameter, True, None, False), + ("resource", "resource", ImplementationGuideDefinitionResource, True, None, True), + ("template", "template", ImplementationGuideDefinitionTemplate, True, None, False), ]) return js -class ImplementationGuideGlobal(backboneelement.BackboneElement): - """ Profiles that apply globally. +class ImplementationGuideDefinitionGrouping(backboneelement.BackboneElement): + """ Grouping used to present related resources in the IG. - A set of profiles that all resources covered by this implementation guide - must conform to. + A logical group of resources. Logical groups can be used when building + pages. """ - resource_type = "ImplementationGuideGlobal" + resource_type = "ImplementationGuideDefinitionGrouping" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -181,33 +206,33 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.profile = None - """ Profile that all resources must conform to. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + self.description = None + """ Human readable text describing the package. + Type `str`. """ - self.type = None - """ Type this profiles applies to. + self.name = None + """ Descriptive name for the package. Type `str`. """ - super(ImplementationGuideGlobal, self).__init__(jsondict=jsondict, strict=strict) + super(ImplementationGuideDefinitionGrouping, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImplementationGuideGlobal, self).elementProperties() + js = super(ImplementationGuideDefinitionGrouping, self).elementProperties() js.extend([ - ("profile", "profile", fhirreference.FHIRReference, False, None, True), - ("type", "type", str, False, None, True), + ("description", "description", str, False, None, False), + ("name", "name", str, False, None, True), ]) return js -class ImplementationGuidePackage(backboneelement.BackboneElement): - """ Group of resources as used in .page.package. +class ImplementationGuideDefinitionPage(backboneelement.BackboneElement): + """ Page/Section in the Guide. - A logical group of resources. Logical groups can be used when building - pages. + A page / section in the implementation guide. The root page is the + implementation guide home page. """ - resource_type = "ImplementationGuidePackage" + resource_type = "ImplementationGuideDefinitionPage" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -217,31 +242,76 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.description = None - """ Human readable text describing the package. + self.generation = None + """ html | markdown | xml | generated. Type `str`. """ - self.name = None - """ Name used .page.package. + self.nameReference = None + """ Where to find that page. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.nameUrl = None + """ Where to find that page. Type `str`. """ - self.resource = None - """ Resource in the implementation guide. - List of `ImplementationGuidePackageResource` items (represented as `dict` in JSON). """ + self.page = None + """ Nested Pages / Sections. + List of `ImplementationGuideDefinitionPage` items (represented as `dict` in JSON). """ + + self.title = None + """ Short title shown for navigational assistance. + Type `str`. """ - super(ImplementationGuidePackage, self).__init__(jsondict=jsondict, strict=strict) + super(ImplementationGuideDefinitionPage, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImplementationGuidePackage, self).elementProperties() + js = super(ImplementationGuideDefinitionPage, self).elementProperties() js.extend([ - ("description", "description", str, False, None, False), - ("name", "name", str, False, None, True), - ("resource", "resource", ImplementationGuidePackageResource, True, None, True), + ("generation", "generation", str, False, None, True), + ("nameReference", "nameReference", fhirreference.FHIRReference, False, "name", True), + ("nameUrl", "nameUrl", str, False, "name", True), + ("page", "page", ImplementationGuideDefinitionPage, True, None, False), + ("title", "title", str, False, None, True), + ]) + return js + + +class ImplementationGuideDefinitionParameter(backboneelement.BackboneElement): + """ Defines how IG is built by tools. + """ + + resource_type = "ImplementationGuideDefinitionParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ apply | path-resource | path-pages | path-tx-cache | expansion- + parameter | rule-broken-links | generate-xml | generate-json | + generate-turtle | html-template. + Type `str`. """ + + self.value = None + """ Value for named type. + Type `str`. """ + + super(ImplementationGuideDefinitionParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideDefinitionParameter, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("value", "value", str, False, None, True), ]) return js -class ImplementationGuidePackageResource(backboneelement.BackboneElement): +class ImplementationGuideDefinitionResource(backboneelement.BackboneElement): """ Resource in the implementation guide. A resource that is part of the implementation guide. Conformance resources @@ -250,7 +320,7 @@ class ImplementationGuidePackageResource(backboneelement.BackboneElement): example resource. """ - resource_type = "ImplementationGuidePackageResource" + resource_type = "ImplementationGuideDefinitionResource" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -260,58 +330,97 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.acronym = None - """ Short code to identify the resource. - Type `str`. """ - self.description = None """ Reason why included in guide. Type `str`. """ - self.example = None - """ If not an example, has its normal meaning. + self.exampleBoolean = None + """ Is an example/What is this an example of?. Type `bool`. """ - self.exampleFor = None - """ Resource this is an example of (if applicable). - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + self.exampleCanonical = None + """ Is an example/What is this an example of?. + Type `str`. """ + + self.fhirVersion = None + """ Versions this applies to (if different to IG). + List of `str` items. """ + + self.groupingId = None + """ Grouping this is part of. + Type `str`. """ self.name = None """ Human Name for the resource. Type `str`. """ - self.sourceReference = None + self.reference = None """ Location of the resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.sourceUri = None - """ Location of the resource. - Type `str`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ - super(ImplementationGuidePackageResource, self).__init__(jsondict=jsondict, strict=strict) + super(ImplementationGuideDefinitionResource, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImplementationGuidePackageResource, self).elementProperties() + js = super(ImplementationGuideDefinitionResource, self).elementProperties() js.extend([ - ("acronym", "acronym", str, False, None, False), ("description", "description", str, False, None, False), - ("example", "example", bool, False, None, True), - ("exampleFor", "exampleFor", fhirreference.FHIRReference, False, None, False), + ("exampleBoolean", "exampleBoolean", bool, False, "example", False), + ("exampleCanonical", "exampleCanonical", str, False, "example", False), + ("fhirVersion", "fhirVersion", str, True, None, False), + ("groupingId", "groupingId", str, False, None, False), ("name", "name", str, False, None, False), - ("sourceReference", "sourceReference", fhirreference.FHIRReference, False, "source", True), - ("sourceUri", "sourceUri", str, False, "source", True), + ("reference", "reference", fhirreference.FHIRReference, False, None, True), ]) return js -class ImplementationGuidePage(backboneelement.BackboneElement): - """ Page/Section in the Guide. +class ImplementationGuideDefinitionTemplate(backboneelement.BackboneElement): + """ A template for building resources. + """ - A page / section in the implementation guide. The root page is the - implementation guide home page. + resource_type = "ImplementationGuideDefinitionTemplate" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Type of template specified. + Type `str`. """ + + self.scope = None + """ The scope in which the template applies. + Type `str`. """ + + self.source = None + """ The source location for the template. + Type `str`. """ + + super(ImplementationGuideDefinitionTemplate, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideDefinitionTemplate, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("scope", "scope", str, False, None, False), + ("source", "source", str, False, None, True), + ]) + return js + + +class ImplementationGuideDependsOn(backboneelement.BackboneElement): + """ Another Implementation guide this depends on. + + Another implementation guide that this implementation depends on. + Typically, an implementation guide uses value sets, profiles etc.defined in + other implementation guides. """ - resource_type = "ImplementationGuidePage" + resource_type = "ImplementationGuideDependsOn" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -321,47 +430,201 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.format = None - """ Format of the page (e.g. html, markdown, etc.). + self.packageId = None + """ NPM Package name for IG this depends on. Type `str`. """ - self.kind = None - """ page | example | list | include | directory | dictionary | toc | - resource. + self.uri = None + """ Identity of the IG that this depends on. + Type `str`. """ + + self.version = None + """ Version of the IG. Type `str`. """ - self.package = None - """ Name of package to include. + super(ImplementationGuideDependsOn, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideDependsOn, self).elementProperties() + js.extend([ + ("packageId", "packageId", str, False, None, False), + ("uri", "uri", str, False, None, True), + ("version", "version", str, False, None, False), + ]) + return js + + +class ImplementationGuideGlobal(backboneelement.BackboneElement): + """ Profiles that apply globally. + + A set of profiles that all resources covered by this implementation guide + must conform to. + """ + + resource_type = "ImplementationGuideGlobal" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.profile = None + """ Profile that all resources must conform to. + Type `str`. """ + + self.type = None + """ Type this profile applies to. + Type `str`. """ + + super(ImplementationGuideGlobal, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideGlobal, self).elementProperties() + js.extend([ + ("profile", "profile", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + +class ImplementationGuideManifest(backboneelement.BackboneElement): + """ Information about an assembled IG. + + Information about an assembled implementation guide, created by the + publication tooling. + """ + + resource_type = "ImplementationGuideManifest" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.image = None + """ Image within the IG. + List of `str` items. """ + + self.other = None + """ Additional linkable file in IG. List of `str` items. """ self.page = None - """ Nested Pages / Sections. - List of `ImplementationGuidePage` items (represented as `dict` in JSON). """ + """ HTML page within the parent IG. + List of `ImplementationGuideManifestPage` items (represented as `dict` in JSON). """ - self.source = None - """ Where to find that page. + self.rendering = None + """ Location of rendered implementation guide. + Type `str`. """ + + self.resource = None + """ Resource in the implementation guide. + List of `ImplementationGuideManifestResource` items (represented as `dict` in JSON). """ + + super(ImplementationGuideManifest, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideManifest, self).elementProperties() + js.extend([ + ("image", "image", str, True, None, False), + ("other", "other", str, True, None, False), + ("page", "page", ImplementationGuideManifestPage, True, None, False), + ("rendering", "rendering", str, False, None, False), + ("resource", "resource", ImplementationGuideManifestResource, True, None, True), + ]) + return js + + +class ImplementationGuideManifestPage(backboneelement.BackboneElement): + """ HTML page within the parent IG. + + Information about a page within the IG. + """ + + resource_type = "ImplementationGuideManifestPage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.anchor = None + """ Anchor available on the page. + List of `str` items. """ + + self.name = None + """ HTML page name. Type `str`. """ self.title = None - """ Short title shown for navigational assistance. + """ Title of the page, for references. Type `str`. """ - self.type = None - """ Kind of resource to include in the list. - List of `str` items. """ + super(ImplementationGuideManifestPage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ImplementationGuideManifestPage, self).elementProperties() + js.extend([ + ("anchor", "anchor", str, True, None, False), + ("name", "name", str, False, None, True), + ("title", "title", str, False, None, False), + ]) + return js + + +class ImplementationGuideManifestResource(backboneelement.BackboneElement): + """ 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 = "ImplementationGuideManifestResource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.exampleBoolean = None + """ Is an example/What is this an example of?. + Type `bool`. """ - super(ImplementationGuidePage, self).__init__(jsondict=jsondict, strict=strict) + self.exampleCanonical = None + """ Is an example/What is this an example of?. + Type `str`. """ + + self.reference = None + """ Location of the resource. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.relativePath = None + """ Relative path for page in IG. + Type `str`. """ + + super(ImplementationGuideManifestResource, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ImplementationGuidePage, self).elementProperties() + js = super(ImplementationGuideManifestResource, self).elementProperties() js.extend([ - ("format", "format", str, False, None, False), - ("kind", "kind", str, False, None, True), - ("package", "package", str, True, None, False), - ("page", "page", ImplementationGuidePage, True, None, False), - ("source", "source", str, False, None, True), - ("title", "title", str, False, None, True), - ("type", "type", str, True, None, False), + ("exampleBoolean", "exampleBoolean", bool, False, "example", False), + ("exampleCanonical", "exampleCanonical", str, False, "example", False), + ("reference", "reference", fhirreference.FHIRReference, False, None, True), + ("relativePath", "relativePath", str, False, None, False), ]) return js diff --git a/fhirclient/models/implementationguide_tests.py b/fhirclient/models/implementationguide_tests.py index f0055d5de..3b920a0b9 100644 --- a/fhirclient/models/implementationguide_tests.py +++ b/fhirclient/models/implementationguide_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,7 +32,6 @@ def testImplementationGuide1(self): self.implImplementationGuide1(inst2) def implImplementationGuide1(self, inst): - self.assertEqual(inst.binary[0], "http://h7.org/fhir/fhir.css") self.assertEqual(inst.contact[0].name, "ONC") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://www.healthit.gov") @@ -42,31 +41,40 @@ def implImplementationGuide1(self, inst): self.assertEqual(inst.copyright, "Published by ONC under the standard FHIR license (CC0)") self.assertEqual(inst.date.date, FHIRDate("2015-01-01").date) self.assertEqual(inst.date.as_json(), "2015-01-01") - self.assertEqual(inst.dependency[0].type, "reference") - self.assertEqual(inst.dependency[0].uri, "http://hl7.org/fhir/ImplementationGuide/uscore") + self.assertEqual(inst.definition.grouping[0].description, "Base package (not broken up into multiple packages)") + self.assertEqual(inst.definition.grouping[0].name, "test") + self.assertEqual(inst.definition.page.generation, "html") + self.assertEqual(inst.definition.page.nameUrl, "patient-example.html") + self.assertEqual(inst.definition.page.page[0].generation, "html") + self.assertEqual(inst.definition.page.page[0].nameUrl, "list.html") + self.assertEqual(inst.definition.page.page[0].title, "Value Set Page") + self.assertEqual(inst.definition.page.title, "Example Patient Page") + self.assertEqual(inst.definition.parameter[0].code, "apply") + self.assertEqual(inst.definition.parameter[0].value, "version") + self.assertEqual(inst.definition.resource[0].description, "A test example to show how an implementation guide works") + self.assertEqual(inst.definition.resource[0].exampleCanonical, "http://hl7.org/fhir/us/core/StructureDefinition/patient") + self.assertEqual(inst.definition.resource[0].name, "Test Example") + self.assertEqual(inst.dependsOn[0].uri, "http://hl7.org/fhir/ImplementationGuide/uscore") self.assertFalse(inst.experimental) - self.assertEqual(inst.fhirVersion, "1.0.0") + self.assertEqual(inst.fhirVersion[0], "4.0.0") + self.assertEqual(inst.global_fhir[0].profile, "http://hl7.org/fhir/us/core/StructureDefinition/patient") self.assertEqual(inst.global_fhir[0].type, "Patient") self.assertEqual(inst.id, "example") self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.license, "CC0-1.0") + self.assertEqual(inst.manifest.image[0], "fhir.png") + self.assertEqual(inst.manifest.other[0], "fhir.css") + self.assertEqual(inst.manifest.page[0].anchor[0], "patient-test") + self.assertEqual(inst.manifest.page[0].anchor[1], "tx") + self.assertEqual(inst.manifest.page[0].anchor[2], "uml") + self.assertEqual(inst.manifest.page[0].name, "patient-test.html") + self.assertEqual(inst.manifest.page[0].title, "Test Patient Example") + self.assertEqual(inst.manifest.rendering, "http://hl7.org/fhir/us/daf") + self.assertEqual(inst.manifest.resource[0].exampleCanonical, "http://hl7.org/fhir/us/core/StructureDefinition/patient") + self.assertEqual(inst.manifest.resource[0].relativePath, "patient-test.html#patient-test") self.assertEqual(inst.name, "Data Access Framework (DAF)") - self.assertEqual(inst.package[0].description, "Base package (not broken up into multiple packages)") - self.assertEqual(inst.package[0].name, "test") - self.assertEqual(inst.package[0].resource[0].acronym, "daf-tst") - self.assertEqual(inst.package[0].resource[0].description, "A test example to show how a package works") - self.assertTrue(inst.package[0].resource[0].example) - self.assertEqual(inst.package[0].resource[0].name, "Test Example") - self.assertEqual(inst.package[0].resource[0].sourceUri, "test.html") - self.assertEqual(inst.page.kind, "page") - self.assertEqual(inst.page.page[0].format, "text/html") - self.assertEqual(inst.page.page[0].kind, "list") - self.assertEqual(inst.page.page[0].package[0], "test") - self.assertEqual(inst.page.page[0].source, "list.html") - self.assertEqual(inst.page.page[0].title, "Value Set Page") - self.assertEqual(inst.page.page[0].type[0], "ValueSet") - self.assertEqual(inst.page.source, "patient-example.html") - self.assertEqual(inst.page.title, "Example Patient Page") + self.assertEqual(inst.packageId, "hl7.fhir.us.daf") self.assertEqual(inst.publisher, "ONC / HL7 Joint project") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/insuranceplan.py b/fhirclient/models/insuranceplan.py new file mode 100644 index 000000000..70cc6d240 --- /dev/null +++ b/fhirclient/models/insuranceplan.py @@ -0,0 +1,516 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/InsurancePlan) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class InsurancePlan(domainresource.DomainResource): + """ Details of a Health Insurance product/plan provided by an organization. + """ + + resource_type = "InsurancePlan" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.administeredBy = None + """ Product administrator. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.alias = None + """ Alternate names. + List of `str` items. """ + + self.contact = None + """ Contact for the product. + List of `InsurancePlanContact` items (represented as `dict` in JSON). """ + + self.coverage = None + """ Coverage details. + List of `InsurancePlanCoverage` items (represented as `dict` in JSON). """ + + self.coverageArea = None + """ Where product applies. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.endpoint = None + """ Technical endpoint. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier for Product. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.name = None + """ Official name. + Type `str`. """ + + self.network = None + """ What networks are Included. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.ownedBy = None + """ Plan issuer. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ When the product is available. + Type `Period` (represented as `dict` in JSON). """ + + self.plan = None + """ Plan details. + List of `InsurancePlanPlan` items (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.type = None + """ Kind of product. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(InsurancePlan, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlan, self).elementProperties() + js.extend([ + ("administeredBy", "administeredBy", fhirreference.FHIRReference, False, None, False), + ("alias", "alias", str, True, None, False), + ("contact", "contact", InsurancePlanContact, True, None, False), + ("coverage", "coverage", InsurancePlanCoverage, True, None, False), + ("coverageArea", "coverageArea", fhirreference.FHIRReference, True, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("name", "name", str, False, None, False), + ("network", "network", fhirreference.FHIRReference, True, None, False), + ("ownedBy", "ownedBy", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("plan", "plan", InsurancePlanPlan, True, None, False), + ("status", "status", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +from . import backboneelement + +class InsurancePlanContact(backboneelement.BackboneElement): + """ Contact for the product. + + The contact for the health insurance product for a certain purpose. + """ + + resource_type = "InsurancePlanContact" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.address = None + """ Visiting or postal addresses for the contact. + Type `Address` (represented as `dict` in JSON). """ + + self.name = None + """ A name associated with the contact. + Type `HumanName` (represented as `dict` in JSON). """ + + self.purpose = None + """ The type of contact. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.telecom = None + """ Contact details (telephone, email, etc.) for a contact. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(InsurancePlanContact, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanContact, self).elementProperties() + js.extend([ + ("address", "address", address.Address, False, None, False), + ("name", "name", humanname.HumanName, False, None, False), + ("purpose", "purpose", codeableconcept.CodeableConcept, False, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +class InsurancePlanCoverage(backboneelement.BackboneElement): + """ Coverage details. + + Details about the coverage offered by the insurance product. + """ + + resource_type = "InsurancePlanCoverage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.benefit = None + """ List of benefits. + List of `InsurancePlanCoverageBenefit` items (represented as `dict` in JSON). """ + + self.network = None + """ What networks provide coverage. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of coverage. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(InsurancePlanCoverage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanCoverage, self).elementProperties() + js.extend([ + ("benefit", "benefit", InsurancePlanCoverageBenefit, True, None, True), + ("network", "network", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class InsurancePlanCoverageBenefit(backboneelement.BackboneElement): + """ List of benefits. + + Specific benefits under this type of coverage. + """ + + resource_type = "InsurancePlanCoverageBenefit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.limit = None + """ Benefit limits. + List of `InsurancePlanCoverageBenefitLimit` items (represented as `dict` in JSON). """ + + self.requirement = None + """ Referral requirements. + Type `str`. """ + + self.type = None + """ Type of benefit. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(InsurancePlanCoverageBenefit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanCoverageBenefit, self).elementProperties() + js.extend([ + ("limit", "limit", InsurancePlanCoverageBenefitLimit, True, None, False), + ("requirement", "requirement", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class InsurancePlanCoverageBenefitLimit(backboneelement.BackboneElement): + """ Benefit limits. + + The specific limits on the benefit. + """ + + resource_type = "InsurancePlanCoverageBenefitLimit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Benefit limit details. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Maximum value allowed. + Type `Quantity` (represented as `dict` in JSON). """ + + super(InsurancePlanCoverageBenefitLimit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanCoverageBenefitLimit, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", quantity.Quantity, False, None, False), + ]) + return js + + +class InsurancePlanPlan(backboneelement.BackboneElement): + """ Plan details. + + Details about an insurance plan. + """ + + resource_type = "InsurancePlanPlan" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.coverageArea = None + """ Where product applies. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.generalCost = None + """ Overall costs. + List of `InsurancePlanPlanGeneralCost` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business Identifier for Product. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.network = None + """ What networks provide coverage. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.specificCost = None + """ Specific costs. + List of `InsurancePlanPlanSpecificCost` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of plan. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(InsurancePlanPlan, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanPlan, self).elementProperties() + js.extend([ + ("coverageArea", "coverageArea", fhirreference.FHIRReference, True, None, False), + ("generalCost", "generalCost", InsurancePlanPlanGeneralCost, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("network", "network", fhirreference.FHIRReference, True, None, False), + ("specificCost", "specificCost", InsurancePlanPlanSpecificCost, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class InsurancePlanPlanGeneralCost(backboneelement.BackboneElement): + """ Overall costs. + + Overall costs associated with the plan. + """ + + resource_type = "InsurancePlanPlanGeneralCost" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.comment = None + """ Additional cost information. + Type `str`. """ + + self.cost = None + """ Cost value. + Type `Money` (represented as `dict` in JSON). """ + + self.groupSize = None + """ Number of enrollees. + Type `int`. """ + + self.type = None + """ Type of cost. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(InsurancePlanPlanGeneralCost, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanPlanGeneralCost, self).elementProperties() + js.extend([ + ("comment", "comment", str, False, None, False), + ("cost", "cost", money.Money, False, None, False), + ("groupSize", "groupSize", int, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class InsurancePlanPlanSpecificCost(backboneelement.BackboneElement): + """ Specific costs. + + Costs associated with the coverage provided by the product. + """ + + resource_type = "InsurancePlanPlanSpecificCost" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.benefit = None + """ Benefits list. + List of `InsurancePlanPlanSpecificCostBenefit` items (represented as `dict` in JSON). """ + + self.category = None + """ General category of benefit. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(InsurancePlanPlanSpecificCost, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanPlanSpecificCost, self).elementProperties() + js.extend([ + ("benefit", "benefit", InsurancePlanPlanSpecificCostBenefit, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class InsurancePlanPlanSpecificCostBenefit(backboneelement.BackboneElement): + """ Benefits list. + + List of the specific benefits under this category of benefit. + """ + + resource_type = "InsurancePlanPlanSpecificCostBenefit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.cost = None + """ List of the costs. + List of `InsurancePlanPlanSpecificCostBenefitCost` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of specific benefit. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(InsurancePlanPlanSpecificCostBenefit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanPlanSpecificCostBenefit, self).elementProperties() + js.extend([ + ("cost", "cost", InsurancePlanPlanSpecificCostBenefitCost, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class InsurancePlanPlanSpecificCostBenefitCost(backboneelement.BackboneElement): + """ List of the costs. + + List of the costs associated with a specific benefit. + """ + + resource_type = "InsurancePlanPlanSpecificCostBenefitCost" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.applicability = None + """ in-network | out-of-network | other. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.qualifiers = None + """ Additional information about the cost. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of cost. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ The actual cost value. + Type `Quantity` (represented as `dict` in JSON). """ + + super(InsurancePlanPlanSpecificCostBenefitCost, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InsurancePlanPlanSpecificCostBenefitCost, self).elementProperties() + js.extend([ + ("applicability", "applicability", codeableconcept.CodeableConcept, False, None, False), + ("qualifiers", "qualifiers", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ("value", "value", quantity.Quantity, False, None, False), + ]) + return js + + +import sys +try: + from . import address +except ImportError: + address = sys.modules[__package__ + '.address'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import humanname +except ImportError: + humanname = sys.modules[__package__ + '.humanname'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import money +except ImportError: + money = sys.modules[__package__ + '.money'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/insuranceplan_tests.py b/fhirclient/models/insuranceplan_tests.py new file mode 100644 index 000000000..2160ce856 --- /dev/null +++ b/fhirclient/models/insuranceplan_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import insuranceplan +from .fhirdate import FHIRDate + + +class InsurancePlanTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("InsurancePlan", js["resourceType"]) + return insuranceplan.InsurancePlan(js) + + def testInsurancePlan1(self): + inst = self.instantiate_from("insuranceplan-example.json") + self.assertIsNotNone(inst, "Must have instantiated a InsurancePlan instance") + self.implInsurancePlan1(inst) + + js = inst.as_json() + self.assertEqual("InsurancePlan", js["resourceType"]) + inst2 = insuranceplan.InsurancePlan(js) + self.implInsurancePlan1(inst2) + + def implInsurancePlan1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "foo") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

name: foo

") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/invoice.py b/fhirclient/models/invoice.py new file mode 100644 index 000000000..98962fb28 --- /dev/null +++ b/fhirclient/models/invoice.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Invoice) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class Invoice(domainresource.DomainResource): + """ Invoice containing ChargeItems from an Account. + + Invoice containing collected ChargeItems from an Account with calculated + individual and total price for Billing purpose. + """ + + resource_type = "Invoice" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.account = None + """ Account that is being balanced. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.cancelledReason = None + """ Reason for cancellation of this Invoice. + Type `str`. """ + + self.date = None + """ Invoice date / posting date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Business Identifier for item. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.issuer = None + """ Issuing Organization of Invoice. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.lineItem = None + """ Line items of this Invoice. + List of `InvoiceLineItem` items (represented as `dict` in JSON). """ + + self.note = None + """ Comments made about the invoice. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.participant = None + """ Participant in creation of this Invoice. + List of `InvoiceParticipant` items (represented as `dict` in JSON). """ + + self.paymentTerms = None + """ Payment details. + Type `str`. """ + + self.recipient = None + """ Recipient of this invoice. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ draft | issued | balanced | cancelled | entered-in-error. + Type `str`. """ + + self.subject = None + """ Recipient(s) of goods and services. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.totalGross = None + """ Gross total of this Invoice. + Type `Money` (represented as `dict` in JSON). """ + + self.totalNet = None + """ Net total of this Invoice. + Type `Money` (represented as `dict` in JSON). """ + + self.totalPriceComponent = None + """ Components of Invoice total. + List of `InvoiceLineItemPriceComponent` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of Invoice. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Invoice, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Invoice, self).elementProperties() + js.extend([ + ("account", "account", fhirreference.FHIRReference, False, None, False), + ("cancelledReason", "cancelledReason", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("issuer", "issuer", fhirreference.FHIRReference, False, None, False), + ("lineItem", "lineItem", InvoiceLineItem, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("participant", "participant", InvoiceParticipant, True, None, False), + ("paymentTerms", "paymentTerms", str, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("totalGross", "totalGross", money.Money, False, None, False), + ("totalNet", "totalNet", money.Money, False, None, False), + ("totalPriceComponent", "totalPriceComponent", InvoiceLineItemPriceComponent, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class InvoiceLineItem(backboneelement.BackboneElement): + """ Line items of this Invoice. + + Each line item represents one charge for goods and services rendered. + Details such as date, code and amount are found in the referenced + ChargeItem resource. + """ + + resource_type = "InvoiceLineItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.chargeItemCodeableConcept = None + """ Reference to ChargeItem containing details of this line item or an + inline billing code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.chargeItemReference = None + """ Reference to ChargeItem containing details of this line item or an + inline billing code. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.priceComponent = None + """ Components of total line item price. + List of `InvoiceLineItemPriceComponent` items (represented as `dict` in JSON). """ + + self.sequence = None + """ Sequence number of line item. + Type `int`. """ + + super(InvoiceLineItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InvoiceLineItem, self).elementProperties() + js.extend([ + ("chargeItemCodeableConcept", "chargeItemCodeableConcept", codeableconcept.CodeableConcept, False, "chargeItem", True), + ("chargeItemReference", "chargeItemReference", fhirreference.FHIRReference, False, "chargeItem", True), + ("priceComponent", "priceComponent", InvoiceLineItemPriceComponent, True, None, False), + ("sequence", "sequence", int, False, None, False), + ]) + return js + + +class InvoiceLineItemPriceComponent(backboneelement.BackboneElement): + """ Components of total line item price. + + The price for a ChargeItem may be calculated as a base price with + surcharges/deductions that apply in certain conditions. A + ChargeItemDefinition resource that defines the prices, factors and + conditions that apply to a billing code is currently under development. The + priceComponent element can be used to offer transparency to the recipient + of the Invoice as to how the prices have been calculated. + """ + + resource_type = "InvoiceLineItemPriceComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Monetary amount associated with this component. + Type `Money` (represented as `dict` in JSON). """ + + self.code = None + """ Code identifying the specific component. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.factor = None + """ Factor used for calculating this component. + Type `float`. """ + + self.type = None + """ base | surcharge | deduction | discount | tax | informational. + Type `str`. """ + + super(InvoiceLineItemPriceComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InvoiceLineItemPriceComponent, self).elementProperties() + js.extend([ + ("amount", "amount", money.Money, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("factor", "factor", float, False, None, False), + ("type", "type", str, False, None, True), + ]) + return js + + +class InvoiceParticipant(backboneelement.BackboneElement): + """ Participant in creation of this Invoice. + + Indicates who or what performed or participated in the charged service. + """ + + resource_type = "InvoiceParticipant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.actor = None + """ Individual who was involved. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.role = None + """ Type of involvement in creation of this Invoice. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(InvoiceParticipant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(InvoiceParticipant, self).elementProperties() + js.extend([ + ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import money +except ImportError: + money = sys.modules[__package__ + '.money'] diff --git a/fhirclient/models/invoice_tests.py b/fhirclient/models/invoice_tests.py new file mode 100644 index 000000000..04e419bf1 --- /dev/null +++ b/fhirclient/models/invoice_tests.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import invoice +from .fhirdate import FHIRDate + + +class InvoiceTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("Invoice", js["resourceType"]) + return invoice.Invoice(js) + + def testInvoice1(self): + inst = self.instantiate_from("invoice-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Invoice instance") + self.implInvoice1(inst) + + js = inst.as_json() + self.assertEqual("Invoice", js["resourceType"]) + inst2 = invoice.Invoice(js) + self.implInvoice1(inst2) + + def implInvoice1(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2017-01-25T08:00:00+01:00").date) + self.assertEqual(inst.date.as_json(), "2017-01-25T08:00:00+01:00") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://myHospital.org/Invoices") + self.assertEqual(inst.identifier[0].value, "654321") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.participant[0].role.coding[0].code, "17561000") + self.assertEqual(inst.participant[0].role.coding[0].display, "Cardiologist") + self.assertEqual(inst.participant[0].role.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "issued") + self.assertEqual(inst.text.div, "
Example of Invoice
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.totalGross.currency, "EUR") + self.assertEqual(inst.totalGross.value, 48) + self.assertEqual(inst.totalNet.currency, "EUR") + self.assertEqual(inst.totalNet.value, 40) + diff --git a/fhirclient/models/library.py b/fhirclient/models/library.py index 73b020b12..54600d37e 100644 --- a/fhirclient/models/library.py +++ b/fhirclient/models/library.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Library) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Library) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -30,6 +30,10 @@ def __init__(self, jsondict=None, strict=True): """ When the library was approved by publisher. Type `FHIRDate` (represented as `str` in JSON). """ + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.contact = None """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ @@ -38,10 +42,6 @@ def __init__(self, jsondict=None, strict=True): """ Contents of the library, either embedded or referenced. List of `Attachment` items (represented as `dict` in JSON). """ - self.contributor = None - """ A content contributor. - List of `Contributor` items (represented as `dict` in JSON). """ - self.copyright = None """ Use and/or publishing restrictions. Type `str`. """ @@ -51,17 +51,25 @@ def __init__(self, jsondict=None, strict=True): List of `DataRequirement` items (represented as `dict` in JSON). """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None """ Natural language description of the library. Type `str`. """ + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.effectivePeriod = None """ When the library is expected to be used. Type `Period` (represented as `dict` in JSON). """ + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.experimental = None """ For testing purposes, not real usage. Type `bool`. """ @@ -98,16 +106,32 @@ def __init__(self, jsondict=None, strict=True): """ Additional documentation, citations, etc.. List of `RelatedArtifact` items (represented as `dict` in JSON). """ + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.status = None """ draft | active | retired | unknown. Type `str`. """ + self.subjectCodeableConcept = None + """ Type of individual the library content is focused on. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ Type of individual the library content is focused on. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate title of the library. + Type `str`. """ + self.title = None """ Name for this library (human friendly). Type `str`. """ self.topic = None - """ E.g. Education, Treatment, Assessment, etc. + """ E.g. Education, Treatment, Assessment, etc.. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.type = None @@ -116,7 +140,8 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.url = None - """ Logical URI to reference this library (globally unique). + """ Canonical identifier for this library, represented as a URI + (globally unique). Type `str`. """ self.usage = None @@ -124,7 +149,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -137,14 +162,16 @@ def elementProperties(self): js = super(Library, self).elementProperties() js.extend([ ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("content", "content", attachment.Attachment, True, None, False), - ("contributor", "contributor", contributor.Contributor, True, None, False), ("copyright", "copyright", str, False, None, False), ("dataRequirement", "dataRequirement", datarequirement.DataRequirement, True, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), ("experimental", "experimental", bool, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), @@ -154,7 +181,11 @@ def elementProperties(self): ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), ("status", "status", str, False, None, True), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), + ("subtitle", "subtitle", str, False, None, False), ("title", "title", str, False, None, False), ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, True), @@ -179,10 +210,6 @@ def elementProperties(self): from . import contactdetail except ImportError: contactdetail = sys.modules[__package__ + '.contactdetail'] -try: - from . import contributor -except ImportError: - contributor = sys.modules[__package__ + '.contributor'] try: from . import datarequirement except ImportError: @@ -191,6 +218,10 @@ def elementProperties(self): from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import identifier except ImportError: diff --git a/fhirclient/models/library_tests.py b/fhirclient/models/library_tests.py index 665ac3329..6449f1c48 100644 --- a/fhirclient/models/library_tests.py +++ b/fhirclient/models/library_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return library.Library(js) def testLibrary1(self): - inst = self.instantiate_from("library-cms146-example.json") + inst = self.instantiate_from("library-predecessor-example.json") self.assertIsNotNone(inst, "Must have instantiated a Library instance") self.implLibrary1(inst) @@ -32,45 +32,80 @@ def testLibrary1(self): self.implLibrary1(inst2) def implLibrary1(self, inst): + self.assertEqual(inst.content[0].contentType, "text/cql") + self.assertEqual(inst.content[0].title, "FHIR Helpers") + self.assertEqual(inst.content[0].url, "library-fhir-helpers-content.cql") + self.assertEqual(inst.date.date, FHIRDate("2016-11-14").date) + self.assertEqual(inst.date.as_json(), "2016-11-14") + self.assertEqual(inst.description, "FHIR Helpers") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "library-fhir-helpers-predecessor") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "FHIRHelpers") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.relatedArtifact[0].resource, "Library/fhir-model-definition") + self.assertEqual(inst.relatedArtifact[0].type, "depends-on") + self.assertEqual(inst.relatedArtifact[1].resource, "Library/library-fhir-helpers") + self.assertEqual(inst.relatedArtifact[1].type, "successor") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "FHIR Helpers") + self.assertEqual(inst.topic[0].text, "FHIR Helpers") + self.assertEqual(inst.type.coding[0].code, "logic-library") + self.assertEqual(inst.version, "1.6") + + def testLibrary2(self): + inst = self.instantiate_from("library-cms146-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Library instance") + self.implLibrary2(inst) + + js = inst.as_json() + self.assertEqual("Library", js["resourceType"]) + inst2 = library.Library(js) + self.implLibrary2(inst2) + + def implLibrary2(self, inst): self.assertEqual(inst.content[0].contentType, "text/cql") self.assertEqual(inst.content[0].url, "library-cms146-example-content.cql") self.assertEqual(inst.dataRequirement[0].type, "Patient") + self.assertEqual(inst.dataRequirement[1].codeFilter[0].code[0].code, "diagnosis") self.assertEqual(inst.dataRequirement[1].codeFilter[0].path, "category") - self.assertEqual(inst.dataRequirement[1].codeFilter[0].valueCode[0], "diagnosis") + self.assertEqual(inst.dataRequirement[1].codeFilter[1].code[0].code, "confirmed") self.assertEqual(inst.dataRequirement[1].codeFilter[1].path, "clinicalStatus") - self.assertEqual(inst.dataRequirement[1].codeFilter[1].valueCode[0], "confirmed") self.assertEqual(inst.dataRequirement[1].codeFilter[2].path, "code") - self.assertEqual(inst.dataRequirement[1].codeFilter[2].valueSetString, "2.16.840.1.113883.3.464.1003.102.12.1011") + self.assertEqual(inst.dataRequirement[1].codeFilter[2].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.102.12.1011") self.assertEqual(inst.dataRequirement[1].type, "Condition") + self.assertEqual(inst.dataRequirement[2].codeFilter[0].code[0].code, "diagnosis") self.assertEqual(inst.dataRequirement[2].codeFilter[0].path, "category") - self.assertEqual(inst.dataRequirement[2].codeFilter[0].valueCode[0], "diagnosis") + self.assertEqual(inst.dataRequirement[2].codeFilter[1].code[0].code, "confirmed") self.assertEqual(inst.dataRequirement[2].codeFilter[1].path, "clinicalStatus") - self.assertEqual(inst.dataRequirement[2].codeFilter[1].valueCode[0], "confirmed") self.assertEqual(inst.dataRequirement[2].codeFilter[2].path, "code") - self.assertEqual(inst.dataRequirement[2].codeFilter[2].valueSetString, "2.16.840.1.113883.3.464.1003.102.12.1012") + self.assertEqual(inst.dataRequirement[2].codeFilter[2].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.102.12.1012") self.assertEqual(inst.dataRequirement[2].type, "Condition") + self.assertEqual(inst.dataRequirement[3].codeFilter[0].code[0].code, "finished") self.assertEqual(inst.dataRequirement[3].codeFilter[0].path, "status") - self.assertEqual(inst.dataRequirement[3].codeFilter[0].valueCode[0], "finished") + self.assertEqual(inst.dataRequirement[3].codeFilter[1].code[0].code, "ambulatory") self.assertEqual(inst.dataRequirement[3].codeFilter[1].path, "class") - self.assertEqual(inst.dataRequirement[3].codeFilter[1].valueCode[0], "ambulatory") self.assertEqual(inst.dataRequirement[3].codeFilter[2].path, "type") - self.assertEqual(inst.dataRequirement[3].codeFilter[2].valueSetString, "2.16.840.1.113883.3.464.1003.101.12.1061") + self.assertEqual(inst.dataRequirement[3].codeFilter[2].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.101.12.1061") self.assertEqual(inst.dataRequirement[3].type, "Encounter") self.assertEqual(inst.dataRequirement[4].codeFilter[0].path, "diagnosis") - self.assertEqual(inst.dataRequirement[4].codeFilter[0].valueSetString, "2.16.840.1.113883.3.464.1003.198.12.1012") + self.assertEqual(inst.dataRequirement[4].codeFilter[0].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.198.12.1012") self.assertEqual(inst.dataRequirement[4].type, "DiagnosticReport") self.assertEqual(inst.dataRequirement[5].codeFilter[0].path, "code") - self.assertEqual(inst.dataRequirement[5].codeFilter[0].valueSetString, "2.16.840.1.113883.3.464.1003.196.12.1001") + self.assertEqual(inst.dataRequirement[5].codeFilter[0].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.196.12.1001") self.assertEqual(inst.dataRequirement[5].type, "Medication") + self.assertEqual(inst.dataRequirement[6].codeFilter[0].code[0].code, "active") self.assertEqual(inst.dataRequirement[6].codeFilter[0].path, "status") - self.assertEqual(inst.dataRequirement[6].codeFilter[0].valueCode[0], "active") self.assertEqual(inst.dataRequirement[6].codeFilter[1].path, "medication.code") - self.assertEqual(inst.dataRequirement[6].codeFilter[1].valueSetString, "2.16.840.1.113883.3.464.1003.196.12.1001") + self.assertEqual(inst.dataRequirement[6].codeFilter[1].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.196.12.1001") self.assertEqual(inst.dataRequirement[6].type, "MedicationRequest") + self.assertEqual(inst.dataRequirement[7].codeFilter[0].code[0].code, "completed") self.assertEqual(inst.dataRequirement[7].codeFilter[0].path, "status") - self.assertEqual(inst.dataRequirement[7].codeFilter[0].valueCode[0], "completed") self.assertEqual(inst.dataRequirement[7].codeFilter[1].path, "medication.code") - self.assertEqual(inst.dataRequirement[7].codeFilter[1].valueSetString, "2.16.840.1.113883.3.464.1003.196.12.1001") + self.assertEqual(inst.dataRequirement[7].codeFilter[1].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.196.12.1001") self.assertEqual(inst.dataRequirement[7].type, "MedicationStatement") self.assertEqual(inst.date.date, FHIRDate("2015-07-22").date) self.assertEqual(inst.date.as_json(), "2015-07-22") @@ -78,6 +113,10 @@ def implLibrary1(self, inst): self.assertEqual(inst.id, "library-cms146-example") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "CMS146") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.relatedArtifact[0].resource, "Library/library-quick-model-definition") self.assertEqual(inst.relatedArtifact[0].type, "depends-on") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") @@ -85,39 +124,6 @@ def implLibrary1(self, inst): self.assertEqual(inst.type.coding[0].code, "logic-library") self.assertEqual(inst.version, "2.0.0") - def testLibrary2(self): - inst = self.instantiate_from("library-composition-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Library instance") - self.implLibrary2(inst) - - js = inst.as_json() - self.assertEqual("Library", js["resourceType"]) - inst2 = library.Library(js) - self.implLibrary2(inst2) - - def implLibrary2(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2017-03-10").date) - self.assertEqual(inst.date.as_json(), "2017-03-10") - self.assertEqual(inst.description, "Artifacts required for implementation of Zika Virus Management") - self.assertEqual(inst.id, "composition-example") - self.assertEqual(inst.identifier[0].system, "http://example.org") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "Zika Artifacts") - self.assertEqual(inst.relatedArtifact[0].type, "composed-of") - self.assertEqual(inst.relatedArtifact[1].type, "composed-of") - self.assertEqual(inst.relatedArtifact[2].type, "composed-of") - self.assertEqual(inst.relatedArtifact[3].type, "composed-of") - self.assertEqual(inst.relatedArtifact[4].type, "composed-of") - self.assertEqual(inst.relatedArtifact[5].type, "composed-of") - self.assertEqual(inst.relatedArtifact[6].type, "derived-from") - self.assertEqual(inst.relatedArtifact[6].url, "https://www.cdc.gov/mmwr/volumes/65/wr/mm6539e1.htm?s_cid=mm6539e1_w") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Zika Artifacts") - self.assertEqual(inst.topic[0].text, "Zika Virus Management") - self.assertEqual(inst.type.coding[0].code, "asset-collection") - self.assertEqual(inst.version, "1.0.0") - def testLibrary3(self): inst = self.instantiate_from("library-example.json") self.assertIsNotNone(inst, "Must have instantiated a Library instance") @@ -132,7 +138,7 @@ def implLibrary3(self, inst): self.assertEqual(inst.content[0].contentType, "text/cql") self.assertEqual(inst.content[0].url, "library-example-content.cql") self.assertEqual(inst.dataRequirement[0].codeFilter[0].path, "code") - self.assertEqual(inst.dataRequirement[0].codeFilter[0].valueSetString, "Other Female Reproductive Conditions") + self.assertEqual(inst.dataRequirement[0].codeFilter[0].valueSet, "urn:oid:2.16.840.1.113883.3.464.1003.111.12.1006") self.assertEqual(inst.dataRequirement[0].type, "Condition") self.assertEqual(inst.date.date, FHIRDate("2015-07-22").date) self.assertEqual(inst.date.as_json(), "2015-07-22") @@ -140,6 +146,10 @@ def implLibrary3(self, inst): self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "ChalmydiaScreening_Common") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.relatedArtifact[0].resource, "Library/library-quick-model-definition") self.assertEqual(inst.relatedArtifact[0].type, "depends-on") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") @@ -149,7 +159,7 @@ def implLibrary3(self, inst): self.assertEqual(inst.version, "2.0.0") def testLibrary4(self): - inst = self.instantiate_from("library-predecessor-example.json") + inst = self.instantiate_from("library-composition-example.json") self.assertIsNotNone(inst, "Must have instantiated a Library instance") self.implLibrary4(inst) @@ -159,22 +169,34 @@ def testLibrary4(self): self.implLibrary4(inst2) def implLibrary4(self, inst): - self.assertEqual(inst.content[0].contentType, "text/cql") - self.assertEqual(inst.content[0].title, "FHIR Helpers") - self.assertEqual(inst.content[0].url, "library-fhir-helpers-content.cql") - self.assertEqual(inst.date.date, FHIRDate("2016-11-14").date) - self.assertEqual(inst.date.as_json(), "2016-11-14") - self.assertEqual(inst.description, "FHIR Helpers") - self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "library-fhir-helpers-predecessor") + self.assertEqual(inst.date.date, FHIRDate("2017-03-10").date) + self.assertEqual(inst.date.as_json(), "2017-03-10") + self.assertEqual(inst.description, "Artifacts required for implementation of Zika Virus Management") + self.assertEqual(inst.id, "composition-example") + self.assertEqual(inst.identifier[0].system, "http://example.org") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "FHIRHelpers") - self.assertEqual(inst.relatedArtifact[0].type, "depends-on") - self.assertEqual(inst.relatedArtifact[1].type, "successor") - self.assertEqual(inst.status, "active") + self.assertEqual(inst.identifier[0].value, "Zika Artifacts") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.relatedArtifact[0].resource, "ActivityDefinition/administer-zika-virus-exposure-assessment") + self.assertEqual(inst.relatedArtifact[0].type, "composed-of") + self.assertEqual(inst.relatedArtifact[1].resource, "ActivityDefinition/order-serum-zika-dengue-virus-igm") + self.assertEqual(inst.relatedArtifact[1].type, "composed-of") + self.assertEqual(inst.relatedArtifact[2].resource, "ActivityDefinition/provide-mosquito-prevention-advice") + self.assertEqual(inst.relatedArtifact[2].type, "composed-of") + self.assertEqual(inst.relatedArtifact[3].resource, "Library/zika-virus-intervention-logic") + self.assertEqual(inst.relatedArtifact[3].type, "composed-of") + self.assertEqual(inst.relatedArtifact[4].resource, "PlanDefinition/zika-virus-intervention") + self.assertEqual(inst.relatedArtifact[4].type, "composed-of") + self.assertEqual(inst.relatedArtifact[5].resource, "Questionnaire/zika-virus-exposure-assessment") + self.assertEqual(inst.relatedArtifact[5].type, "composed-of") + self.assertEqual(inst.relatedArtifact[6].type, "derived-from") + self.assertEqual(inst.relatedArtifact[6].url, "https://www.cdc.gov/mmwr/volumes/65/wr/mm6539e1.htm?s_cid=mm6539e1_w") + self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "FHIR Helpers") - self.assertEqual(inst.topic[0].text, "FHIR Helpers") - self.assertEqual(inst.type.coding[0].code, "logic-library") - self.assertEqual(inst.version, "1.6") + self.assertEqual(inst.title, "Zika Artifacts") + self.assertEqual(inst.topic[0].text, "Zika Virus Management") + self.assertEqual(inst.type.coding[0].code, "asset-collection") + self.assertEqual(inst.version, "1.0.0") diff --git a/fhirclient/models/linkage.py b/fhirclient/models/linkage.py index 68a21d3c8..bd8584bab 100644 --- a/fhirclient/models/linkage.py +++ b/fhirclient/models/linkage.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Linkage) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Linkage) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,8 +10,8 @@ class Linkage(domainresource.DomainResource): """ Links records for 'same' item. - Identifies two or more records (resource instances) that are referring to - the same real-world "occurrence". + Identifies two or more records (resource instances) that refer to the same + real-world "occurrence". """ resource_type = "Linkage" @@ -30,7 +30,7 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ Who is responsible for linkages. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.item = None """ Item to be linked. @@ -53,8 +53,8 @@ def elementProperties(self): class LinkageItem(backboneelement.BackboneElement): """ Item to be linked. - Identifies one of the records that is considered to refer to the same real- - world occurrence as well as how the items hould be evaluated within the + Identifies which record considered as the reference to the same real-world + occurrence as well as how the items should be evaluated within the collection of linked items. """ diff --git a/fhirclient/models/linkage_tests.py b/fhirclient/models/linkage_tests.py index 1dcf96eca..1af98ddb5 100644 --- a/fhirclient/models/linkage_tests.py +++ b/fhirclient/models/linkage_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -35,5 +35,8 @@ def implLinkage1(self, inst): self.assertEqual(inst.id, "example") self.assertEqual(inst.item[0].type, "source") self.assertEqual(inst.item[1].type, "alternate") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/list.py b/fhirclient/models/list.py index b06911c8a..2da478c93 100644 --- a/fhirclient/models/list.py +++ b/fhirclient/models/list.py @@ -1,16 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/List) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/List) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class List(domainresource.DomainResource): - """ Information summarized from a list of other resources. - - A set of information summarized from a list of other resources. + """ A list is a curated collection of resources. """ resource_type = "List" @@ -37,7 +35,7 @@ def __init__(self, jsondict=None, strict=True): self.encounter = None """ Context in which list created. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.entry = None """ Entries in the list. @@ -61,7 +59,7 @@ def __init__(self, jsondict=None, strict=True): self.source = None """ Who and/or what defined the list contents (aka Author). - Type `FHIRReference` referencing `Practitioner, Patient, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ current | retired | entered-in-error. @@ -69,7 +67,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ If all resources have the same subject. - Type `FHIRReference` referencing `Patient, Group, Device, Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.title = None """ Descriptive name for the list. @@ -129,7 +127,7 @@ def __init__(self, jsondict=None, strict=True): self.item = None """ Actual entry. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ListEntry, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/list_tests.py b/fhirclient/models/list_tests.py index 8ecde7d5f..c25ae0ca0 100644 --- a/fhirclient/models/list_tests.py +++ b/fhirclient/models/list_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return list.List(js) def testList1(self): - inst = self.instantiate_from("list-example-allergies.json") + inst = self.instantiate_from("list-example-medlist.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList1(inst) @@ -32,22 +32,29 @@ def testList1(self): self.implList1(inst2) def implList1(self, inst): - self.assertEqual(inst.code.coding[0].code, "52472-8") - self.assertEqual(inst.code.coding[0].display, "Allergies and Adverse Drug Reactions") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "Current Allergy List") - self.assertEqual(inst.date.date, FHIRDate("2015-07-14T23:10:23+11:00").date) - self.assertEqual(inst.date.as_json(), "2015-07-14T23:10:23+11:00") - self.assertEqual(inst.id, "current-allergies") - self.assertEqual(inst.mode, "working") - self.assertEqual(inst.orderedBy.coding[0].code, "entry-date") - self.assertEqual(inst.orderedBy.coding[0].system, "http://hl7.org/fhir/list-order") + self.assertEqual(inst.code.coding[0].code, "182836005") + self.assertEqual(inst.code.coding[0].display, "Review of medication") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Medication Review") + self.assertEqual(inst.date.date, FHIRDate("2013-11-20T23:10:23+11:00").date) + self.assertEqual(inst.date.as_json(), "2013-11-20T23:10:23+11:00") + self.assertEqual(inst.entry[0].flag.coding[0].code, "01") + self.assertEqual(inst.entry[0].flag.coding[0].display, "Prescribed") + self.assertEqual(inst.entry[0].flag.coding[0].system, "http://nehta.gov.au/codes/medications/changetype") + self.assertTrue(inst.entry[1].deleted) + self.assertEqual(inst.entry[1].flag.coding[0].code, "02") + self.assertEqual(inst.entry[1].flag.coding[0].display, "Cancelled") + self.assertEqual(inst.entry[1].flag.coding[0].system, "http://nehta.gov.au/codes/medications/changetype") + self.assertEqual(inst.id, "med-list") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.mode, "changes") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Current Allergy List") def testList2(self): - inst = self.instantiate_from("list-example-double-cousin-relationship-pedigree.json") + inst = self.instantiate_from("list-example-familyhistory-genetics-profile-annie.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList2(inst) @@ -57,23 +64,29 @@ def testList2(self): self.implList2(inst2) def implList2(self, inst): - self.assertEqual(inst.code.coding[0].code, "80738-8") - self.assertEqual(inst.code.coding[0].display, "TPMT gene mutations found [Identifier] in Blood or Tissue by Sequencing Nominal") + self.assertEqual(inst.code.coding[0].code, "8670-2") + self.assertEqual(inst.code.coding[0].display, "History of family member diseases") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "TPMT gene mutations found [Identifier] in Blood or Tissue by Sequencing Nominal") - self.assertEqual(inst.contained[0].id, "1") - self.assertEqual(inst.contained[1].id, "2") - self.assertEqual(inst.contained[2].id, "3") - self.assertEqual(inst.contained[3].id, "4") - self.assertEqual(inst.contained[4].id, "5") - self.assertEqual(inst.contained[5].id, "6") - self.assertEqual(inst.id, "example-double-cousin-relationship") + self.assertEqual(inst.contained[0].id, "image") + self.assertEqual(inst.contained[1].id, "1") + self.assertEqual(inst.contained[2].id, "2") + self.assertEqual(inst.contained[3].id, "3") + self.assertEqual(inst.contained[4].id, "4") + self.assertEqual(inst.contained[5].id, "5") + self.assertEqual(inst.contained[6].id, "6") + self.assertEqual(inst.contained[7].id, "7") + self.assertEqual(inst.contained[8].id, "8") + self.assertEqual(inst.contained[9].id, "9") + self.assertEqual(inst.id, "prognosis") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "snapshot") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") def testList3(self): - inst = self.instantiate_from("list-example-empty.json") + inst = self.instantiate_from("list-example-simple-empty.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList3(inst) @@ -83,23 +96,21 @@ def testList3(self): self.implList3(inst2) def implList3(self, inst): - self.assertEqual(inst.code.coding[0].code, "182836005") - self.assertEqual(inst.code.coding[0].display, "Review of medication") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Medication Review") - self.assertEqual(inst.date.date, FHIRDate("2012-11-26T07:30:23+11:00").date) - self.assertEqual(inst.date.as_json(), "2012-11-26T07:30:23+11:00") - self.assertEqual(inst.emptyReason.coding[0].code, "nilknown") - self.assertEqual(inst.emptyReason.coding[0].display, "Nil Known") - self.assertEqual(inst.emptyReason.coding[0].system, "http://hl7.org/fhir/list-empty-reason") - self.assertEqual(inst.emptyReason.text, "The patient is not on any medications") - self.assertEqual(inst.id, "example-empty") + self.assertEqual(inst.code.coding[0].code, "346638") + self.assertEqual(inst.code.coding[0].display, "Patient Admission List") + self.assertEqual(inst.code.coding[0].system, "http://acme.com/list-codes") + self.assertEqual(inst.date.date, FHIRDate("2016-07-14T11:54:05+10:00").date) + self.assertEqual(inst.date.as_json(), "2016-07-14T11:54:05+10:00") + self.assertEqual(inst.id, "example-simple-empty") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "snapshot") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") def testList4(self): - inst = self.instantiate_from("list-example-familyhistory-f201-roel.json") + inst = self.instantiate_from("list-example-empty.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList4(inst) @@ -109,19 +120,26 @@ def testList4(self): self.implList4(inst2) def implList4(self, inst): - self.assertEqual(inst.code.coding[0].code, "8670-2") - self.assertEqual(inst.code.coding[0].display, "History of family member diseases") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.contained[0].id, "fmh-1") - self.assertEqual(inst.contained[1].id, "fmh-2") - self.assertEqual(inst.id, "f201") + self.assertEqual(inst.code.coding[0].code, "182836005") + self.assertEqual(inst.code.coding[0].display, "Review of medication") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Medication Review") + self.assertEqual(inst.date.date, FHIRDate("2012-11-26T07:30:23+11:00").date) + self.assertEqual(inst.date.as_json(), "2012-11-26T07:30:23+11:00") + self.assertEqual(inst.emptyReason.coding[0].code, "nilknown") + self.assertEqual(inst.emptyReason.coding[0].display, "Nil Known") + self.assertEqual(inst.emptyReason.coding[0].system, "http://terminology.hl7.org/CodeSystem/list-empty-reason") + self.assertEqual(inst.emptyReason.text, "The patient is not on any medications") + self.assertEqual(inst.id, "example-empty") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "snapshot") - self.assertEqual(inst.note[0].text, "Both parents, both brothers and both children (twin) are still alive.") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") def testList5(self): - inst = self.instantiate_from("list-example-familyhistory-genetics-profile-annie.json") + inst = self.instantiate_from("list-example-familyhistory-genetics-profile.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList5(inst) @@ -134,23 +152,24 @@ def implList5(self, inst): self.assertEqual(inst.code.coding[0].code, "8670-2") self.assertEqual(inst.code.coding[0].display, "History of family member diseases") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.contained[0].id, "image") - self.assertEqual(inst.contained[1].id, "1") - self.assertEqual(inst.contained[2].id, "2") - self.assertEqual(inst.contained[3].id, "3") - self.assertEqual(inst.contained[4].id, "4") - self.assertEqual(inst.contained[5].id, "5") - self.assertEqual(inst.contained[6].id, "6") - self.assertEqual(inst.contained[7].id, "7") - self.assertEqual(inst.contained[8].id, "8") - self.assertEqual(inst.contained[9].id, "9") - self.assertEqual(inst.id, "prognosis") + self.assertEqual(inst.contained[0].id, "1") + self.assertEqual(inst.contained[1].id, "2") + self.assertEqual(inst.contained[2].id, "3") + self.assertEqual(inst.contained[3].id, "4") + self.assertEqual(inst.contained[4].id, "5") + self.assertEqual(inst.contained[5].id, "6") + self.assertEqual(inst.contained[6].id, "7") + self.assertEqual(inst.contained[7].id, "8") + self.assertEqual(inst.id, "genetic") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "snapshot") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") def testList6(self): - inst = self.instantiate_from("list-example-familyhistory-genetics-profile.json") + inst = self.instantiate_from("list-example-familyhistory-f201-roel.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList6(inst) @@ -163,21 +182,19 @@ def implList6(self, inst): self.assertEqual(inst.code.coding[0].code, "8670-2") self.assertEqual(inst.code.coding[0].display, "History of family member diseases") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.contained[0].id, "1") - self.assertEqual(inst.contained[1].id, "2") - self.assertEqual(inst.contained[2].id, "3") - self.assertEqual(inst.contained[3].id, "4") - self.assertEqual(inst.contained[4].id, "5") - self.assertEqual(inst.contained[5].id, "6") - self.assertEqual(inst.contained[6].id, "7") - self.assertEqual(inst.contained[7].id, "8") - self.assertEqual(inst.id, "genetic") + self.assertEqual(inst.contained[0].id, "fmh-1") + self.assertEqual(inst.contained[1].id, "fmh-2") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "snapshot") + self.assertEqual(inst.note[0].text, "Both parents, both brothers and both children (twin) are still alive.") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") def testList7(self): - inst = self.instantiate_from("list-example-medlist.json") + inst = self.instantiate_from("list-example.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList7(inst) @@ -187,26 +204,23 @@ def testList7(self): self.implList7(inst2) def implList7(self, inst): - self.assertEqual(inst.code.coding[0].code, "182836005") - self.assertEqual(inst.code.coding[0].display, "Review of medication") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Medication Review") - self.assertEqual(inst.date.date, FHIRDate("2013-11-20T23:10:23+11:00").date) - self.assertEqual(inst.date.as_json(), "2013-11-20T23:10:23+11:00") - self.assertEqual(inst.entry[0].flag.coding[0].code, "01") - self.assertEqual(inst.entry[0].flag.coding[0].display, "Prescribed") - self.assertEqual(inst.entry[0].flag.coding[0].system, "http://nehta.gov.au/codes/medications/changetype") - self.assertTrue(inst.entry[1].deleted) - self.assertEqual(inst.entry[1].flag.coding[0].code, "02") - self.assertEqual(inst.entry[1].flag.coding[0].display, "Cancelled") - self.assertEqual(inst.entry[1].flag.coding[0].system, "http://nehta.gov.au/codes/medications/changetype") - self.assertEqual(inst.id, "med-list") + self.assertEqual(inst.date.date, FHIRDate("2012-11-25T22:17:00+11:00").date) + self.assertEqual(inst.date.as_json(), "2012-11-25T22:17:00+11:00") + self.assertTrue(inst.entry[0].deleted) + self.assertEqual(inst.entry[0].flag.text, "Deleted due to error") + self.assertEqual(inst.entry[1].flag.text, "Added") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "urn:uuid:a9fcea7c-fcdf-4d17-a5e0-f26dda030b59") + self.assertEqual(inst.identifier[0].value, "23974652") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "changes") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") def testList8(self): - inst = self.instantiate_from("list-example-simple-empty.json") + inst = self.instantiate_from("list-example-allergies.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList8(inst) @@ -216,18 +230,25 @@ def testList8(self): self.implList8(inst2) def implList8(self, inst): - self.assertEqual(inst.code.coding[0].code, "346638") - self.assertEqual(inst.code.coding[0].display, "Patient Admission List") - self.assertEqual(inst.code.coding[0].system, "http://acme.com/list-codes") - self.assertEqual(inst.date.date, FHIRDate("2016-07-14T11:54:05+10:00").date) - self.assertEqual(inst.date.as_json(), "2016-07-14T11:54:05+10:00") - self.assertEqual(inst.id, "example-simple-empty") - self.assertEqual(inst.mode, "snapshot") + self.assertEqual(inst.code.coding[0].code, "52472-8") + self.assertEqual(inst.code.coding[0].display, "Allergies and Adverse Drug Reactions") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "Current Allergy List") + self.assertEqual(inst.date.date, FHIRDate("2015-07-14T23:10:23+11:00").date) + self.assertEqual(inst.date.as_json(), "2015-07-14T23:10:23+11:00") + self.assertEqual(inst.id, "current-allergies") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.mode, "working") + self.assertEqual(inst.orderedBy.coding[0].code, "entry-date") + self.assertEqual(inst.orderedBy.coding[0].system, "http://terminology.hl7.org/CodeSystem/list-order") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Current Allergy List") def testList9(self): - inst = self.instantiate_from("list-example.json") + inst = self.instantiate_from("list-example-double-cousin-relationship-pedigree.json") self.assertIsNotNone(inst, "Must have instantiated a List instance") self.implList9(inst) @@ -237,16 +258,41 @@ def testList9(self): self.implList9(inst2) def implList9(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2012-11-25T22:17:00+11:00").date) - self.assertEqual(inst.date.as_json(), "2012-11-25T22:17:00+11:00") - self.assertTrue(inst.entry[0].deleted) - self.assertEqual(inst.entry[0].flag.text, "Deleted due to error") - self.assertEqual(inst.entry[1].date.date, FHIRDate("2012-11-21").date) - self.assertEqual(inst.entry[1].date.as_json(), "2012-11-21") - self.assertEqual(inst.entry[1].flag.text, "Added") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].system, "urn:uuid:a9fcea7c-fcdf-4d17-a5e0-f26dda030b59") - self.assertEqual(inst.identifier[0].value, "23974652") + self.assertEqual(inst.code.coding[0].code, "80738-8") + self.assertEqual(inst.code.coding[0].display, "TPMT gene mutations found [Identifier] in Blood or Tissue by Sequencing Nominal") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "TPMT gene mutations found [Identifier] in Blood or Tissue by Sequencing Nominal") + self.assertEqual(inst.contained[0].id, "1") + self.assertEqual(inst.contained[1].id, "2") + self.assertEqual(inst.contained[2].id, "3") + self.assertEqual(inst.contained[3].id, "4") + self.assertEqual(inst.contained[4].id, "5") + self.assertEqual(inst.contained[5].id, "6") + self.assertEqual(inst.id, "example-double-cousin-relationship") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.mode, "snapshot") + self.assertEqual(inst.status, "current") + self.assertEqual(inst.text.status, "generated") + + def testList10(self): + inst = self.instantiate_from("list-example-long.json") + self.assertIsNotNone(inst, "Must have instantiated a List instance") + self.implList10(inst) + + js = inst.as_json() + self.assertEqual("List", js["resourceType"]) + inst2 = list.List(js) + self.implList10(inst2) + + def implList10(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2018-02-21T12:17:00+11:00").date) + self.assertEqual(inst.date.as_json(), "2018-02-21T12:17:00+11:00") + self.assertEqual(inst.id, "long") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "changes") self.assertEqual(inst.status, "current") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/location.py b/fhirclient/models/location.py index a52a5eb66..e0e662105 100644 --- a/fhirclient/models/location.py +++ b/fhirclient/models/location.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Location) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Location) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,7 +11,7 @@ class Location(domainresource.DomainResource): """ Details and position information for a physical place. Details and position information for a physical place where services are - provided and resources and participants may be stored, found, contained or + provided and resources and participants may be stored, found, contained, or accommodated. """ @@ -30,10 +30,14 @@ def __init__(self, jsondict=None, strict=True): Type `Address` (represented as `dict` in JSON). """ self.alias = None - """ A list of alternate names that the location is known as, or was - known as in the past. + """ A list of alternate names that the location is known as, or was + known as, in the past. List of `str` items. """ + self.availabilityExceptions = None + """ Description of availability exceptions. + Type `str`. """ + self.description = None """ Additional details about the location that could be displayed as further information to identify the location beyond its name. @@ -42,7 +46,11 @@ def __init__(self, jsondict=None, strict=True): self.endpoint = None """ Technical endpoints providing access to services operated for the location. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.hoursOfOperation = None + """ What days/times during a week is this location usually open. + List of `LocationHoursOfOperation` items (represented as `dict` in JSON). """ self.identifier = None """ Unique code or number identifying the location to its users. @@ -50,7 +58,7 @@ def __init__(self, jsondict=None, strict=True): self.managingOrganization = None """ Organization responsible for provisioning and upkeep. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.mode = None """ instance | kind. @@ -61,13 +69,13 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.operationalStatus = None - """ The Operational status of the location (typically only for a + """ The operational status of the location (typically only for a bed/room). Type `Coding` (represented as `dict` in JSON). """ self.partOf = None - """ Another Location this one is physically part of. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + """ Another Location this one is physically a part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.physicalType = None """ Physical form of the location. @@ -87,7 +95,7 @@ def __init__(self, jsondict=None, strict=True): self.type = None """ Type of function performed. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ super(Location, self).__init__(jsondict=jsondict, strict=strict) @@ -96,8 +104,10 @@ def elementProperties(self): js.extend([ ("address", "address", address.Address, False, None, False), ("alias", "alias", str, True, None, False), + ("availabilityExceptions", "availabilityExceptions", str, False, None, False), ("description", "description", str, False, None, False), ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("hoursOfOperation", "hoursOfOperation", LocationHoursOfOperation, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("managingOrganization", "managingOrganization", fhirreference.FHIRReference, False, None, False), ("mode", "mode", str, False, None, False), @@ -108,13 +118,56 @@ def elementProperties(self): ("position", "position", LocationPosition, False, None, False), ("status", "status", str, False, None, False), ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), ]) return js from . import backboneelement +class LocationHoursOfOperation(backboneelement.BackboneElement): + """ What days/times during a week is this location usually open. + """ + + resource_type = "LocationHoursOfOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allDay = None + """ The Location is open all day. + Type `bool`. """ + + self.closingTime = None + """ Time that the Location closes. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.daysOfWeek = None + """ mon | tue | wed | thu | fri | sat | sun. + List of `str` items. """ + + self.openingTime = None + """ Time that the Location opens. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(LocationHoursOfOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(LocationHoursOfOperation, self).elementProperties() + js.extend([ + ("allDay", "allDay", bool, False, None, False), + ("closingTime", "closingTime", fhirdate.FHIRDate, False, None, False), + ("daysOfWeek", "daysOfWeek", str, True, None, False), + ("openingTime", "openingTime", fhirdate.FHIRDate, False, None, False), + ]) + return js + + class LocationPosition(backboneelement.BackboneElement): """ The absolute geographic location. @@ -173,6 +226,10 @@ def elementProperties(self): from . import contactpoint except ImportError: contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] try: from . import fhirreference except ImportError: diff --git a/fhirclient/models/location_tests.py b/fhirclient/models/location_tests.py index 4f7d74928..6d108e5ad 100644 --- a/fhirclient/models/location_tests.py +++ b/fhirclient/models/location_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return location.Location(js) def testLocation1(self): - inst = self.instantiate_from("location-example-ambulance.json") + inst = self.instantiate_from("location-example.json") self.assertIsNotNone(inst, "Must have instantiated a Location instance") self.implLocation1(inst) @@ -32,25 +32,44 @@ def testLocation1(self): self.implLocation1(inst2) def implLocation1(self, inst): - self.assertEqual(inst.description, "Ambulance provided by Burgers University Medical Center") - self.assertEqual(inst.id, "amb") - self.assertEqual(inst.mode, "kind") - self.assertEqual(inst.name, "BUMC Ambulance") - self.assertEqual(inst.physicalType.coding[0].code, "ve") - self.assertEqual(inst.physicalType.coding[0].display, "Vehicle") - self.assertEqual(inst.physicalType.coding[0].system, "http://hl7.org/fhir/location-physical-type") + self.assertEqual(inst.address.city, "Den Burg") + self.assertEqual(inst.address.country, "NLD") + self.assertEqual(inst.address.line[0], "Galapagosweg 91, Building A") + self.assertEqual(inst.address.postalCode, "9105 PZ") + self.assertEqual(inst.address.use, "work") + self.assertEqual(inst.alias[0], "BU MC, SW, F2") + self.assertEqual(inst.alias[1], "Burgers University Medical Center, South Wing, second floor") + self.assertEqual(inst.description, "Second floor of the Old South Wing, formerly in use by Psychiatry") + self.assertEqual(inst.id, "1") + self.assertEqual(inst.identifier[0].value, "B1-S.F2") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.mode, "instance") + self.assertEqual(inst.name, "South Wing, second floor") + self.assertEqual(inst.physicalType.coding[0].code, "wi") + self.assertEqual(inst.physicalType.coding[0].display, "Wing") + self.assertEqual(inst.physicalType.coding[0].system, "http://terminology.hl7.org/CodeSystem/location-physical-type") + self.assertEqual(inst.position.altitude, 0) + self.assertEqual(inst.position.latitude, 42.25475478) + self.assertEqual(inst.position.longitude, -83.6945691) self.assertEqual(inst.status, "active") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "mobile") - self.assertEqual(inst.telecom[0].value, "2329") - self.assertEqual(inst.text.div, "
Mobile Clinic
") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "2328") + self.assertEqual(inst.telecom[1].system, "fax") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "2329") + self.assertEqual(inst.telecom[2].system, "email") + self.assertEqual(inst.telecom[2].value, "second wing admissions") + self.assertEqual(inst.telecom[3].system, "url") + self.assertEqual(inst.telecom[3].use, "work") + self.assertEqual(inst.telecom[3].value, "http://sampleorg.com/southwing") + self.assertEqual(inst.text.div, "
Burgers UMC, South Wing, second floor
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "AMB") - self.assertEqual(inst.type.coding[0].display, "Ambulance") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") def testLocation2(self): - inst = self.instantiate_from("location-example-hl7hq.json") + inst = self.instantiate_from("location-example-room.json") self.assertIsNotNone(inst, "Must have instantiated a Location instance") self.implLocation2(inst) @@ -60,34 +79,33 @@ def testLocation2(self): self.implLocation2(inst2) def implLocation2(self, inst): - self.assertEqual(inst.address.city, "Ann Arbor") - self.assertEqual(inst.address.country, "USA") - self.assertEqual(inst.address.line[0], "3300 Washtenaw Avenue, Suite 227") - self.assertEqual(inst.address.postalCode, "48104") - self.assertEqual(inst.address.state, "MI") - self.assertEqual(inst.description, "HL7 Headquarters") - self.assertEqual(inst.id, "hl7") + self.assertEqual(inst.alias[0], "South Wing OR 5") + self.assertEqual(inst.alias[1], "Main Wing OR 2") + self.assertEqual(inst.description, "Old South Wing, Neuro Radiology Operation Room 1 on second floor") + self.assertEqual(inst.id, "2") + self.assertEqual(inst.identifier[0].value, "B1-S.F2.1.00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "instance") - self.assertEqual(inst.name, "Health Level Seven International") - self.assertEqual(inst.physicalType.coding[0].code, "bu") - self.assertEqual(inst.physicalType.coding[0].display, "Building") - self.assertEqual(inst.physicalType.coding[0].system, "http://hl7.org/fhir/location-physical-type") - self.assertEqual(inst.position.latitude, -83.69471) - self.assertEqual(inst.position.longitude, 42.2565) - self.assertEqual(inst.status, "active") + self.assertEqual(inst.name, "South Wing Neuro OR 1") + self.assertEqual(inst.operationalStatus.code, "H") + self.assertEqual(inst.operationalStatus.display, "Housekeeping") + self.assertEqual(inst.operationalStatus.system, "http://terminology.hl7.org/CodeSystem/v2-0116") + self.assertEqual(inst.physicalType.coding[0].code, "ro") + self.assertEqual(inst.physicalType.coding[0].display, "Room") + self.assertEqual(inst.physicalType.coding[0].system, "http://terminology.hl7.org/CodeSystem/location-physical-type") + self.assertEqual(inst.status, "suspended") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].value, "(+1) 734-677-7777") - self.assertEqual(inst.telecom[1].system, "fax") - self.assertEqual(inst.telecom[1].value, "(+1) 734-677-6622") - self.assertEqual(inst.telecom[2].system, "email") - self.assertEqual(inst.telecom[2].value, "hq@HL7.org") + self.assertEqual(inst.telecom[0].value, "2329") + self.assertEqual(inst.text.div, "
Burgers UMC, South Wing, second floor, Neuro Radiology Operation Room 1
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "SLEEP") - self.assertEqual(inst.type.coding[0].display, "Sleep disorders unit") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.type[0].coding[0].code, "RNEU") + self.assertEqual(inst.type[0].coding[0].display, "Neuroradiology unit") + self.assertEqual(inst.type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") def testLocation3(self): - inst = self.instantiate_from("location-example-patients-home.json") + inst = self.instantiate_from("location-example-ambulance.json") self.assertIsNotNone(inst, "Must have instantiated a Location instance") self.implLocation3(inst) @@ -97,22 +115,28 @@ def testLocation3(self): self.implLocation3(inst2) def implLocation3(self, inst): - self.assertEqual(inst.description, "Patient's Home") - self.assertEqual(inst.id, "ph") + self.assertEqual(inst.description, "Ambulance provided by Burgers University Medical Center") + self.assertEqual(inst.id, "amb") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "kind") - self.assertEqual(inst.name, "Patient's Home") - self.assertEqual(inst.physicalType.coding[0].code, "ho") - self.assertEqual(inst.physicalType.coding[0].display, "House") - self.assertEqual(inst.physicalType.coding[0].system, "http://hl7.org/fhir/location-physical-type") + self.assertEqual(inst.name, "BUMC Ambulance") + self.assertEqual(inst.physicalType.coding[0].code, "ve") + self.assertEqual(inst.physicalType.coding[0].display, "Vehicle") + self.assertEqual(inst.physicalType.coding[0].system, "http://terminology.hl7.org/CodeSystem/location-physical-type") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
Patient's Home
") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "mobile") + self.assertEqual(inst.telecom[0].value, "2329") + self.assertEqual(inst.text.div, "
Mobile Clinic
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "PTRES") - self.assertEqual(inst.type.coding[0].display, "Patient's Residence") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.type[0].coding[0].code, "AMB") + self.assertEqual(inst.type[0].coding[0].display, "Ambulance") + self.assertEqual(inst.type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") def testLocation4(self): - inst = self.instantiate_from("location-example-room.json") + inst = self.instantiate_from("location-example-ukpharmacy.json") self.assertIsNotNone(inst, "Must have instantiated a Location instance") self.implLocation4(inst) @@ -122,30 +146,25 @@ def testLocation4(self): self.implLocation4(inst2) def implLocation4(self, inst): - self.assertEqual(inst.alias[0], "South Wing OR 5") - self.assertEqual(inst.alias[1], "Main Wing OR 2") - self.assertEqual(inst.description, "Old South Wing, Neuro Radiology Operation Room 1 on second floor") - self.assertEqual(inst.id, "2") - self.assertEqual(inst.identifier[0].value, "B1-S.F2.1.00") - self.assertEqual(inst.mode, "instance") - self.assertEqual(inst.name, "South Wing Neuro OR 1") - self.assertEqual(inst.operationalStatus.code, "H") - self.assertEqual(inst.operationalStatus.display, "Housekeeping") - self.assertEqual(inst.operationalStatus.system, "http://hl7.org/fhir/v2/0116") - self.assertEqual(inst.physicalType.coding[0].code, "ro") - self.assertEqual(inst.physicalType.coding[0].display, "Room") - self.assertEqual(inst.physicalType.coding[0].system, "http://hl7.org/fhir/location-physical-type") - self.assertEqual(inst.status, "suspended") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].value, "2329") - self.assertEqual(inst.text.div, "
Burgers UMC, South Wing, second floor, Neuro Radiology Operation Room 1
") + self.assertEqual(inst.description, "All Pharmacies in the United Kingdom covered by the National Pharmacy Association") + self.assertEqual(inst.id, "ukp") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.mode, "kind") + self.assertEqual(inst.name, "UK Pharmacies") + self.assertEqual(inst.physicalType.coding[0].code, "jdn") + self.assertEqual(inst.physicalType.coding[0].display, "Jurisdiction") + self.assertEqual(inst.physicalType.coding[0].system, "http://terminology.hl7.org/CodeSystem/location-physical-type") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.div, "
UK Pharmacies
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "RNEU") - self.assertEqual(inst.type.coding[0].display, "Neuroradiology unit") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.type[0].coding[0].code, "PHARM") + self.assertEqual(inst.type[0].coding[0].display, "Pharmacy") + self.assertEqual(inst.type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") def testLocation5(self): - inst = self.instantiate_from("location-example-ukpharmacy.json") + inst = self.instantiate_from("location-example-patients-home.json") self.assertIsNotNone(inst, "Must have instantiated a Location instance") self.implLocation5(inst) @@ -155,22 +174,25 @@ def testLocation5(self): self.implLocation5(inst2) def implLocation5(self, inst): - self.assertEqual(inst.description, "All Pharmacies in the United Kingdom covered by the National Pharmacy Association") - self.assertEqual(inst.id, "ukp") + self.assertEqual(inst.description, "Patient's Home") + self.assertEqual(inst.id, "ph") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "kind") - self.assertEqual(inst.name, "UK Pharmacies") - self.assertEqual(inst.physicalType.coding[0].code, "jdn") - self.assertEqual(inst.physicalType.coding[0].display, "Jurisdiction") - self.assertEqual(inst.physicalType.coding[0].system, "http://hl7.org/fhir/location-physical-type") + self.assertEqual(inst.name, "Patient's Home") + self.assertEqual(inst.physicalType.coding[0].code, "ho") + self.assertEqual(inst.physicalType.coding[0].display, "House") + self.assertEqual(inst.physicalType.coding[0].system, "http://terminology.hl7.org/CodeSystem/location-physical-type") self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
UK Pharmacies
") + self.assertEqual(inst.text.div, "
Patient's Home
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "PHARM") - self.assertEqual(inst.type.coding[0].display, "Pharmacy") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.type[0].coding[0].code, "PTRES") + self.assertEqual(inst.type[0].coding[0].display, "Patient's Residence") + self.assertEqual(inst.type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") def testLocation6(self): - inst = self.instantiate_from("location-example.json") + inst = self.instantiate_from("location-example-hl7hq.json") self.assertIsNotNone(inst, "Must have instantiated a Location instance") self.implLocation6(inst) @@ -180,38 +202,32 @@ def testLocation6(self): self.implLocation6(inst2) def implLocation6(self, inst): - self.assertEqual(inst.address.city, "Den Burg") - self.assertEqual(inst.address.country, "NLD") - self.assertEqual(inst.address.line[0], "Galapagosweg 91, Building A") - self.assertEqual(inst.address.postalCode, "9105 PZ") - self.assertEqual(inst.address.use, "work") - self.assertEqual(inst.description, "Second floor of the Old South Wing, formerly in use by Psychiatry") - self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/location-alias") - self.assertEqual(inst.extension[0].valueString, "Burgers University Medical Center, South Wing, second floor") - self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/location-alias") - self.assertEqual(inst.extension[1].valueString, "BU MC, SW, F2") - self.assertEqual(inst.id, "1") - self.assertEqual(inst.identifier[0].value, "B1-S.F2") + self.assertEqual(inst.address.city, "Ann Arbor") + self.assertEqual(inst.address.country, "USA") + self.assertEqual(inst.address.line[0], "3300 Washtenaw Avenue, Suite 227") + self.assertEqual(inst.address.postalCode, "48104") + self.assertEqual(inst.address.state, "MI") + self.assertEqual(inst.description, "HL7 Headquarters") + self.assertEqual(inst.id, "hl7") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.mode, "instance") - self.assertEqual(inst.name, "South Wing, second floor") - self.assertEqual(inst.physicalType.coding[0].code, "wi") - self.assertEqual(inst.physicalType.coding[0].display, "Wing") - self.assertEqual(inst.physicalType.coding[0].system, "http://hl7.org/fhir/location-physical-type") - self.assertEqual(inst.position.altitude, 0) - self.assertEqual(inst.position.latitude, 42.25475478) - self.assertEqual(inst.position.longitude, -83.6945691) + self.assertEqual(inst.name, "Health Level Seven International") + self.assertEqual(inst.physicalType.coding[0].code, "bu") + self.assertEqual(inst.physicalType.coding[0].display, "Building") + self.assertEqual(inst.physicalType.coding[0].system, "http://terminology.hl7.org/CodeSystem/location-physical-type") + self.assertEqual(inst.position.latitude, -83.69471) + self.assertEqual(inst.position.longitude, 42.2565) self.assertEqual(inst.status, "active") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "2328") + self.assertEqual(inst.telecom[0].value, "(+1) 734-677-7777") self.assertEqual(inst.telecom[1].system, "fax") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "2329") + self.assertEqual(inst.telecom[1].value, "(+1) 734-677-6622") self.assertEqual(inst.telecom[2].system, "email") - self.assertEqual(inst.telecom[2].value, "second wing admissions") - self.assertEqual(inst.telecom[3].system, "url") - self.assertEqual(inst.telecom[3].use, "work") - self.assertEqual(inst.telecom[3].value, "http://sampleorg.com/southwing") - self.assertEqual(inst.text.div, "
Burgers UMC, South Wing, second floor
") + self.assertEqual(inst.telecom[2].value, "hq@HL7.org") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "SLEEP") + self.assertEqual(inst.type[0].coding[0].display, "Sleep disorders unit") + self.assertEqual(inst.type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") diff --git a/fhirclient/models/marketingstatus.py b/fhirclient/models/marketingstatus.py new file mode 100644 index 000000000..8450885b8 --- /dev/null +++ b/fhirclient/models/marketingstatus.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MarketingStatus) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import backboneelement + +class MarketingStatus(backboneelement.BackboneElement): + """ The marketing status describes the date when a medicinal product is + actually put on the market or the date as of which it is no longer + available. + """ + + resource_type = "MarketingStatus" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.country = None + """ The country in which the marketing authorisation has been granted + shall be specified It should be specified using the ISO 3166 ‑ 1 + alpha-2 code elements. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.dateRange = None + """ The date when the Medicinal Product is placed on the market by the + Marketing Authorisation Holder (or where applicable, the + manufacturer/distributor) in a country and/or jurisdiction shall be + provided A complete date consisting of day, month and year shall be + specified using the ISO 8601 date format NOTE “Placed on the + market” refers to the release of the Medicinal Product into the + distribution chain. + Type `Period` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Where a Medicines Regulatory Agency has granted a marketing + authorisation for which specific provisions within a jurisdiction + apply, the jurisdiction can be specified using an appropriate + controlled terminology The controlled term and the controlled term + identifier shall be specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.restoreDate = None + """ The date when the Medicinal Product is placed on the market by the + Marketing Authorisation Holder (or where applicable, the + manufacturer/distributor) in a country and/or jurisdiction shall be + provided A complete date consisting of day, month and year shall be + specified using the ISO 8601 date format NOTE “Placed on the + market” refers to the release of the Medicinal Product into the + distribution chain. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ This attribute provides information on the status of the marketing + of the medicinal product See ISO/TS 20443 for more information and + examples. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MarketingStatus, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MarketingStatus, self).elementProperties() + js.extend([ + ("country", "country", codeableconcept.CodeableConcept, False, None, True), + ("dateRange", "dateRange", period.Period, False, None, True), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, False, None, False), + ("restoreDate", "restoreDate", fhirdate.FHIRDate, False, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/measure.py b/fhirclient/models/measure.py index 589c50abe..848ad69db 100644 --- a/fhirclient/models/measure.py +++ b/fhirclient/models/measure.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Measure) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Measure) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,6 +27,10 @@ def __init__(self, jsondict=None, strict=True): """ When the measure was approved by publisher. Type `FHIRDate` (represented as `str` in JSON). """ + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.clinicalRecommendationStatement = None """ Summary of clinical guidelines. Type `str`. """ @@ -39,16 +43,12 @@ def __init__(self, jsondict=None, strict=True): """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ - self.contributor = None - """ A content contributor. - List of `Contributor` items (represented as `dict` in JSON). """ - self.copyright = None """ Use and/or publishing restrictions. Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.definition = None @@ -63,10 +63,18 @@ def __init__(self, jsondict=None, strict=True): """ Disclaimer for use of the measure or its referenced content. Type `str`. """ + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.effectivePeriod = None """ When the measure is expected to be used. Type `Period` (represented as `dict` in JSON). """ + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.experimental = None """ For testing purposes, not real usage. Type `bool`. """ @@ -84,9 +92,8 @@ def __init__(self, jsondict=None, strict=True): List of `Identifier` items (represented as `dict` in JSON). """ self.improvementNotation = None - """ Improvement notation for the measure, e.g. higher score indicates - better quality. - Type `str`. """ + """ increase | decrease. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.jurisdiction = None """ Intended jurisdiction for measure (if applicable). @@ -98,7 +105,7 @@ def __init__(self, jsondict=None, strict=True): self.library = None """ Logic used by the measure. - List of `FHIRReference` items referencing `Library` (represented as `dict` in JSON). """ + List of `str` items. """ self.name = None """ Name for this measure (computer friendly). @@ -117,29 +124,43 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.rationale = None - """ Why does this measure exist. + """ Detailed description of why the measure exists. Type `str`. """ self.relatedArtifact = None - """ Additional documentation, citations, etc. + """ Additional documentation, citations, etc.. List of `RelatedArtifact` items (represented as `dict` in JSON). """ + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.riskAdjustment = None - """ How is risk adjustment applied for this measure. + """ How risk adjustment is applied for this measure. Type `str`. """ self.scoring = None """ proportion | ratio | continuous-variable | cohort. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.set = None - """ The measure set, e.g. Preventive Care and Screening. - Type `str`. """ - self.status = None """ draft | active | retired | unknown. Type `str`. """ + self.subjectCodeableConcept = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate title of the measure. + Type `str`. """ + self.supplementalData = None """ What other data should be reported with the measure. List of `MeasureSupplementalData` items (represented as `dict` in JSON). """ @@ -149,7 +170,8 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.topic = None - """ E.g. Education, Treatment, Assessment, etc. + """ The category of the measure, such as Education, Treatment, + Assessment, etc.. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.type = None @@ -158,7 +180,8 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.url = None - """ Logical URI to reference this measure (globally unique). + """ Canonical identifier for this measure, represented as a URI + (globally unique). Type `str`. """ self.usage = None @@ -166,7 +189,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -179,34 +202,39 @@ def elementProperties(self): js = super(Measure, self).elementProperties() js.extend([ ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), ("clinicalRecommendationStatement", "clinicalRecommendationStatement", str, False, None, False), ("compositeScoring", "compositeScoring", codeableconcept.CodeableConcept, False, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("contributor", "contributor", contributor.Contributor, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("definition", "definition", str, True, None, False), ("description", "description", str, False, None, False), ("disclaimer", "disclaimer", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), ("experimental", "experimental", bool, False, None, False), ("group", "group", MeasureGroup, True, None, False), ("guidance", "guidance", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("improvementNotation", "improvementNotation", str, False, None, False), + ("improvementNotation", "improvementNotation", codeableconcept.CodeableConcept, False, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), - ("library", "library", fhirreference.FHIRReference, True, None, False), + ("library", "library", str, True, None, False), ("name", "name", str, False, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("rateAggregation", "rateAggregation", str, False, None, False), ("rationale", "rationale", str, False, None, False), ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), ("riskAdjustment", "riskAdjustment", str, False, None, False), ("scoring", "scoring", codeableconcept.CodeableConcept, False, None, False), - ("set", "set", str, False, None, False), ("status", "status", str, False, None, True), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), + ("subtitle", "subtitle", str, False, None, False), ("supplementalData", "supplementalData", MeasureSupplementalData, True, None, False), ("title", "title", str, False, None, False), ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), @@ -237,18 +265,14 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.code = None + """ Meaning of the group. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.description = None """ Summary description. Type `str`. """ - self.identifier = None - """ Unique identifier. - Type `Identifier` (represented as `dict` in JSON). """ - - self.name = None - """ Short name. - Type `str`. """ - self.population = None """ Population criteria. List of `MeasureGroupPopulation` items (represented as `dict` in JSON). """ @@ -262,9 +286,8 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MeasureGroup, self).elementProperties() js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("description", "description", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, True), - ("name", "name", str, False, None, False), ("population", "population", MeasureGroupPopulation, True, None, False), ("stratifier", "stratifier", MeasureGroupStratifier, True, None, False), ]) @@ -294,32 +317,21 @@ def __init__(self, jsondict=None, strict=True): Type `CodeableConcept` (represented as `dict` in JSON). """ self.criteria = None - """ The name of a valid referenced CQL expression (may be namespaced) - that defines this population criteria. - Type `str`. """ + """ The criteria that defines this population. + Type `Expression` (represented as `dict` in JSON). """ self.description = None """ The human readable description of this population criteria. Type `str`. """ - self.identifier = None - """ Unique identifier. - Type `Identifier` (represented as `dict` in JSON). """ - - self.name = None - """ Short name. - Type `str`. """ - super(MeasureGroupPopulation, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(MeasureGroupPopulation, self).elementProperties() js.extend([ ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("criteria", "criteria", str, False, None, True), + ("criteria", "criteria", expression.Expression, False, None, True), ("description", "description", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("name", "name", str, False, None, False), ]) return js @@ -328,7 +340,7 @@ class MeasureGroupStratifier(backboneelement.BackboneElement): """ Stratifier criteria for the measure. The stratifier criteria for the measure report, specified as either the - name of a valid CQL expression defined within a referenced library, or a + name of a valid CQL expression defined within a referenced library or a valid FHIR Resource Path. """ @@ -342,17 +354,20 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.code = None + """ Meaning of the stratifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.component = None + """ Stratifier criteria component for the measure. + List of `MeasureGroupStratifierComponent` items (represented as `dict` in JSON). """ + self.criteria = None """ How the measure should be stratified. - Type `str`. """ - - self.identifier = None - """ The identifier for the stratifier used to coordinate the reported - data back to this stratifier. - Type `Identifier` (represented as `dict` in JSON). """ + Type `Expression` (represented as `dict` in JSON). """ - self.path = None - """ Path to the stratifier. + self.description = None + """ The human readable description of this stratifier. Type `str`. """ super(MeasureGroupStratifier, self).__init__(jsondict=jsondict, strict=strict) @@ -360,9 +375,52 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MeasureGroupStratifier, self).elementProperties() js.extend([ - ("criteria", "criteria", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("path", "path", str, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("component", "component", MeasureGroupStratifierComponent, True, None, False), + ("criteria", "criteria", expression.Expression, False, None, False), + ("description", "description", str, False, None, False), + ]) + return js + + +class MeasureGroupStratifierComponent(backboneelement.BackboneElement): + """ Stratifier criteria component for the measure. + + A component of the stratifier criteria for the measure report, specified as + either the name of a valid CQL expression defined within a referenced + library or a valid FHIR Resource Path. + """ + + resource_type = "MeasureGroupStratifierComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Meaning of the stratifier component. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.criteria = None + """ Component of how the measure should be stratified. + Type `Expression` (represented as `dict` in JSON). """ + + self.description = None + """ The human readable description of this stratifier component. + Type `str`. """ + + super(MeasureGroupStratifierComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureGroupStratifierComponent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("criteria", "criteria", expression.Expression, False, None, True), + ("description", "description", str, False, None, False), ]) return js @@ -385,16 +443,16 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.code = None + """ Meaning of the supplemental data. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.criteria = None """ Expression describing additional data to be reported. - Type `str`. """ + Type `Expression` (represented as `dict` in JSON). """ - self.identifier = None - """ Identifier, unique within the measure. - Type `Identifier` (represented as `dict` in JSON). """ - - self.path = None - """ Path to the supplemental data element. + self.description = None + """ The human readable description of this supplemental data. Type `str`. """ self.usage = None @@ -406,9 +464,9 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MeasureSupplementalData, self).elementProperties() js.extend([ - ("criteria", "criteria", str, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("path", "path", str, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("criteria", "criteria", expression.Expression, False, None, True), + ("description", "description", str, False, None, False), ("usage", "usage", codeableconcept.CodeableConcept, True, None, False), ]) return js @@ -424,9 +482,9 @@ def elementProperties(self): except ImportError: contactdetail = sys.modules[__package__ + '.contactdetail'] try: - from . import contributor + from . import expression except ImportError: - contributor = sys.modules[__package__ + '.contributor'] + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/measure_tests.py b/fhirclient/models/measure_tests.py index 95de6ce17..ea8fdd011 100644 --- a/fhirclient/models/measure_tests.py +++ b/fhirclient/models/measure_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return measure.Measure(js) def testMeasure1(self): - inst = self.instantiate_from("measure-cms146-example.json") + inst = self.instantiate_from("measure-component-b-example.json") self.assertIsNotNone(inst, "Must have instantiated a Measure instance") self.implMeasure1(inst) @@ -32,12 +32,112 @@ def testMeasure1(self): self.implMeasure1(inst2) def implMeasure1(self, inst): + self.assertEqual(inst.group[0].id, "Main") + self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") + self.assertEqual(inst.group[0].population[0].criteria.expression, "Initial Population") + self.assertEqual(inst.group[0].population[0].criteria.language, "text/cql") + self.assertEqual(inst.group[0].population[1].code.coding[0].code, "denominator") + self.assertEqual(inst.group[0].population[1].criteria.expression, "Denominator") + self.assertEqual(inst.group[0].population[1].criteria.language, "text/cql") + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "numerator") + self.assertEqual(inst.group[0].population[2].criteria.expression, "Numerator") + self.assertEqual(inst.group[0].population[2].criteria.language, "text/cql") + self.assertEqual(inst.id, "component-b-example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.scoring.coding[0].code, "proportion") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Screening for Depression") + + def testMeasure2(self): + inst = self.instantiate_from("measure-predecessor-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Measure instance") + self.implMeasure2(inst) + + js = inst.as_json() + self.assertEqual("Measure", js["resourceType"]) + inst2 = measure.Measure(js) + self.implMeasure2(inst2) + + def implMeasure2(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2014-03-08").date) + self.assertEqual(inst.date.as_json(), "2014-03-08") + self.assertEqual(inst.description, "Exclusive breastfeeding measure of outcomes for exclusive breastmilk feeding of newborns.") + self.assertEqual(inst.group[0].id, "PopulationGroup1") + self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") + self.assertEqual(inst.group[0].population[0].criteria.expression, "InitialPopulation1") + self.assertEqual(inst.group[0].population[0].criteria.language, "text/cql") + self.assertEqual(inst.group[0].population[1].code.coding[0].code, "denominator") + self.assertEqual(inst.group[0].population[1].criteria.expression, "Denominator1") + self.assertEqual(inst.group[0].population[1].criteria.language, "text/cql") + self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator-exclusions") + self.assertEqual(inst.group[0].population[2].criteria.expression, "DenominatorExclusions1") + self.assertEqual(inst.group[0].population[2].criteria.language, "text/cql") + self.assertEqual(inst.group[0].population[3].code.coding[0].code, "numerator") + self.assertEqual(inst.group[0].population[3].criteria.expression, "Numerator1") + self.assertEqual(inst.group[0].population[3].criteria.language, "text/cql") + self.assertEqual(inst.group[1].id, "PopulationGroup2") + self.assertEqual(inst.group[1].population[0].code.coding[0].code, "initial-population") + self.assertEqual(inst.group[1].population[0].criteria.expression, "InitialPopulation2") + self.assertEqual(inst.group[1].population[0].criteria.language, "text/cql") + self.assertEqual(inst.group[1].population[1].code.coding[0].code, "denominator") + self.assertEqual(inst.group[1].population[1].criteria.expression, "Denominator2") + self.assertEqual(inst.group[1].population[1].criteria.language, "text/cql") + self.assertEqual(inst.group[1].population[2].code.coding[0].code, "denominator-exclusion") + self.assertEqual(inst.group[1].population[2].criteria.expression, "DenominatorExclusions2") + self.assertEqual(inst.group[1].population[2].criteria.language, "text/cql") + self.assertEqual(inst.group[1].population[3].code.coding[0].code, "numerator") + self.assertEqual(inst.group[1].population[3].criteria.expression, "Numerator2") + self.assertEqual(inst.group[1].population[3].criteria.language, "text/cql") + self.assertEqual(inst.id, "measure-predecessor-example") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "exclusive-breastfeeding-measure") + self.assertEqual(inst.improvementNotation.coding[0].code, "increase") + self.assertEqual(inst.improvementNotation.coding[0].system, "http://terminology.hl7.org/CodeSystem/measure-improvement-notation") + self.assertEqual(inst.library[0], "Library/library-exclusive-breastfeeding-cqm-logic") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.purpose, "Measure of newborns who were fed breast milk only since birth") + self.assertEqual(inst.relatedArtifact[0].citation, "American Academy of Pediatrics. (2005). Section on Breastfeeding. Policy Statement:Breastfeeding and the Use of Human Milk. Pediatrics.115:496-506.") + self.assertEqual(inst.relatedArtifact[0].type, "documentation") + self.assertEqual(inst.relatedArtifact[1].type, "documentation") + self.assertEqual(inst.relatedArtifact[2].type, "documentation") + self.assertEqual(inst.relatedArtifact[3].type, "documentation") + self.assertEqual(inst.relatedArtifact[4].type, "documentation") + self.assertEqual(inst.relatedArtifact[5].type, "documentation") + self.assertEqual(inst.relatedArtifact[6].citation, "Kramer, M.S. & Kakuma, R. (2002).Optimal duration of exclusive breastfeeding. [107 refs] Cochrane Database of Systematic Reviews. (1):CD003517.") + self.assertEqual(inst.relatedArtifact[6].type, "documentation") + self.assertEqual(inst.relatedArtifact[7].citation, "Petrova, A., Hegyi, T., & Mehta, R. (2007). Maternal race/ethnicity and one-month exclusive breastfeeding in association with the in-hospital feeding modality. Breastfeeding Medicine. 2(2):92-8.") + self.assertEqual(inst.relatedArtifact[7].type, "documentation") + self.assertEqual(inst.relatedArtifact[8].type, "documentation") + self.assertEqual(inst.relatedArtifact[9].type, "documentation") + self.assertEqual(inst.scoring.coding[0].code, "proportion") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Exclusive Breastfeeding Measure") + self.assertEqual(inst.topic[0].text, "Exclusive Breastfeeding") + self.assertEqual(inst.type[0].coding[0].code, "process") + self.assertEqual(inst.version, "4.0.0") + + def testMeasure3(self): + inst = self.instantiate_from("measure-cms146-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Measure instance") + self.implMeasure3(inst) + + js = inst.as_json() + self.assertEqual("Measure", js["resourceType"]) + inst2 = measure.Measure(js) + self.implMeasure3(inst2) + + def implMeasure3(self, inst): self.assertEqual(inst.approvalDate.date, FHIRDate("2016-01-01").date) self.assertEqual(inst.approvalDate.as_json(), "2016-01-01") + self.assertEqual(inst.author[0].name, "National Committee for Quality Assurance") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://www.ncqa.org/") - self.assertEqual(inst.contributor[0].name, "National Committee for Quality Assurance") - self.assertEqual(inst.contributor[0].type, "author") self.assertEqual(inst.date.date, FHIRDate("2017-03-10").date) self.assertEqual(inst.date.as_json(), "2017-03-10") self.assertEqual(inst.description, "Percentage of children 3-18 years of age who were diagnosed with pharyngitis, ordered an antibiotic and received a group A streptococcus (strep) test for the episode.") @@ -46,25 +146,28 @@ def implMeasure1(self, inst): self.assertEqual(inst.effectivePeriod.start.date, FHIRDate("2017-01-01").date) self.assertEqual(inst.effectivePeriod.start.as_json(), "2017-01-01") self.assertTrue(inst.experimental) - self.assertEqual(inst.group[0].identifier.value, "CMS146-group-1") + self.assertEqual(inst.group[0].id, "CMS146-group-1") self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") - self.assertEqual(inst.group[0].population[0].criteria, "CMS146.InInitialPopulation") - self.assertEqual(inst.group[0].population[0].identifier.value, "initial-population-identifier") + self.assertEqual(inst.group[0].population[0].criteria.expression, "CMS146.InInitialPopulation") + self.assertEqual(inst.group[0].population[0].criteria.language, "text/cql") self.assertEqual(inst.group[0].population[1].code.coding[0].code, "numerator") - self.assertEqual(inst.group[0].population[1].criteria, "CMS146.InNumerator") - self.assertEqual(inst.group[0].population[1].identifier.value, "numerator-identifier") + self.assertEqual(inst.group[0].population[1].criteria.expression, "CMS146.InNumerator") + self.assertEqual(inst.group[0].population[1].criteria.language, "text/cql") self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator") - self.assertEqual(inst.group[0].population[2].criteria, "CMS146.InDenominator") - self.assertEqual(inst.group[0].population[2].identifier.value, "denominator-identifier") + self.assertEqual(inst.group[0].population[2].criteria.expression, "CMS146.InDenominator") + self.assertEqual(inst.group[0].population[2].criteria.language, "text/cql") self.assertEqual(inst.group[0].population[3].code.coding[0].code, "denominator-exclusion") - self.assertEqual(inst.group[0].population[3].criteria, "CMS146.InDenominatorExclusions") - self.assertEqual(inst.group[0].population[3].identifier.value, "denominator-exclusions-identifier") - self.assertEqual(inst.group[0].stratifier[0].criteria, "CMS146.AgesUpToNine") - self.assertEqual(inst.group[0].stratifier[0].identifier.value, "stratifier-ages-up-to-9") - self.assertEqual(inst.group[0].stratifier[1].criteria, "CMS146.AgesTenPlus") - self.assertEqual(inst.group[0].stratifier[1].identifier.value, "stratifier-ages-10-plus") - self.assertEqual(inst.group[0].stratifier[2].identifier.value, "stratifier-ages-up-to-9") - self.assertEqual(inst.group[0].stratifier[2].path, "Patient.gender") + self.assertEqual(inst.group[0].population[3].criteria.expression, "CMS146.InDenominatorExclusions") + self.assertEqual(inst.group[0].population[3].criteria.language, "text/cql") + self.assertEqual(inst.group[0].stratifier[0].code.text, "stratifier-ages-up-to-9") + self.assertEqual(inst.group[0].stratifier[0].criteria.expression, "CMS146.AgesUpToNine") + self.assertEqual(inst.group[0].stratifier[0].criteria.language, "text/cql") + self.assertEqual(inst.group[0].stratifier[1].code.text, "stratifier-ages-10-plus") + self.assertEqual(inst.group[0].stratifier[1].criteria.expression, "CMS146.AgesTenPlus") + self.assertEqual(inst.group[0].stratifier[1].criteria.language, "text/cql") + self.assertEqual(inst.group[0].stratifier[2].code.text, "stratifier-gender") + self.assertEqual(inst.group[0].stratifier[2].criteria.expression, "Patient.gender") + self.assertEqual(inst.group[0].stratifier[2].criteria.language, "text/fhirpath") self.assertEqual(inst.guidance, "This is an episode of care measure that examines all eligible episodes for the patient during the measurement period. If the patient has more than one episode, include all episodes in the measure") self.assertEqual(inst.id, "measure-cms146-example") self.assertEqual(inst.identifier[0].system, "http://hl7.org/fhir/cqi/ecqm/Measure/Identifier/cms") @@ -73,166 +176,97 @@ def implMeasure1(self, inst): self.assertEqual(inst.identifier[1].system, "http://hl7.org/fhir/cqi/ecqm/Measure/Identifier/nqf") self.assertEqual(inst.identifier[1].use, "official") self.assertEqual(inst.identifier[1].value, "0002") - self.assertEqual(inst.improvementNotation, "Higher score indicates better quality") + self.assertEqual(inst.improvementNotation.coding[0].code, "increase") + self.assertEqual(inst.improvementNotation.coding[0].system, "http://terminology.hl7.org/CodeSystem/measure-improvement-notation") self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-09-01").date) self.assertEqual(inst.lastReviewDate.as_json(), "2016-09-01") + self.assertEqual(inst.library[0], "Library/library-cms146-example") self.assertEqual(inst.name, "CMS146") self.assertEqual(inst.publisher, "National Committee for Quality Assurance") self.assertEqual(inst.purpose, "Measure of children with a group A streptococcus test in the 7-day period from 3 days prior through 3 days after the diagnosis of pharyngitis") - self.assertEqual(inst.relatedArtifact[0].citation, "Linder, J.A., D.W. Bates, G.M. Lee, J.A. Finkelstein. 2005. \"Antibiotic treatment of children with sore throat.\" JAMA 294(18):2315-2322. ") + self.assertEqual(inst.relatedArtifact[0].citation, "Linder, J.A., D.W. Bates, G.M. Lee, J.A. Finkelstein. 2005. _Antibiotic treatment of children with sore throat._ JAMA 294(18):2315-2322. ") self.assertEqual(inst.relatedArtifact[0].type, "documentation") - self.assertEqual(inst.relatedArtifact[1].citation, "Infectious Diseases Society of America. 2012. \"Clinical Practice Guideline for the Diagnosis and Management of Group A Streptococcal Pharyngitis: 2012 Update.\" ") + self.assertEqual(inst.relatedArtifact[1].citation, "Infectious Diseases Society of America. 2012. _Clinical Practice Guideline for the Diagnosis and Management of Group A Streptococcal Pharyngitis: 2012 Update._ ") self.assertEqual(inst.relatedArtifact[1].type, "documentation") self.assertEqual(inst.relatedArtifact[2].type, "documentation") self.assertEqual(inst.scoring.coding[0].code, "proportion") self.assertEqual(inst.status, "active") - self.assertEqual(inst.supplementalData[0].identifier.value, "supplemental-data-gender") - self.assertEqual(inst.supplementalData[0].path, "Patient.gender") - self.assertEqual(inst.supplementalData[1].identifier.value, "supplemental-data-deceased") - self.assertEqual(inst.supplementalData[1].path, "deceasedBoolean") + self.assertEqual(inst.supplementalData[0].code.text, "supplemental-data-gender") + self.assertEqual(inst.supplementalData[0].criteria.expression, "Patient.gender") + self.assertEqual(inst.supplementalData[0].criteria.language, "text/fhirpath") + self.assertEqual(inst.supplementalData[1].code.text, "supplemental-data-deceased") + self.assertEqual(inst.supplementalData[1].criteria.expression, "deceasedBoolean") + self.assertEqual(inst.supplementalData[1].criteria.language, "text/fhirpath") self.assertEqual(inst.text.status, "additional") self.assertEqual(inst.title, "Appropriate Testing for Children with Pharyngitis") self.assertEqual(inst.topic[0].coding[0].code, "57024-2") - self.assertEqual(inst.topic[0].coding[0].system, "http://hl7.org/fhir/c80-doc-typecodes") + self.assertEqual(inst.topic[0].coding[0].system, "http://loinc.org") self.assertEqual(inst.type[0].coding[0].code, "process") self.assertEqual(inst.url, "http://hl7.org/fhir/Measure/measure-cms146-example") self.assertEqual(inst.useContext[0].code.code, "program") self.assertEqual(inst.useContext[0].valueCodeableConcept.text, "eligibile-provider") + self.assertEqual(inst.useContext[1].code.code, "age") + self.assertEqual(inst.useContext[1].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") + self.assertEqual(inst.useContext[1].valueRange.high.unit, "a") + self.assertEqual(inst.useContext[1].valueRange.high.value, 18) + self.assertEqual(inst.useContext[1].valueRange.low.unit, "a") + self.assertEqual(inst.useContext[1].valueRange.low.value, 3) self.assertEqual(inst.version, "1.0.0") - def testMeasure2(self): + def testMeasure4(self): inst = self.instantiate_from("measure-component-a-example.json") self.assertIsNotNone(inst, "Must have instantiated a Measure instance") - self.implMeasure2(inst) + self.implMeasure4(inst) js = inst.as_json() self.assertEqual("Measure", js["resourceType"]) inst2 = measure.Measure(js) - self.implMeasure2(inst2) + self.implMeasure4(inst2) - def implMeasure2(self, inst): - self.assertEqual(inst.group[0].identifier.value, "Main") + def implMeasure4(self, inst): + self.assertEqual(inst.group[0].id, "Main") self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") - self.assertEqual(inst.group[0].population[0].criteria, "Initial Population") + self.assertEqual(inst.group[0].population[0].criteria.expression, "Initial Population") + self.assertEqual(inst.group[0].population[0].criteria.language, "text/cql") self.assertEqual(inst.group[0].population[1].code.coding[0].code, "denominator") - self.assertEqual(inst.group[0].population[1].criteria, "Denominator") + self.assertEqual(inst.group[0].population[1].criteria.expression, "Denominator") + self.assertEqual(inst.group[0].population[1].criteria.language, "text/cql") self.assertEqual(inst.group[0].population[2].code.coding[0].code, "numerator") - self.assertEqual(inst.group[0].population[2].criteria, "Numerator") + self.assertEqual(inst.group[0].population[2].criteria.expression, "Numerator") + self.assertEqual(inst.group[0].population[2].criteria.language, "text/cql") self.assertEqual(inst.id, "component-a-example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.scoring.coding[0].code, "proportion") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.title, "Screening for Alcohol Misuse") - def testMeasure3(self): - inst = self.instantiate_from("measure-component-b-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Measure instance") - self.implMeasure3(inst) - - js = inst.as_json() - self.assertEqual("Measure", js["resourceType"]) - inst2 = measure.Measure(js) - self.implMeasure3(inst2) - - def implMeasure3(self, inst): - self.assertEqual(inst.group[0].identifier.value, "Main") - self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") - self.assertEqual(inst.group[0].population[0].criteria, "Initial Population") - self.assertEqual(inst.group[0].population[1].code.coding[0].code, "denominator") - self.assertEqual(inst.group[0].population[1].criteria, "Denominator") - self.assertEqual(inst.group[0].population[2].code.coding[0].code, "numerator") - self.assertEqual(inst.group[0].population[2].criteria, "Numerator") - self.assertEqual(inst.id, "component-b-example") - self.assertEqual(inst.scoring.coding[0].code, "proportion") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Screening for Depression") - - def testMeasure4(self): + def testMeasure5(self): inst = self.instantiate_from("measure-composite-example.json") self.assertIsNotNone(inst, "Must have instantiated a Measure instance") - self.implMeasure4(inst) + self.implMeasure5(inst) js = inst.as_json() self.assertEqual("Measure", js["resourceType"]) inst2 = measure.Measure(js) - self.implMeasure4(inst2) + self.implMeasure5(inst2) - def implMeasure4(self, inst): + def implMeasure5(self, inst): self.assertEqual(inst.compositeScoring.coding[0].code, "opportunity") self.assertEqual(inst.id, "composite-example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.relatedArtifact[0].resource, "Measure/component-a-example") self.assertEqual(inst.relatedArtifact[0].type, "composed-of") + self.assertEqual(inst.relatedArtifact[1].resource, "Measure/component-b-example") self.assertEqual(inst.relatedArtifact[1].type, "composed-of") self.assertEqual(inst.scoring.coding[0].code, "proportion") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.title, "Behavioral Assessment Composite Measure") - - def testMeasure5(self): - inst = self.instantiate_from("measure-predecessor-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Measure instance") - self.implMeasure5(inst) - - js = inst.as_json() - self.assertEqual("Measure", js["resourceType"]) - inst2 = measure.Measure(js) - self.implMeasure5(inst2) - - def implMeasure5(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2014-03-08").date) - self.assertEqual(inst.date.as_json(), "2014-03-08") - self.assertEqual(inst.description, "Exclusive breastfeeding measure of outcomes for exclusive breastmilk feeding of newborns.") - self.assertEqual(inst.group[0].identifier.value, "Population Group 1") - self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") - self.assertEqual(inst.group[0].population[0].criteria, "InitialPopulation1") - self.assertEqual(inst.group[0].population[0].identifier.value, "initial-population-1-identifier") - self.assertEqual(inst.group[0].population[1].code.coding[0].code, "denominator") - self.assertEqual(inst.group[0].population[1].criteria, "Denominator1") - self.assertEqual(inst.group[0].population[1].identifier.value, "denominator-1-identifier") - self.assertEqual(inst.group[0].population[2].code.coding[0].code, "denominator-exclusions") - self.assertEqual(inst.group[0].population[2].criteria, "DenominatorExclusions1") - self.assertEqual(inst.group[0].population[2].identifier.value, "denominator-exclusions-1-identifier") - self.assertEqual(inst.group[0].population[3].code.coding[0].code, "numerator") - self.assertEqual(inst.group[0].population[3].criteria, "Numerator1") - self.assertEqual(inst.group[0].population[3].identifier.value, "numerator-1-identifier") - self.assertEqual(inst.group[1].identifier.value, "Population Group 2") - self.assertEqual(inst.group[1].population[0].code.coding[0].code, "initial-population") - self.assertEqual(inst.group[1].population[0].criteria, "InitialPopulation2") - self.assertEqual(inst.group[1].population[0].identifier.value, "initial-population-2-identifier") - self.assertEqual(inst.group[1].population[1].code.coding[0].code, "denominator") - self.assertEqual(inst.group[1].population[1].criteria, "Denominator2") - self.assertEqual(inst.group[1].population[1].identifier.value, "denominator-2-identifier") - self.assertEqual(inst.group[1].population[2].code.coding[0].code, "denominator-exclusion") - self.assertEqual(inst.group[1].population[2].criteria, "DenominatorExclusions2") - self.assertEqual(inst.group[1].population[2].identifier.value, "denominator-exclusions-2-identifier") - self.assertEqual(inst.group[1].population[3].code.coding[0].code, "numerator") - self.assertEqual(inst.group[1].population[3].criteria, "Numerator2") - self.assertEqual(inst.group[1].population[3].identifier.value, "numerator-2-identifier") - self.assertEqual(inst.id, "measure-predecessor-example") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "exclusive-breastfeeding-measure") - self.assertEqual(inst.improvementNotation, "Improvement noted as an increase in the rate") - self.assertEqual(inst.purpose, "Measure of newborns who were fed breast milk only since birth") - self.assertEqual(inst.relatedArtifact[0].citation, "American Academy of Pediatrics. (2005). Section on Breastfeeding. Policy Statement:Breastfeeding and the Use of Human Milk. Pediatrics.115:496-506.") - self.assertEqual(inst.relatedArtifact[0].type, "documentation") - self.assertEqual(inst.relatedArtifact[1].type, "documentation") - self.assertEqual(inst.relatedArtifact[2].type, "documentation") - self.assertEqual(inst.relatedArtifact[3].type, "documentation") - self.assertEqual(inst.relatedArtifact[4].type, "documentation") - self.assertEqual(inst.relatedArtifact[5].type, "documentation") - self.assertEqual(inst.relatedArtifact[6].citation, "Kramer, M.S. & Kakuma, R. (2002).Optimal duration of exclusive breastfeeding. [107 refs] Cochrane Database of Systematic Reviews. (1):CD003517.") - self.assertEqual(inst.relatedArtifact[6].type, "documentation") - self.assertEqual(inst.relatedArtifact[7].citation, "Petrova, A., Hegyi, T., & Mehta, R. (2007). Maternal race/ethnicity and one-month exclusive breastfeeding in association with the in-hospital feeding modality. Breastfeeding Medicine. 2(2):92-8.") - self.assertEqual(inst.relatedArtifact[7].type, "documentation") - self.assertEqual(inst.relatedArtifact[8].type, "documentation") - self.assertEqual(inst.relatedArtifact[9].type, "documentation") - self.assertEqual(inst.scoring.coding[0].code, "proportion") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Exclusive Breastfeeding Measure") - self.assertEqual(inst.topic[0].text, "Exclusive Breastfeeding") - self.assertEqual(inst.type[0].coding[0].code, "process") - self.assertEqual(inst.version, "3.0.0") diff --git a/fhirclient/models/measurereport.py b/fhirclient/models/measurereport.py index d5da091d1..b401e3ed8 100644 --- a/fhirclient/models/measurereport.py +++ b/fhirclient/models/measurereport.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MeasureReport) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MeasureReport) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,7 +10,9 @@ class MeasureReport(domainresource.DomainResource): """ Results of a measure evaluation. - The MeasureReport resource contains the results of evaluating a measure. + The MeasureReport resource contains the results of the calculation of a + measure; and optionally a reference to the resources involved in that + calculation. """ resource_type = "MeasureReport" @@ -27,40 +29,44 @@ def __init__(self, jsondict=None, strict=True): """ When the report was generated. Type `FHIRDate` (represented as `str` in JSON). """ - self.evaluatedResources = None - """ What data was evaluated to produce the measure score. - Type `FHIRReference` referencing `Bundle` (represented as `dict` in JSON). """ + self.evaluatedResource = None + """ What data was used to calculate the measure score. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.group = None """ Measure results for each group. List of `MeasureReportGroup` items (represented as `dict` in JSON). """ self.identifier = None - """ Additional identifier for the Report. - Type `Identifier` (represented as `dict` in JSON). """ + """ Additional identifier for the MeasureReport. + List of `Identifier` items (represented as `dict` in JSON). """ - self.measure = None - """ What measure was evaluated. - Type `FHIRReference` referencing `Measure` (represented as `dict` in JSON). """ + self.improvementNotation = None + """ increase | decrease. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.patient = None - """ What patient the report is for. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + self.measure = None + """ What measure was calculated. + Type `str`. """ self.period = None """ What period the report covers. Type `Period` (represented as `dict` in JSON). """ - self.reportingOrganization = None + self.reporter = None """ Who is reporting the data. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ complete | pending | error. Type `str`. """ + self.subject = None + """ What individual(s) the report is for. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.type = None - """ individual | patient-list | summary. + """ individual | subject-list | summary | data-collection. Type `str`. """ super(MeasureReport, self).__init__(jsondict=jsondict, strict=strict) @@ -69,14 +75,15 @@ def elementProperties(self): js = super(MeasureReport, self).elementProperties() js.extend([ ("date", "date", fhirdate.FHIRDate, False, None, False), - ("evaluatedResources", "evaluatedResources", fhirreference.FHIRReference, False, None, False), + ("evaluatedResource", "evaluatedResource", fhirreference.FHIRReference, True, None, False), ("group", "group", MeasureReportGroup, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("measure", "measure", fhirreference.FHIRReference, False, None, True), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("improvementNotation", "improvementNotation", codeableconcept.CodeableConcept, False, None, False), + ("measure", "measure", str, False, None, True), ("period", "period", period.Period, False, None, True), - ("reportingOrganization", "reportingOrganization", fhirreference.FHIRReference, False, None, False), + ("reporter", "reporter", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), ("type", "type", str, False, None, True), ]) return js @@ -101,13 +108,13 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.identifier = None - """ What group of the measure. - Type `Identifier` (represented as `dict` in JSON). """ + self.code = None + """ Meaning of the group. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.measureScore = None """ What score this group achieved. - Type `float`. """ + Type `Quantity` (represented as `dict` in JSON). """ self.population = None """ The populations in the group. @@ -122,8 +129,8 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MeasureReportGroup, self).elementProperties() js.extend([ - ("identifier", "identifier", identifier.Identifier, False, None, True), - ("measureScore", "measureScore", float, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("measureScore", "measureScore", quantity.Quantity, False, None, False), ("population", "population", MeasureReportGroupPopulation, True, None, False), ("stratifier", "stratifier", MeasureReportGroupStratifier, True, None, False), ]) @@ -150,20 +157,16 @@ def __init__(self, jsondict=None, strict=True): self.code = None """ initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure- - population | measure-population-exclusion | measure-score. + population | measure-population-exclusion | measure-observation. Type `CodeableConcept` (represented as `dict` in JSON). """ self.count = None """ Size of the population. Type `int`. """ - self.identifier = None - """ Population identifier as defined in the measure. - Type `Identifier` (represented as `dict` in JSON). """ - - self.patients = None - """ For patient-list reports, the patients in this population. - Type `FHIRReference` referencing `List` (represented as `dict` in JSON). """ + self.subjectResults = None + """ For subject-list reports, the subject results in this population. + Type `FHIRReference` (represented as `dict` in JSON). """ super(MeasureReportGroupPopulation, self).__init__(jsondict=jsondict, strict=strict) @@ -172,8 +175,7 @@ def elementProperties(self): js.extend([ ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("count", "count", int, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("patients", "patients", fhirreference.FHIRReference, False, None, False), + ("subjectResults", "subjectResults", fhirreference.FHIRReference, False, None, False), ]) return js @@ -195,12 +197,13 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.identifier = None + self.code = None """ What stratifier of the group. - Type `Identifier` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.stratum = None - """ Stratum results, one for each unique value in the stratifier. + """ Stratum results, one for each unique value, or set of values, in + the stratifier, or stratifier components. List of `MeasureReportGroupStratifierStratum` items (represented as `dict` in JSON). """ super(MeasureReportGroupStratifier, self).__init__(jsondict=jsondict, strict=strict) @@ -208,14 +211,15 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MeasureReportGroupStratifier, self).elementProperties() js.extend([ - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, True, None, False), ("stratum", "stratum", MeasureReportGroupStratifierStratum, True, None, False), ]) return js class MeasureReportGroupStratifierStratum(backboneelement.BackboneElement): - """ Stratum results, one for each unique value in the stratifier. + """ Stratum results, one for each unique value, or set of values, in the + stratifier, or stratifier components. This element contains the results for a single stratum within the stratifier. For example, when stratifying on administrative gender, there @@ -232,9 +236,13 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.component = None + """ Stratifier component values. + List of `MeasureReportGroupStratifierStratumComponent` items (represented as `dict` in JSON). """ + self.measureScore = None """ What score this stratum achieved. - Type `float`. """ + Type `Quantity` (represented as `dict` in JSON). """ self.population = None """ Population results in this stratum. @@ -242,16 +250,52 @@ def __init__(self, jsondict=None, strict=True): self.value = None """ The stratum value, e.g. male. - Type `str`. """ + Type `CodeableConcept` (represented as `dict` in JSON). """ super(MeasureReportGroupStratifierStratum, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(MeasureReportGroupStratifierStratum, self).elementProperties() js.extend([ - ("measureScore", "measureScore", float, False, None, False), + ("component", "component", MeasureReportGroupStratifierStratumComponent, True, None, False), + ("measureScore", "measureScore", quantity.Quantity, False, None, False), ("population", "population", MeasureReportGroupStratifierStratumPopulation, True, None, False), - ("value", "value", str, False, None, True), + ("value", "value", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class MeasureReportGroupStratifierStratumComponent(backboneelement.BackboneElement): + """ Stratifier component values. + + A stratifier component value. + """ + + resource_type = "MeasureReportGroupStratifierStratumComponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ What stratifier component of the group. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ The stratum component value, e.g. male. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MeasureReportGroupStratifierStratumComponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MeasureReportGroupStratifierStratumComponent, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("value", "value", codeableconcept.CodeableConcept, False, None, True), ]) return js @@ -276,20 +320,16 @@ def __init__(self, jsondict=None, strict=True): self.code = None """ initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure- - population | measure-population-exclusion | measure-score. + population | measure-population-exclusion | measure-observation. Type `CodeableConcept` (represented as `dict` in JSON). """ self.count = None """ Size of the population. Type `int`. """ - self.identifier = None - """ Population identifier as defined in the measure. - Type `Identifier` (represented as `dict` in JSON). """ - - self.patients = None - """ For patient-list reports, the patients in this population. - Type `FHIRReference` referencing `List` (represented as `dict` in JSON). """ + self.subjectResults = None + """ For subject-list reports, the subject results in this population. + Type `FHIRReference` (represented as `dict` in JSON). """ super(MeasureReportGroupStratifierStratumPopulation, self).__init__(jsondict=jsondict, strict=strict) @@ -298,8 +338,7 @@ def elementProperties(self): js.extend([ ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("count", "count", int, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), - ("patients", "patients", fhirreference.FHIRReference, False, None, False), + ("subjectResults", "subjectResults", fhirreference.FHIRReference, False, None, False), ]) return js @@ -325,3 +364,7 @@ def elementProperties(self): from . import period except ImportError: period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/measurereport_tests.py b/fhirclient/models/measurereport_tests.py index 47ecf7c8f..626a2abf8 100644 --- a/fhirclient/models/measurereport_tests.py +++ b/fhirclient/models/measurereport_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -33,7 +33,9 @@ def testMeasureReport1(self): def implMeasureReport1(self, inst): self.assertEqual(inst.contained[0].id, "reporter") - self.assertEqual(inst.group[0].identifier.value, "CMS146-group-1") + self.assertEqual(inst.date.date, FHIRDate("2014-04-01").date) + self.assertEqual(inst.date.as_json(), "2014-04-01") + self.assertEqual(inst.group[0].id, "CMS146-group-1") self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].population[0].count, 1) self.assertEqual(inst.group[0].population[1].code.coding[0].code, "numerator") @@ -42,7 +44,7 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].population[2].count, 1) self.assertEqual(inst.group[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[0].identifier.value, "stratifier-ages-up-to-9") + self.assertEqual(inst.group[0].stratifier[0].code[0].text, "stratifier-ages-up-to-9") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[0].count, 1) self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].code.coding[0].code, "numerator") @@ -51,7 +53,7 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].count, 1) self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[0].stratum[0].value, "true") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].value.text, "true") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].code.coding[0].code, "numerator") @@ -60,8 +62,8 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[0].stratum[1].value, "false") - self.assertEqual(inst.group[0].stratifier[1].identifier.value, "stratifier-ages-10-plus") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].value.text, "false") + self.assertEqual(inst.group[0].stratifier[1].code[0].text, "stratifier-ages-10-plus") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].code.coding[0].code, "numerator") @@ -70,7 +72,7 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[1].stratum[0].value, "true") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].value.text, "true") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[0].count, 1) self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].code.coding[0].code, "numerator") @@ -79,8 +81,8 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].count, 1) self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[1].stratum[1].value, "false") - self.assertEqual(inst.group[0].stratifier[2].identifier.value, "stratifier-gender") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].value.text, "false") + self.assertEqual(inst.group[0].stratifier[2].code[0].text, "stratifier-gender") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[0].count, 1) self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].code.coding[0].code, "numerator") @@ -89,7 +91,7 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].count, 1) self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[0].value, "male") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].value.text, "male") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].code.coding[0].code, "numerator") @@ -98,7 +100,7 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[1].value, "female") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].value.text, "female") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].code.coding[0].code, "numerator") @@ -107,7 +109,7 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[2].value, "other") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].value.text, "other") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].code.coding[0].code, "numerator") @@ -116,9 +118,13 @@ def implMeasureReport1(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[3].value, "unknown") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].value.text, "unknown") self.assertEqual(inst.id, "measurereport-cms146-cat1-example") - self.assertEqual(inst.identifier.value, "measurereport-cms146-cat1-example-2017-03-13") + self.assertEqual(inst.identifier[0].value, "measurereport-cms146-cat1-example-2017-03-13") + self.assertEqual(inst.measure, "Measure/CMS146") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2014-03-31").date) self.assertEqual(inst.period.end.as_json(), "2014-03-31") self.assertEqual(inst.period.start.date, FHIRDate("2014-01-01").date) @@ -139,7 +145,9 @@ def testMeasureReport2(self): def implMeasureReport2(self, inst): self.assertEqual(inst.contained[0].id, "reporter") - self.assertEqual(inst.group[0].identifier.value, "CMS146-group-1") + self.assertEqual(inst.date.date, FHIRDate("2014-04-01").date) + self.assertEqual(inst.date.as_json(), "2014-04-01") + self.assertEqual(inst.group[0].id, "CMS146-group-1") self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].population[0].count, 500) self.assertEqual(inst.group[0].population[1].code.coding[0].code, "numerator") @@ -148,7 +156,7 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].population[2].count, 500) self.assertEqual(inst.group[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].population[3].count, 100) - self.assertEqual(inst.group[0].stratifier[0].identifier.value, "stratifier-ages-up-to-9") + self.assertEqual(inst.group[0].stratifier[0].code[0].text, "stratifier-ages-up-to-9") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].code.coding[0].code, "numerator") @@ -157,7 +165,7 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[0].stratum[0].value, "true") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].value.text, "true") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].code.coding[0].code, "numerator") @@ -166,8 +174,8 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[0].stratum[1].value, "false") - self.assertEqual(inst.group[0].stratifier[1].identifier.value, "stratifier-ages-10-plus") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].value.text, "false") + self.assertEqual(inst.group[0].stratifier[1].code[0].text, "stratifier-ages-10-plus") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].code.coding[0].code, "numerator") @@ -176,7 +184,7 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[1].stratum[0].value, "true") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].value.text, "true") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].code.coding[0].code, "numerator") @@ -185,8 +193,8 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[1].stratum[1].value, "false") - self.assertEqual(inst.group[0].stratifier[2].identifier.value, "stratifier-gender") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].value.text, "false") + self.assertEqual(inst.group[0].stratifier[2].code[0].text, "stratifier-gender") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].code.coding[0].code, "numerator") @@ -195,7 +203,7 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[2].stratum[0].value, "male") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].value.text, "male") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].code.coding[0].code, "numerator") @@ -204,7 +212,7 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[2].stratum[1].value, "female") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].value.text, "female") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].code.coding[0].code, "numerator") @@ -213,7 +221,7 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[2].value, "other") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].value.text, "other") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].code.coding[0].code, "numerator") @@ -222,16 +230,20 @@ def implMeasureReport2(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[3].code.coding[0].code, "denominator-exclusions") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[3].value, "unknown") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].value.text, "unknown") self.assertEqual(inst.id, "measurereport-cms146-cat2-example") - self.assertEqual(inst.identifier.value, "measurereport-cms146-cat2-example-2017-03-13") + self.assertEqual(inst.identifier[0].value, "measurereport-cms146-cat2-example-2017-03-13") + self.assertEqual(inst.measure, "Measure/CMS146") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2014-03-31").date) self.assertEqual(inst.period.end.as_json(), "2014-03-31") self.assertEqual(inst.period.start.date, FHIRDate("2014-01-01").date) self.assertEqual(inst.period.start.as_json(), "2014-01-01") self.assertEqual(inst.status, "complete") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "patient-list") + self.assertEqual(inst.type, "subject-list") def testMeasureReport3(self): inst = self.instantiate_from("measurereport-cms146-cat3-example.json") @@ -245,7 +257,9 @@ def testMeasureReport3(self): def implMeasureReport3(self, inst): self.assertEqual(inst.contained[0].id, "reporter") - self.assertEqual(inst.group[0].identifier.value, "CMS146-group-1") + self.assertEqual(inst.date.date, FHIRDate("2014-04-01").date) + self.assertEqual(inst.date.as_json(), "2014-04-01") + self.assertEqual(inst.group[0].id, "CMS146-group-1") self.assertEqual(inst.group[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].population[0].count, 500) self.assertEqual(inst.group[0].population[1].code.coding[0].code, "numerator") @@ -254,7 +268,7 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].population[2].count, 500) self.assertEqual(inst.group[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].population[3].count, 100) - self.assertEqual(inst.group[0].stratifier[0].identifier.value, "stratifier-ages-up-to-9") + self.assertEqual(inst.group[0].stratifier[0].code[0].text, "stratifier-ages-up-to-9") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[1].code.coding[0].code, "numerator") @@ -263,7 +277,7 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[0].stratum[0].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[0].stratum[0].value, "true") + self.assertEqual(inst.group[0].stratifier[0].stratum[0].value.text, "true") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[1].code.coding[0].code, "numerator") @@ -272,8 +286,8 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[0].stratum[1].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[0].stratum[1].value, "false") - self.assertEqual(inst.group[0].stratifier[1].identifier.value, "stratifier-ages-10-plus") + self.assertEqual(inst.group[0].stratifier[0].stratum[1].value.text, "false") + self.assertEqual(inst.group[0].stratifier[1].code[0].text, "stratifier-ages-10-plus") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[1].code.coding[0].code, "numerator") @@ -282,7 +296,7 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[1].stratum[0].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[1].stratum[0].value, "true") + self.assertEqual(inst.group[0].stratifier[1].stratum[0].value.text, "true") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[1].code.coding[0].code, "numerator") @@ -291,8 +305,8 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[1].stratum[1].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[1].stratum[1].value, "false") - self.assertEqual(inst.group[0].stratifier[2].identifier.value, "stratifier-gender") + self.assertEqual(inst.group[0].stratifier[1].stratum[1].value.text, "false") + self.assertEqual(inst.group[0].stratifier[2].code[0].text, "stratifier-gender") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[1].code.coding[0].code, "numerator") @@ -301,7 +315,7 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[0].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[2].stratum[0].value, "male") + self.assertEqual(inst.group[0].stratifier[2].stratum[0].value.text, "male") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[0].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[1].code.coding[0].code, "numerator") @@ -310,7 +324,7 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[2].count, 250) self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[1].population[3].count, 50) - self.assertEqual(inst.group[0].stratifier[2].stratum[1].value, "female") + self.assertEqual(inst.group[0].stratifier[2].stratum[1].value.text, "female") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[1].code.coding[0].code, "numerator") @@ -319,7 +333,7 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[2].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[2].value, "other") + self.assertEqual(inst.group[0].stratifier[2].stratum[2].value.text, "other") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[0].code.coding[0].code, "initial-population") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[0].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[1].code.coding[0].code, "numerator") @@ -328,9 +342,13 @@ def implMeasureReport3(self, inst): self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[2].count, 0) self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[3].code.coding[0].code, "denominator-exclusion") self.assertEqual(inst.group[0].stratifier[2].stratum[3].population[3].count, 0) - self.assertEqual(inst.group[0].stratifier[2].stratum[3].value, "unknown") + self.assertEqual(inst.group[0].stratifier[2].stratum[3].value.text, "unknown") self.assertEqual(inst.id, "measurereport-cms146-cat3-example") - self.assertEqual(inst.identifier.value, "measurereport-cms146-cat3-example-2017-03-13") + self.assertEqual(inst.identifier[0].value, "measurereport-cms146-cat3-example-2017-03-13") + self.assertEqual(inst.measure, "Measure/CMS146") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.period.end.date, FHIRDate("2014-03-31").date) self.assertEqual(inst.period.end.as_json(), "2014-03-31") self.assertEqual(inst.period.start.date, FHIRDate("2014-01-01").date) diff --git a/fhirclient/models/media.py b/fhirclient/models/media.py index 84219138f..2be0cd63d 100644 --- a/fhirclient/models/media.py +++ b/fhirclient/models/media.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Media) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Media) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -24,27 +24,39 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Procedure that caused this media to be created. - List of `FHIRReference` items referencing `ProcedureRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.bodySite = None - """ Body part in media. + """ Observed body part. Type `CodeableConcept` (represented as `dict` in JSON). """ self.content = None """ Actual Media - reference or data. Type `Attachment` (represented as `dict` in JSON). """ - self.context = None - """ Encounter / Episode associated with media. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.createdDateTime = None + """ When Media was collected. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.createdPeriod = None + """ When Media was collected. + Type `Period` (represented as `dict` in JSON). """ self.device = None """ Observing Device. - Type `FHIRReference` referencing `Device, DeviceMetric` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.deviceName = None + """ Name of the device/manufacturer. + Type `str`. """ self.duration = None """ Length in seconds (audio / video). - Type `int`. """ + Type `float`. """ + + self.encounter = None + """ Encounter associated with media. + Type `FHIRReference` (represented as `dict` in JSON). """ self.frames = None """ Number of frames if > 1 (photo). @@ -58,37 +70,42 @@ def __init__(self, jsondict=None, strict=True): """ Identifier(s) for the image. List of `Identifier` items (represented as `dict` in JSON). """ + self.issued = None + """ Date/Time this version was made available. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.modality = None + """ The type of acquisition equipment/process. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.note = None """ Comments made about the media. List of `Annotation` items (represented as `dict` in JSON). """ - self.occurrenceDateTime = None - """ When Media was collected. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurrencePeriod = None - """ When Media was collected. - Type `Period` (represented as `dict` in JSON). """ - self.operator = None """ The person who generated the image. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.reasonCode = None """ Why was event performed?. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.status = None + """ preparation | in-progress | not-done | suspended | aborted | + completed | entered-in-error | unknown. + Type `str`. """ + self.subject = None """ Who/What this Media is a record of. - Type `FHIRReference` referencing `Patient, Practitioner, Group, Device, Specimen` (represented as `dict` in JSON). """ - - self.subtype = None - """ The type of acquisition equipment/process. - Type `CodeableConcept` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None - """ photo | video | audio. - Type `str`. """ + """ Classification of media as image, video, or audio. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.view = None """ Imaging view, e.g. Lateral or Antero-posterior. @@ -106,20 +123,24 @@ def elementProperties(self): ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), ("content", "content", attachment.Attachment, False, None, True), - ("context", "context", fhirreference.FHIRReference, False, None, False), + ("createdDateTime", "createdDateTime", fhirdate.FHIRDate, False, "created", False), + ("createdPeriod", "createdPeriod", period.Period, False, "created", False), ("device", "device", fhirreference.FHIRReference, False, None, False), - ("duration", "duration", int, False, None, False), + ("deviceName", "deviceName", str, False, None, False), + ("duration", "duration", float, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("frames", "frames", int, False, None, False), ("height", "height", int, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("issued", "issued", fhirdate.FHIRDate, False, None, False), + ("modality", "modality", codeableconcept.CodeableConcept, False, None, False), ("note", "note", annotation.Annotation, True, None, False), - ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), - ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), ("operator", "operator", fhirreference.FHIRReference, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("status", "status", str, False, None, True), ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("subtype", "subtype", codeableconcept.CodeableConcept, False, None, False), - ("type", "type", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), ("view", "view", codeableconcept.CodeableConcept, False, None, False), ("width", "width", int, False, None, False), ]) diff --git a/fhirclient/models/media_tests.py b/fhirclient/models/media_tests.py index e513d837f..c20d3d9d1 100644 --- a/fhirclient/models/media_tests.py +++ b/fhirclient/models/media_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return media.Media(js) def testMedia1(self): - inst = self.instantiate_from("media-example-dicom.json") + inst = self.instantiate_from("media-example.json") self.assertIsNotNone(inst, "Must have instantiated a Media instance") self.implMedia1(inst) @@ -32,53 +32,70 @@ def testMedia1(self): self.implMedia1(inst2) def implMedia1(self, inst): + self.assertEqual(inst.content.contentType, "image/gif") + self.assertEqual(inst.content.creation.date, FHIRDate("2009-09-03").date) + self.assertEqual(inst.content.creation.as_json(), "2009-09-03") + self.assertEqual(inst.content.id, "a1") + self.assertEqual(inst.createdDateTime.date, FHIRDate("2017-12-17").date) + self.assertEqual(inst.createdDateTime.as_json(), "2017-12-17") + self.assertEqual(inst.frames, 1) + self.assertEqual(inst.height, 145) + self.assertEqual(inst.id, "example") + self.assertEqual(inst.issued.date, FHIRDate("2017-12-17T14:56:18Z").date) + self.assertEqual(inst.issued.as_json(), "2017-12-17T14:56:18Z") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.modality.coding[0].code, "diagram") + self.assertEqual(inst.modality.coding[0].system, "http://terminology.hl7.org/CodeSystem/media-modality") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "image") + self.assertEqual(inst.type.coding[0].display, "Image") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/media-type") + self.assertEqual(inst.width, 126) + + def testMedia2(self): + inst = self.instantiate_from("media-example-dicom.json") + self.assertIsNotNone(inst, "Must have instantiated a Media instance") + self.implMedia2(inst) + + js = inst.as_json() + self.assertEqual("Media", js["resourceType"]) + inst2 = media.Media(js) + self.implMedia2(inst2) + + def implMedia2(self, inst): self.assertEqual(inst.content.contentType, "application/dicom") self.assertEqual(inst.extension[0].url, "http://nema.org/fhir/extensions#0002-0010") self.assertEqual(inst.extension[0].valueUri, "urn:oid:1.2.840.10008.1.2.1") self.assertEqual(inst.height, 480) - self.assertEqual(inst.id, "1.2.840.11361907579238403408700.3.0.14.19970327150033") - self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.id, "1.2.840.11361907579238403408700.3.1.04.19970327150033") + self.assertEqual(inst.identifier[0].system, "urn:dicom:uid") self.assertEqual(inst.identifier[0].type.text, "InstanceUID") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "urn:oid:1.2.840.11361907579238403408700.3.0.14.19970327150033") + self.assertEqual(inst.identifier[0].value, "urn:oid:1.2.840.11361907579238403408700.3.1.04.19970327150033") self.assertEqual(inst.identifier[1].system, "http://acme-imaging.com/accession/2012") self.assertEqual(inst.identifier[1].type.text, "accessionNo") self.assertEqual(inst.identifier[1].value, "1234567") - self.assertEqual(inst.identifier[2].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[2].system, "urn:dicom:uid") self.assertEqual(inst.identifier[2].type.text, "studyId") self.assertEqual(inst.identifier[2].value, "urn:oid:1.2.840.113619.2.21.848.34082.0.538976288.3") - self.assertEqual(inst.identifier[3].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[3].system, "urn:dicom:uid") self.assertEqual(inst.identifier[3].type.text, "seriesId") self.assertEqual(inst.identifier[3].value, "urn:oid:1.2.840.113619.2.21.3408.700.0.757923840.3.0") - self.assertEqual(inst.subtype.coding[0].code, "US") - self.assertEqual(inst.subtype.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.modality.coding[0].code, "US") + self.assertEqual(inst.modality.coding[0].system, "http://dicom.nema.org/resources/ontology/DCM") + self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "photo") self.assertEqual(inst.view.coding[0].code, "399067008") self.assertEqual(inst.view.coding[0].display, "Lateral projection") self.assertEqual(inst.view.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.width, 640) - def testMedia2(self): - inst = self.instantiate_from("media-example-sound.json") - self.assertIsNotNone(inst, "Must have instantiated a Media instance") - self.implMedia2(inst) - - js = inst.as_json() - self.assertEqual("Media", js["resourceType"]) - inst2 = media.Media(js) - self.implMedia2(inst2) - - def implMedia2(self, inst): - self.assertEqual(inst.content.contentType, "audio/mpeg") - self.assertEqual(inst.content.data, "dG9vIGJpZyB0b28gaW5jbHVkZSB0aGUgd2hvbGU=") - self.assertEqual(inst.content.id, "a1") - self.assertEqual(inst.duration, 65) - self.assertEqual(inst.id, "sound") - self.assertEqual(inst.text.div, "
Sound recording of speech example for Patient Henry Levin (MRN 12345):
\"diagram\"/
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "video") - def testMedia3(self): inst = self.instantiate_from("media-example-xray.json") self.assertIsNotNone(inst, "Must have instantiated a Media instance") @@ -92,26 +109,29 @@ def testMedia3(self): def implMedia3(self, inst): self.assertEqual(inst.bodySite.coding[0].code, "85151006") self.assertEqual(inst.bodySite.coding[0].display, "Structure of left hand (body structure)") - self.assertEqual(inst.bodySite.coding[0].system, "http://snomed.info.sct") + self.assertEqual(inst.bodySite.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.content.contentType, "image/jpeg") self.assertEqual(inst.content.creation.date, FHIRDate("2016-03-15").date) self.assertEqual(inst.content.creation.as_json(), "2016-03-15") self.assertEqual(inst.content.id, "a1") self.assertEqual(inst.content.url, "http://someimagingcenter.org/fhir/Binary/A12345") + self.assertEqual(inst.createdDateTime.date, FHIRDate("2016-03-15").date) + self.assertEqual(inst.createdDateTime.as_json(), "2016-03-15") self.assertEqual(inst.height, 432) self.assertEqual(inst.id, "xray") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2016-03-15").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2016-03-15") - self.assertEqual(inst.subtype.coding[0].code, "39714003") - self.assertEqual(inst.subtype.coding[0].display, "Skeletal X-ray of wrist and hand") - self.assertEqual(inst.subtype.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.modality.coding[0].code, "39714003") + self.assertEqual(inst.modality.coding[0].display, "Skeletal X-ray of wrist and hand") + self.assertEqual(inst.modality.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.div, "
Xray of left hand for Patient Henry Levin (MRN 12345) 2016-03-15
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "photo") self.assertEqual(inst.width, 640) def testMedia4(self): - inst = self.instantiate_from("media-example.json") + inst = self.instantiate_from("media-example-sound.json") self.assertIsNotNone(inst, "Must have instantiated a Media instance") self.implMedia4(inst) @@ -121,17 +141,15 @@ def testMedia4(self): self.implMedia4(inst2) def implMedia4(self, inst): - self.assertEqual(inst.content.contentType, "image/gif") - self.assertEqual(inst.content.creation.date, FHIRDate("2009-09-03").date) - self.assertEqual(inst.content.creation.as_json(), "2009-09-03") + self.assertEqual(inst.content.contentType, "audio/mpeg") + self.assertEqual(inst.content.data, "dG9vIGJpZyB0b28gaW5jbHVkZSB0aGUgd2hvbGU=") self.assertEqual(inst.content.id, "a1") - self.assertEqual(inst.frames, 1) - self.assertEqual(inst.height, 145) - self.assertEqual(inst.id, "example") - self.assertEqual(inst.subtype.coding[0].code, "diagram") - self.assertEqual(inst.subtype.coding[0].system, "http://hl7.org/fhir/media-subtype") - self.assertEqual(inst.text.div, "
Diagram for Patient Henry Levin (MRN 12345):
\"diagram\"/
") + self.assertEqual(inst.duration, 65) + self.assertEqual(inst.id, "sound") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Sound recording of speech example for Patient Henry Levin (MRN 12345):
\"diagram\"/
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "photo") - self.assertEqual(inst.width, 126) diff --git a/fhirclient/models/medication.py b/fhirclient/models/medication.py index b8a2d5868..f32dead97 100644 --- a/fhirclient/models/medication.py +++ b/fhirclient/models/medication.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Medication) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Medication) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -11,7 +11,8 @@ class Medication(domainresource.DomainResource): """ Definition of a Medication. This resource is primarily used for the identification and definition of a - medication. It covers the ingredients and the packaging for a medication. + medication for the purposes of prescribing, dispensing, and administering a + medication as well as for making statements about medication use. """ resource_type = "Medication" @@ -24,6 +25,14 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.amount = None + """ Amount of drug in package. + Type `Ratio` (represented as `dict` in JSON). """ + + self.batch = None + """ Details about packaged medications. + Type `MedicationBatch` (represented as `dict` in JSON). """ + self.code = None """ Codes that identify this medication. Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -32,29 +41,17 @@ def __init__(self, jsondict=None, strict=True): """ powder | tablets | capsule +. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.image = None - """ Picture of the medication. - List of `Attachment` items (represented as `dict` in JSON). """ + self.identifier = None + """ Business identifier for this medication. + List of `Identifier` items (represented as `dict` in JSON). """ self.ingredient = None """ Active or inactive ingredient. List of `MedicationIngredient` items (represented as `dict` in JSON). """ - self.isBrand = None - """ True if a brand. - Type `bool`. """ - - self.isOverTheCounter = None - """ True if medication does not require a prescription. - Type `bool`. """ - self.manufacturer = None """ Manufacturer of the item. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.package = None - """ Details about packaged medications. - Type `MedicationPackage` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | inactive | entered-in-error. @@ -65,14 +62,13 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(Medication, self).elementProperties() js.extend([ + ("amount", "amount", ratio.Ratio, False, None, False), + ("batch", "batch", MedicationBatch, False, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("form", "form", codeableconcept.CodeableConcept, False, None, False), - ("image", "image", attachment.Attachment, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("ingredient", "ingredient", MedicationIngredient, True, None, False), - ("isBrand", "isBrand", bool, False, None, False), - ("isOverTheCounter", "isOverTheCounter", bool, False, None, False), ("manufacturer", "manufacturer", fhirreference.FHIRReference, False, None, False), - ("package", "package", MedicationPackage, False, None, False), ("status", "status", str, False, None, False), ]) return js @@ -80,99 +76,13 @@ def elementProperties(self): from . import backboneelement -class MedicationIngredient(backboneelement.BackboneElement): - """ Active or inactive ingredient. - - Identifies a particular constituent of interest in the product. - """ - - resource_type = "MedicationIngredient" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.amount = None - """ Quantity of ingredient present. - Type `Ratio` (represented as `dict` in JSON). """ - - self.isActive = None - """ Active ingredient indicator. - Type `bool`. """ - - self.itemCodeableConcept = None - """ The product contained. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.itemReference = None - """ The product contained. - Type `FHIRReference` referencing `Substance, Medication` (represented as `dict` in JSON). """ - - super(MedicationIngredient, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationIngredient, self).elementProperties() - js.extend([ - ("amount", "amount", ratio.Ratio, False, None, False), - ("isActive", "isActive", bool, False, None, False), - ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", True), - ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", True), - ]) - return js - - -class MedicationPackage(backboneelement.BackboneElement): +class MedicationBatch(backboneelement.BackboneElement): """ Details about packaged medications. Information that only applies to packages (not products). """ - resource_type = "MedicationPackage" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.batch = None - """ Identifies a single production run. - List of `MedicationPackageBatch` items (represented as `dict` in JSON). """ - - self.container = None - """ E.g. box, vial, blister-pack. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.content = None - """ What is in the package. - List of `MedicationPackageContent` items (represented as `dict` in JSON). """ - - super(MedicationPackage, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(MedicationPackage, self).elementProperties() - js.extend([ - ("batch", "batch", MedicationPackageBatch, True, None, False), - ("container", "container", codeableconcept.CodeableConcept, False, None, False), - ("content", "content", MedicationPackageContent, True, None, False), - ]) - return js - - -class MedicationPackageBatch(backboneelement.BackboneElement): - """ Identifies a single production run. - - Information about a group of medication produced or packaged from one - production run. - """ - - resource_type = "MedicationPackageBatch" + resource_type = "MedicationBatch" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -190,10 +100,10 @@ def __init__(self, jsondict=None, strict=True): """ Identifier assigned to batch. Type `str`. """ - super(MedicationPackageBatch, self).__init__(jsondict=jsondict, strict=strict) + super(MedicationBatch, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(MedicationPackageBatch, self).elementProperties() + js = super(MedicationBatch, self).elementProperties() js.extend([ ("expirationDate", "expirationDate", fhirdate.FHIRDate, False, None, False), ("lotNumber", "lotNumber", str, False, None, False), @@ -201,13 +111,13 @@ def elementProperties(self): return js -class MedicationPackageContent(backboneelement.BackboneElement): - """ What is in the package. +class MedicationIngredient(backboneelement.BackboneElement): + """ Active or inactive ingredient. - A set of components that go to make up the described item. + Identifies a particular constituent of interest in the product. """ - resource_type = "MedicationPackageContent" + resource_type = "MedicationIngredient" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -217,35 +127,36 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.amount = None - """ Quantity present in the package. - Type `Quantity` (represented as `dict` in JSON). """ + self.isActive = None + """ Active ingredient indicator. + Type `bool`. """ self.itemCodeableConcept = None - """ The item in the package. + """ The actual ingredient or content. Type `CodeableConcept` (represented as `dict` in JSON). """ self.itemReference = None - """ The item in the package. - Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + """ The actual ingredient or content. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.strength = None + """ Quantity of ingredient present. + Type `Ratio` (represented as `dict` in JSON). """ - super(MedicationPackageContent, self).__init__(jsondict=jsondict, strict=strict) + super(MedicationIngredient, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(MedicationPackageContent, self).elementProperties() + js = super(MedicationIngredient, self).elementProperties() js.extend([ - ("amount", "amount", quantity.Quantity, False, None, False), + ("isActive", "isActive", bool, False, None, False), ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", True), ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", True), + ("strength", "strength", ratio.Ratio, False, None, False), ]) return js import sys -try: - from . import attachment -except ImportError: - attachment = sys.modules[__package__ + '.attachment'] try: from . import codeableconcept except ImportError: @@ -259,9 +170,9 @@ def elementProperties(self): except ImportError: fhirreference = sys.modules[__package__ + '.fhirreference'] try: - from . import quantity + from . import identifier except ImportError: - quantity = sys.modules[__package__ + '.quantity'] + identifier = sys.modules[__package__ + '.identifier'] try: from . import ratio except ImportError: diff --git a/fhirclient/models/medicationadministration.py b/fhirclient/models/medicationadministration.py index fbae438f5..8543c5611 100644 --- a/fhirclient/models/medicationadministration.py +++ b/fhirclient/models/medicationadministration.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -33,15 +33,11 @@ def __init__(self, jsondict=None, strict=True): self.context = None """ Encounter or Episode of Care administered as part of. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - - self.definition = None - """ Instantiates protocol or definition. - List of `FHIRReference` items referencing `PlanDefinition, ActivityDefinition` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.device = None """ Device used to administer. - List of `FHIRReference` items referencing `Device` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.dosage = None """ Details of how medication was taken. @@ -57,23 +53,23 @@ def __init__(self, jsondict=None, strict=True): self.eventHistory = None """ A list of events of interest in the lifecycle. - List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None """ External identifier. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiates = None + """ Instantiates protocol or definition. + List of `str` items. """ + self.medicationCodeableConcept = None """ What was administered. Type `CodeableConcept` (represented as `dict` in JSON). """ self.medicationReference = None """ What was administered. - Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ - - self.notGiven = None - """ True if medication not administered. - Type `bool`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.note = None """ Information about the administration. @@ -81,41 +77,41 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Part of referenced event. - List of `FHIRReference` items referencing `MedicationAdministration, Procedure` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.performer = None - """ Who administered substance. + """ Who performed the medication administration and what they did. List of `MedicationAdministrationPerformer` items (represented as `dict` in JSON). """ - self.prescription = None - """ Request administration performed against. - Type `FHIRReference` referencing `MedicationRequest` (represented as `dict` in JSON). """ - self.reasonCode = None """ Reason administration performed. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.reasonNotGiven = None - """ Reason administration not performed. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.reasonReference = None - """ Condition or Observation that supports why the medication was + """ Condition or observation that supports why the medication was administered. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.request = None + """ Request administration performed against. + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None - """ in-progress | on-hold | completed | entered-in-error | stopped | - unknown. + """ in-progress | not-done | on-hold | completed | entered-in-error | + stopped | unknown. Type `str`. """ + self.statusReason = None + """ Reason administration not performed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.subject = None """ Who received medication. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.supportingInformation = None """ Additional information to support administration. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(MedicationAdministration, self).__init__(jsondict=jsondict, strict=strict) @@ -124,24 +120,23 @@ def elementProperties(self): js.extend([ ("category", "category", codeableconcept.CodeableConcept, False, None, False), ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), ("device", "device", fhirreference.FHIRReference, True, None, False), ("dosage", "dosage", MedicationAdministrationDosage, False, None, False), ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", True), ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", True), ("eventHistory", "eventHistory", fhirreference.FHIRReference, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiates", "instantiates", str, True, None, False), ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), - ("notGiven", "notGiven", bool, False, None, False), ("note", "note", annotation.Annotation, True, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("performer", "performer", MedicationAdministrationPerformer, True, None, False), - ("prescription", "prescription", fhirreference.FHIRReference, False, None, False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), - ("reasonNotGiven", "reasonNotGiven", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("request", "request", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, True, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), ]) @@ -212,10 +207,10 @@ def elementProperties(self): class MedicationAdministrationPerformer(backboneelement.BackboneElement): - """ Who administered substance. + """ Who performed the medication administration and what they did. - The individual who was responsible for giving the medication to the - patient. + Indicates who or what performed the medication administration and how they + were involved. """ resource_type = "MedicationAdministrationPerformer" @@ -229,12 +224,12 @@ def __init__(self, jsondict=None, strict=True): """ self.actor = None - """ Individual who was performing. - Type `FHIRReference` referencing `Practitioner, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ + """ Who performed the medication administration. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.onBehalfOf = None - """ Organization organization was acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + self.function = None + """ Type of performance. + Type `CodeableConcept` (represented as `dict` in JSON). """ super(MedicationAdministrationPerformer, self).__init__(jsondict=jsondict, strict=strict) @@ -242,7 +237,7 @@ def elementProperties(self): js = super(MedicationAdministrationPerformer, self).elementProperties() js.extend([ ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), ]) return js diff --git a/fhirclient/models/medicationdispense.py b/fhirclient/models/medicationdispense.py index 15e39d3ad..b9b43753a 100644 --- a/fhirclient/models/medicationdispense.py +++ b/fhirclient/models/medicationdispense.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -29,7 +29,7 @@ def __init__(self, jsondict=None, strict=True): self.authorizingPrescription = None """ Medication order that authorizes the dispense. - List of `FHIRReference` items referencing `MedicationRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ Type of medication dispense. @@ -37,7 +37,7 @@ def __init__(self, jsondict=None, strict=True): self.context = None """ Encounter / Episode associated with event. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.daysSupply = None """ Amount of medication expressed as a timing amount. @@ -45,11 +45,11 @@ def __init__(self, jsondict=None, strict=True): self.destination = None """ Where the medication was sent. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.detectedIssue = None """ Clinical issue with action. - List of `FHIRReference` items referencing `DetectedIssue` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.dosageInstruction = None """ How the medication is to be used by the patient or administered by @@ -57,32 +57,24 @@ def __init__(self, jsondict=None, strict=True): List of `Dosage` items (represented as `dict` in JSON). """ self.eventHistory = None - """ A list of releveant lifecycle events. - List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + """ A list of relevant lifecycle events. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None """ External identifier. List of `Identifier` items (represented as `dict` in JSON). """ + self.location = None + """ Where the dispense occurred. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.medicationCodeableConcept = None """ What medication was supplied. Type `CodeableConcept` (represented as `dict` in JSON). """ self.medicationReference = None """ What medication was supplied. - Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ - - self.notDone = None - """ Whether the dispense was or was not performed. - Type `bool`. """ - - self.notDoneReasonCodeableConcept = None - """ Why a dispense was not performed. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.notDoneReasonReference = None - """ Why a dispense was not performed. - Type `FHIRReference` referencing `DetectedIssue` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.note = None """ Information about the dispense. @@ -90,7 +82,7 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Event that dispense is part of. - List of `FHIRReference` items referencing `Procedure` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.performer = None """ Who performed event. @@ -102,16 +94,24 @@ def __init__(self, jsondict=None, strict=True): self.receiver = None """ Who collected the medication. - List of `FHIRReference` items referencing `Patient, Practitioner` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None - """ preparation | in-progress | on-hold | completed | entered-in-error - | stopped. + """ preparation | in-progress | cancelled | on-hold | completed | + entered-in-error | stopped | unknown. Type `str`. """ + self.statusReasonCodeableConcept = None + """ Why a dispense was not performed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.statusReasonReference = None + """ Why a dispense was not performed. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.subject = None """ Who the dispense is for. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.substitution = None """ Whether a substitution was performed on the dispense. @@ -119,7 +119,7 @@ def __init__(self, jsondict=None, strict=True): self.supportingInformation = None """ Information that supports the dispensing of the medication. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.type = None """ Trial fill, partial fill, emergency fill, etc.. @@ -147,17 +147,17 @@ def elementProperties(self): ("dosageInstruction", "dosageInstruction", dosage.Dosage, True, None, False), ("eventHistory", "eventHistory", fhirreference.FHIRReference, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), - ("notDone", "notDone", bool, False, None, False), - ("notDoneReasonCodeableConcept", "notDoneReasonCodeableConcept", codeableconcept.CodeableConcept, False, "notDoneReason", False), - ("notDoneReasonReference", "notDoneReasonReference", fhirreference.FHIRReference, False, "notDoneReason", False), ("note", "note", annotation.Annotation, True, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("performer", "performer", MedicationDispensePerformer, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("receiver", "receiver", fhirreference.FHIRReference, True, None, False), - ("status", "status", str, False, None, False), + ("status", "status", str, False, None, True), + ("statusReasonCodeableConcept", "statusReasonCodeableConcept", codeableconcept.CodeableConcept, False, "statusReason", False), + ("statusReasonReference", "statusReasonReference", fhirreference.FHIRReference, False, "statusReason", False), ("subject", "subject", fhirreference.FHIRReference, False, None, False), ("substitution", "substitution", MedicationDispenseSubstitution, False, None, False), ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), @@ -173,8 +173,7 @@ def elementProperties(self): class MedicationDispensePerformer(backboneelement.BackboneElement): """ Who performed event. - Indicates who or what performed the event. It should be assumed that the - performer is the dispenser of the medication. + Indicates who or what performed the event. """ resource_type = "MedicationDispensePerformer" @@ -189,11 +188,11 @@ def __init__(self, jsondict=None, strict=True): self.actor = None """ Individual who was performing. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.onBehalfOf = None - """ Organization organization was acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + self.function = None + """ Who performed the dispense and what they did. + Type `CodeableConcept` (represented as `dict` in JSON). """ super(MedicationDispensePerformer, self).__init__(jsondict=jsondict, strict=strict) @@ -201,7 +200,7 @@ def elementProperties(self): js = super(MedicationDispensePerformer, self).elementProperties() js.extend([ ("actor", "actor", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -210,7 +209,7 @@ class MedicationDispenseSubstitution(backboneelement.BackboneElement): """ Whether a substitution was performed on the dispense. Indicates whether or not substitution was made as part of the dispense. In - some cases substitution will be expected but does not happen, in other + some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen. This block explains what substitution did or did not happen and why. If nothing is specified, substitution was not done. @@ -232,7 +231,7 @@ def __init__(self, jsondict=None, strict=True): self.responsibleParty = None """ Who is responsible for the substitution. - List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.type = None """ Code signifying whether a different drug was dispensed from what diff --git a/fhirclient/models/medicationknowledge.py b/fhirclient/models/medicationknowledge.py new file mode 100644 index 000000000..9b6d37d24 --- /dev/null +++ b/fhirclient/models/medicationknowledge.py @@ -0,0 +1,794 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationKnowledge) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicationKnowledge(domainresource.DomainResource): + """ Definition of Medication Knowledge. + + Information about a medication that is used to support knowledge. + """ + + resource_type = "MedicationKnowledge" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.administrationGuidelines = None + """ Guidelines for administration of the medication. + List of `MedicationKnowledgeAdministrationGuidelines` items (represented as `dict` in JSON). """ + + self.amount = None + """ Amount of drug in package. + Type `Quantity` (represented as `dict` in JSON). """ + + self.associatedMedication = None + """ A medication resource that is associated with this medication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.code = None + """ Code that identifies this medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.contraindication = None + """ Potential clinical issue with or between medication(s). + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.cost = None + """ The pricing of the medication. + List of `MedicationKnowledgeCost` items (represented as `dict` in JSON). """ + + self.doseForm = None + """ powder | tablets | capsule +. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.drugCharacteristic = None + """ Specifies descriptive properties of the medicine. + List of `MedicationKnowledgeDrugCharacteristic` items (represented as `dict` in JSON). """ + + self.ingredient = None + """ Active or inactive ingredient. + List of `MedicationKnowledgeIngredient` items (represented as `dict` in JSON). """ + + self.intendedRoute = None + """ The intended or approved route of administration. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kinetics = None + """ The time course of drug absorption, distribution, metabolism and + excretion of a medication from the body. + List of `MedicationKnowledgeKinetics` items (represented as `dict` in JSON). """ + + self.manufacturer = None + """ Manufacturer of the item. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.medicineClassification = None + """ Categorization of the medication within a formulary or + classification system. + List of `MedicationKnowledgeMedicineClassification` items (represented as `dict` in JSON). """ + + self.monitoringProgram = None + """ Program under which a medication is reviewed. + List of `MedicationKnowledgeMonitoringProgram` items (represented as `dict` in JSON). """ + + self.monograph = None + """ Associated documentation about the medication. + List of `MedicationKnowledgeMonograph` items (represented as `dict` in JSON). """ + + self.packaging = None + """ Details about packaged medications. + Type `MedicationKnowledgePackaging` (represented as `dict` in JSON). """ + + self.preparationInstruction = None + """ The instructions for preparing the medication. + Type `str`. """ + + self.productType = None + """ Category of the medication or product. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.regulatory = None + """ Regulatory information about a medication. + List of `MedicationKnowledgeRegulatory` items (represented as `dict` in JSON). """ + + self.relatedMedicationKnowledge = None + """ Associated or related medication information. + List of `MedicationKnowledgeRelatedMedicationKnowledge` items (represented as `dict` in JSON). """ + + self.status = None + """ active | inactive | entered-in-error. + Type `str`. """ + + self.synonym = None + """ Additional names for a medication. + List of `str` items. """ + + super(MedicationKnowledge, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledge, self).elementProperties() + js.extend([ + ("administrationGuidelines", "administrationGuidelines", MedicationKnowledgeAdministrationGuidelines, True, None, False), + ("amount", "amount", quantity.Quantity, False, None, False), + ("associatedMedication", "associatedMedication", fhirreference.FHIRReference, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("contraindication", "contraindication", fhirreference.FHIRReference, True, None, False), + ("cost", "cost", MedicationKnowledgeCost, True, None, False), + ("doseForm", "doseForm", codeableconcept.CodeableConcept, False, None, False), + ("drugCharacteristic", "drugCharacteristic", MedicationKnowledgeDrugCharacteristic, True, None, False), + ("ingredient", "ingredient", MedicationKnowledgeIngredient, True, None, False), + ("intendedRoute", "intendedRoute", codeableconcept.CodeableConcept, True, None, False), + ("kinetics", "kinetics", MedicationKnowledgeKinetics, True, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, False, None, False), + ("medicineClassification", "medicineClassification", MedicationKnowledgeMedicineClassification, True, None, False), + ("monitoringProgram", "monitoringProgram", MedicationKnowledgeMonitoringProgram, True, None, False), + ("monograph", "monograph", MedicationKnowledgeMonograph, True, None, False), + ("packaging", "packaging", MedicationKnowledgePackaging, False, None, False), + ("preparationInstruction", "preparationInstruction", str, False, None, False), + ("productType", "productType", codeableconcept.CodeableConcept, True, None, False), + ("regulatory", "regulatory", MedicationKnowledgeRegulatory, True, None, False), + ("relatedMedicationKnowledge", "relatedMedicationKnowledge", MedicationKnowledgeRelatedMedicationKnowledge, True, None, False), + ("status", "status", str, False, None, False), + ("synonym", "synonym", str, True, None, False), + ]) + return js + + +from . import backboneelement + +class MedicationKnowledgeAdministrationGuidelines(backboneelement.BackboneElement): + """ Guidelines for administration of the medication. + + Guidelines for the administration of the medication. + """ + + resource_type = "MedicationKnowledgeAdministrationGuidelines" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.dosage = None + """ Dosage for the medication for the specific guidelines. + List of `MedicationKnowledgeAdministrationGuidelinesDosage` items (represented as `dict` in JSON). """ + + self.indicationCodeableConcept = None + """ Indication for use that apply to the specific administration + guidelines. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.indicationReference = None + """ Indication for use that apply to the specific administration + guidelines. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.patientCharacteristics = None + """ Characteristics of the patient that are relevant to the + administration guidelines. + List of `MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics` items (represented as `dict` in JSON). """ + + super(MedicationKnowledgeAdministrationGuidelines, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeAdministrationGuidelines, self).elementProperties() + js.extend([ + ("dosage", "dosage", MedicationKnowledgeAdministrationGuidelinesDosage, True, None, False), + ("indicationCodeableConcept", "indicationCodeableConcept", codeableconcept.CodeableConcept, False, "indication", False), + ("indicationReference", "indicationReference", fhirreference.FHIRReference, False, "indication", False), + ("patientCharacteristics", "patientCharacteristics", MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics, True, None, False), + ]) + return js + + +class MedicationKnowledgeAdministrationGuidelinesDosage(backboneelement.BackboneElement): + """ Dosage for the medication for the specific guidelines. + """ + + resource_type = "MedicationKnowledgeAdministrationGuidelinesDosage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.dosage = None + """ Dosage for the medication for the specific guidelines. + List of `Dosage` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of dosage. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeAdministrationGuidelinesDosage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeAdministrationGuidelinesDosage, self).elementProperties() + js.extend([ + ("dosage", "dosage", dosage.Dosage, True, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics(backboneelement.BackboneElement): + """ Characteristics of the patient that are relevant to the administration + guidelines. + + Characteristics of the patient that are relevant to the administration + guidelines (for example, height, weight, gender, etc.). + """ + + resource_type = "MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.characteristicCodeableConcept = None + """ Specific characteristic that is relevant to the administration + guideline. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.characteristicQuantity = None + """ Specific characteristic that is relevant to the administration + guideline. + Type `Quantity` (represented as `dict` in JSON). """ + + self.value = None + """ The specific characteristic. + List of `str` items. """ + + super(MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeAdministrationGuidelinesPatientCharacteristics, self).elementProperties() + js.extend([ + ("characteristicCodeableConcept", "characteristicCodeableConcept", codeableconcept.CodeableConcept, False, "characteristic", True), + ("characteristicQuantity", "characteristicQuantity", quantity.Quantity, False, "characteristic", True), + ("value", "value", str, True, None, False), + ]) + return js + + +class MedicationKnowledgeCost(backboneelement.BackboneElement): + """ The pricing of the medication. + + The price of the medication. + """ + + resource_type = "MedicationKnowledgeCost" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.cost = None + """ The price of the medication. + Type `Money` (represented as `dict` in JSON). """ + + self.source = None + """ The source or owner for the price information. + Type `str`. """ + + self.type = None + """ The category of the cost information. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeCost, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeCost, self).elementProperties() + js.extend([ + ("cost", "cost", money.Money, False, None, True), + ("source", "source", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class MedicationKnowledgeDrugCharacteristic(backboneelement.BackboneElement): + """ Specifies descriptive properties of the medicine. + + Specifies descriptive properties of the medicine, such as color, shape, + imprints, etc. + """ + + resource_type = "MedicationKnowledgeDrugCharacteristic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.type = None + """ Code specifying the type of characteristic of medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueBase64Binary = None + """ Description of the characteristic. + Type `str`. """ + + self.valueCodeableConcept = None + """ Description of the characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.valueQuantity = None + """ Description of the characteristic. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueString = None + """ Description of the characteristic. + Type `str`. """ + + super(MedicationKnowledgeDrugCharacteristic, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeDrugCharacteristic, self).elementProperties() + js.extend([ + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("valueBase64Binary", "valueBase64Binary", str, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueString", "valueString", str, False, "value", False), + ]) + return js + + +class MedicationKnowledgeIngredient(backboneelement.BackboneElement): + """ Active or inactive ingredient. + + Identifies a particular constituent of interest in the product. + """ + + resource_type = "MedicationKnowledgeIngredient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.isActive = None + """ Active ingredient indicator. + Type `bool`. """ + + self.itemCodeableConcept = None + """ Medication(s) or substance(s) contained in the medication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ Medication(s) or substance(s) contained in the medication. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.strength = None + """ Quantity of ingredient present. + Type `Ratio` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeIngredient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeIngredient, self).elementProperties() + js.extend([ + ("isActive", "isActive", bool, False, None, False), + ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", True), + ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", True), + ("strength", "strength", ratio.Ratio, False, None, False), + ]) + return js + + +class MedicationKnowledgeKinetics(backboneelement.BackboneElement): + """ The time course of drug absorption, distribution, metabolism and excretion + of a medication from the body. + """ + + resource_type = "MedicationKnowledgeKinetics" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.areaUnderCurve = None + """ The drug concentration measured at certain discrete points in time. + List of `Quantity` items (represented as `dict` in JSON). """ + + self.halfLifePeriod = None + """ Time required for concentration in the body to decrease by half. + Type `Duration` (represented as `dict` in JSON). """ + + self.lethalDose50 = None + """ The median lethal dose of a drug. + List of `Quantity` items (represented as `dict` in JSON). """ + + super(MedicationKnowledgeKinetics, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeKinetics, self).elementProperties() + js.extend([ + ("areaUnderCurve", "areaUnderCurve", quantity.Quantity, True, None, False), + ("halfLifePeriod", "halfLifePeriod", duration.Duration, False, None, False), + ("lethalDose50", "lethalDose50", quantity.Quantity, True, None, False), + ]) + return js + + +class MedicationKnowledgeMedicineClassification(backboneelement.BackboneElement): + """ Categorization of the medication within a formulary or classification + system. + """ + + resource_type = "MedicationKnowledgeMedicineClassification" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.classification = None + """ Specific category assigned to the medication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ The type of category for the medication (for example, therapeutic + classification, therapeutic sub-classification). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeMedicineClassification, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeMedicineClassification, self).elementProperties() + js.extend([ + ("classification", "classification", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class MedicationKnowledgeMonitoringProgram(backboneelement.BackboneElement): + """ Program under which a medication is reviewed. + + The program under which the medication is reviewed. + """ + + resource_type = "MedicationKnowledgeMonitoringProgram" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.name = None + """ Name of the reviewing program. + Type `str`. """ + + self.type = None + """ Type of program under which the medication is monitored. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeMonitoringProgram, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeMonitoringProgram, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class MedicationKnowledgeMonograph(backboneelement.BackboneElement): + """ Associated documentation about the medication. + """ + + resource_type = "MedicationKnowledgeMonograph" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.source = None + """ Associated documentation about the medication. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.type = None + """ The category of medication document. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeMonograph, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeMonograph, self).elementProperties() + js.extend([ + ("source", "source", fhirreference.FHIRReference, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class MedicationKnowledgePackaging(backboneelement.BackboneElement): + """ Details about packaged medications. + + Information that only applies to packages (not products). + """ + + resource_type = "MedicationKnowledgePackaging" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.quantity = None + """ The number of product units the package would contain if fully + loaded. + Type `Quantity` (represented as `dict` in JSON). """ + + self.type = None + """ A code that defines the specific type of packaging that the + medication can be found in. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgePackaging, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgePackaging, self).elementProperties() + js.extend([ + ("quantity", "quantity", quantity.Quantity, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class MedicationKnowledgeRegulatory(backboneelement.BackboneElement): + """ Regulatory information about a medication. + """ + + resource_type = "MedicationKnowledgeRegulatory" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.maxDispense = None + """ The maximum number of units of the medication that can be dispensed + in a period. + Type `MedicationKnowledgeRegulatoryMaxDispense` (represented as `dict` in JSON). """ + + self.regulatoryAuthority = None + """ Specifies the authority of the regulation. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.schedule = None + """ Specifies the schedule of a medication in jurisdiction. + List of `MedicationKnowledgeRegulatorySchedule` items (represented as `dict` in JSON). """ + + self.substitution = None + """ Specifies if changes are allowed when dispensing a medication from + a regulatory perspective. + List of `MedicationKnowledgeRegulatorySubstitution` items (represented as `dict` in JSON). """ + + super(MedicationKnowledgeRegulatory, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeRegulatory, self).elementProperties() + js.extend([ + ("maxDispense", "maxDispense", MedicationKnowledgeRegulatoryMaxDispense, False, None, False), + ("regulatoryAuthority", "regulatoryAuthority", fhirreference.FHIRReference, False, None, True), + ("schedule", "schedule", MedicationKnowledgeRegulatorySchedule, True, None, False), + ("substitution", "substitution", MedicationKnowledgeRegulatorySubstitution, True, None, False), + ]) + return js + + +class MedicationKnowledgeRegulatoryMaxDispense(backboneelement.BackboneElement): + """ The maximum number of units of the medication that can be dispensed in a + period. + """ + + resource_type = "MedicationKnowledgeRegulatoryMaxDispense" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.period = None + """ The period that applies to the maximum number of units. + Type `Duration` (represented as `dict` in JSON). """ + + self.quantity = None + """ The maximum number of units of the medication that can be dispensed. + Type `Quantity` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeRegulatoryMaxDispense, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeRegulatoryMaxDispense, self).elementProperties() + js.extend([ + ("period", "period", duration.Duration, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, True), + ]) + return js + + +class MedicationKnowledgeRegulatorySchedule(backboneelement.BackboneElement): + """ Specifies the schedule of a medication in jurisdiction. + """ + + resource_type = "MedicationKnowledgeRegulatorySchedule" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.schedule = None + """ Specifies the specific drug schedule. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeRegulatorySchedule, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeRegulatorySchedule, self).elementProperties() + js.extend([ + ("schedule", "schedule", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class MedicationKnowledgeRegulatorySubstitution(backboneelement.BackboneElement): + """ Specifies if changes are allowed when dispensing a medication from a + regulatory perspective. + """ + + resource_type = "MedicationKnowledgeRegulatorySubstitution" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allowed = None + """ Specifies if regulation allows for changes in the medication when + dispensing. + Type `bool`. """ + + self.type = None + """ Specifies the type of substitution allowed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeRegulatorySubstitution, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeRegulatorySubstitution, self).elementProperties() + js.extend([ + ("allowed", "allowed", bool, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class MedicationKnowledgeRelatedMedicationKnowledge(backboneelement.BackboneElement): + """ Associated or related medication information. + + Associated or related knowledge about a medication. + """ + + resource_type = "MedicationKnowledgeRelatedMedicationKnowledge" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.reference = None + """ Associated documentation about the associated medication knowledge. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ Category of medicationKnowledge. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicationKnowledgeRelatedMedicationKnowledge, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicationKnowledgeRelatedMedicationKnowledge, self).elementProperties() + js.extend([ + ("reference", "reference", fhirreference.FHIRReference, True, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import money +except ImportError: + money = sys.modules[__package__ + '.money'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/medicationknowledge_tests.py b/fhirclient/models/medicationknowledge_tests.py new file mode 100644 index 000000000..f591dc6d9 --- /dev/null +++ b/fhirclient/models/medicationknowledge_tests.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicationknowledge +from .fhirdate import FHIRDate + + +class MedicationKnowledgeTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicationKnowledge", js["resourceType"]) + return medicationknowledge.MedicationKnowledge(js) + + def testMedicationKnowledge1(self): + inst = self.instantiate_from("medicationknowledge-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicationKnowledge instance") + self.implMedicationKnowledge1(inst) + + js = inst.as_json() + self.assertEqual("MedicationKnowledge", js["resourceType"]) + inst2 = medicationknowledge.MedicationKnowledge(js) + self.implMedicationKnowledge1(inst2) + + def implMedicationKnowledge1(self, inst): + self.assertEqual(inst.amount.unit, "mg/ml") + self.assertEqual(inst.amount.value, 50) + self.assertEqual(inst.code.coding[0].code, "0069-2587-10") + self.assertEqual(inst.code.coding[0].display, "Vancomycin Hydrochloride (VANCOMYCIN HYDROCHLORIDE)") + self.assertEqual(inst.code.coding[0].system, "http://hl7.org/fhir/sid/ndc") + self.assertEqual(inst.contained[0].id, "org4") + self.assertEqual(inst.doseForm.coding[0].code, "385219001") + self.assertEqual(inst.doseForm.coding[0].display, "Injection Solution (qualifier value)") + self.assertEqual(inst.doseForm.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.synonym[0], "Vancomycin Hydrochloride (VANCOMYCIN HYDROCHLORIDE)") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/medicationrequest.py b/fhirclient/models/medicationrequest.py index 094a99b07..dd2889576 100644 --- a/fhirclient/models/medicationrequest.py +++ b/fhirclient/models/medicationrequest.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MedicationRequest) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationRequest) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -34,35 +34,39 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ What request fulfills. - List of `FHIRReference` items referencing `CarePlan, MedicationRequest, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ Type of medication usage. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.context = None - """ Created during encounter/admission/stay. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.definition = None - """ Protocol or definition. - List of `FHIRReference` items referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ + self.courseOfTherapyType = None + """ Overall pattern of medication administration. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.detectedIssue = None """ Clinical Issue with action. - List of `FHIRReference` items referencing `DetectedIssue` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.dispenseRequest = None """ Medication supply authorization. Type `MedicationRequestDispenseRequest` (represented as `dict` in JSON). """ + self.doNotPerform = None + """ True if request is prohibiting action. + Type `bool`. """ + self.dosageInstruction = None """ How the medication should be taken. List of `Dosage` items (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of encounter/admission/stay. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.eventHistory = None """ A list of events of interest in the lifecycle. - List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.groupIdentifier = None """ Composite request this is part of. @@ -72,8 +76,20 @@ def __init__(self, jsondict=None, strict=True): """ External ids for this request. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + + self.insurance = None + """ Associated insurance coverage. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.intent = None - """ proposal | plan | order | instance-order. + """ proposal | plan | order | original-order | instance-order | option. Type `str`. """ self.medicationCodeableConcept = None @@ -82,45 +98,65 @@ def __init__(self, jsondict=None, strict=True): self.medicationReference = None """ Medication to be taken. - Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.note = None """ Information about the prescription. List of `Annotation` items (represented as `dict` in JSON). """ + self.performer = None + """ Intended performer of administration. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.performerType = None + """ Desired kind of performer of the medication administration. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.priorPrescription = None """ An order/prescription that is being replaced. - Type `FHIRReference` referencing `MedicationRequest` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.priority = None - """ routine | urgent | stat | asap. + """ routine | urgent | asap | stat. Type `str`. """ self.reasonCode = None - """ Reason or indication for writing the prescription. + """ Reason or indication for ordering or not ordering the medication. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None - """ Condition or Observation that supports why the prescription is + """ Condition or observation that supports why the prescription is being written. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.recorder = None """ Person who entered the request. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.reportedBoolean = None + """ Reported rather than primary record. + Type `bool`. """ + + self.reportedReference = None + """ Reported rather than primary record. + Type `FHIRReference` (represented as `dict` in JSON). """ self.requester = None """ Who/What requested the Request. - Type `MedicationRequestRequester` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown. Type `str`. """ + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.subject = None """ Who or group medication request is for. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.substitution = None """ Any restrictions on medication substitution. @@ -128,7 +164,7 @@ def __init__(self, jsondict=None, strict=True): self.supportingInformation = None """ Information to support ordering of the medication. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(MedicationRequest, self).__init__(jsondict=jsondict, strict=strict) @@ -137,26 +173,35 @@ def elementProperties(self): js.extend([ ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("category", "category", codeableconcept.CodeableConcept, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("courseOfTherapyType", "courseOfTherapyType", codeableconcept.CodeableConcept, False, None, False), ("detectedIssue", "detectedIssue", fhirreference.FHIRReference, True, None, False), ("dispenseRequest", "dispenseRequest", MedicationRequestDispenseRequest, False, None, False), + ("doNotPerform", "doNotPerform", bool, False, None, False), ("dosageInstruction", "dosageInstruction", dosage.Dosage, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("eventHistory", "eventHistory", fhirreference.FHIRReference, True, None, False), ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), + ("insurance", "insurance", fhirreference.FHIRReference, True, None, False), ("intent", "intent", str, False, None, True), ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), ("note", "note", annotation.Annotation, True, None, False), + ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("performerType", "performerType", codeableconcept.CodeableConcept, False, None, False), ("priorPrescription", "priorPrescription", fhirreference.FHIRReference, False, None, False), ("priority", "priority", str, False, None, False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("recorder", "recorder", fhirreference.FHIRReference, False, None, False), - ("requester", "requester", MedicationRequestRequester, False, None, False), - ("status", "status", str, False, None, False), + ("reportedBoolean", "reportedBoolean", bool, False, "reported", False), + ("reportedReference", "reportedReference", fhirreference.FHIRReference, False, "reported", False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), ("substitution", "substitution", MedicationRequestSubstitution, False, None, False), ("supportingInformation", "supportingInformation", fhirreference.FHIRReference, True, None, False), @@ -187,17 +232,25 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.dispenseInterval = None + """ Minimum period of time between dispenses. + Type `Duration` (represented as `dict` in JSON). """ + self.expectedSupplyDuration = None """ Number of days supply per dispense. Type `Duration` (represented as `dict` in JSON). """ + self.initialFill = None + """ First fill details. + Type `MedicationRequestDispenseRequestInitialFill` (represented as `dict` in JSON). """ + self.numberOfRepeatsAllowed = None """ Number of refills authorized. Type `int`. """ self.performer = None """ Intended dispenser. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.quantity = None """ Amount of medication to supply per dispense. @@ -212,7 +265,9 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MedicationRequestDispenseRequest, self).elementProperties() js.extend([ + ("dispenseInterval", "dispenseInterval", duration.Duration, False, None, False), ("expectedSupplyDuration", "expectedSupplyDuration", duration.Duration, False, None, False), + ("initialFill", "initialFill", MedicationRequestDispenseRequestInitialFill, False, None, False), ("numberOfRepeatsAllowed", "numberOfRepeatsAllowed", int, False, None, False), ("performer", "performer", fhirreference.FHIRReference, False, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), @@ -221,14 +276,14 @@ def elementProperties(self): return js -class MedicationRequestRequester(backboneelement.BackboneElement): - """ Who/What requested the Request. +class MedicationRequestDispenseRequestInitialFill(backboneelement.BackboneElement): + """ First fill details. - The individual, organization or device that initiated the request and has - responsibility for its activation. + Indicates the quantity or duration for the first dispense of the + medication. """ - resource_type = "MedicationRequestRequester" + resource_type = "MedicationRequestDispenseRequestInitialFill" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -238,21 +293,21 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.agent = None - """ Who ordered the initial medication(s). - Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ + self.duration = None + """ First fill duration. + Type `Duration` (represented as `dict` in JSON). """ - self.onBehalfOf = None - """ Organization agent is acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + self.quantity = None + """ First fill quantity. + Type `Quantity` (represented as `dict` in JSON). """ - super(MedicationRequestRequester, self).__init__(jsondict=jsondict, strict=strict) + super(MedicationRequestDispenseRequestInitialFill, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(MedicationRequestRequester, self).elementProperties() + js = super(MedicationRequestDispenseRequestInitialFill, self).elementProperties() js.extend([ - ("agent", "agent", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("duration", "duration", duration.Duration, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, False), ]) return js @@ -261,7 +316,7 @@ class MedicationRequestSubstitution(backboneelement.BackboneElement): """ Any restrictions on medication substitution. Indicates whether or not substitution can or should be part of the - dispense. In some cases substitution must happen, in other cases + dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done. """ @@ -276,10 +331,14 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.allowed = None + self.allowedBoolean = None """ Whether substitution is allowed or not. Type `bool`. """ + self.allowedCodeableConcept = None + """ Whether substitution is allowed or not. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.reason = None """ Why should (not) substitution be made. Type `CodeableConcept` (represented as `dict` in JSON). """ @@ -289,7 +348,8 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MedicationRequestSubstitution, self).elementProperties() js.extend([ - ("allowed", "allowed", bool, False, None, True), + ("allowedBoolean", "allowedBoolean", bool, False, "allowed", True), + ("allowedCodeableConcept", "allowedCodeableConcept", codeableconcept.CodeableConcept, False, "allowed", True), ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), ]) return js diff --git a/fhirclient/models/medicationstatement.py b/fhirclient/models/medicationstatement.py index 5a199b780..91ff6aead 100644 --- a/fhirclient/models/medicationstatement.py +++ b/fhirclient/models/medicationstatement.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -12,14 +12,14 @@ class MedicationStatement(domainresource.DomainResource): A record of a medication that is being consumed by a patient. A MedicationStatement may indicate that the patient may be taking the - medication now, or has taken the medication in the past or will be taking + medication now or has taken the medication in the past or will be taking the medication in the future. The source of this information can be the patient, significant other (such as a family member or spouse), or a clinician. A common scenario where this information is captured is during the history taking process during a patient visit or stay. The medication information may come from sources such as the patient's memory, from a prescription bottle, or from a list of medications the patient, clinician - or other party maintains + or other party maintains. The primary difference between a medication statement and a medication administration is that the medication administration has complete @@ -48,7 +48,7 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Fulfils plan, proposal or order. - List of `FHIRReference` items referencing `MedicationRequest, CarePlan, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.category = None """ Type of medication usage. @@ -56,7 +56,7 @@ def __init__(self, jsondict=None, strict=True): self.context = None """ Encounter / Episode associated with MedicationStatement. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.dateAsserted = None """ When the statement was asserted?. @@ -64,18 +64,18 @@ def __init__(self, jsondict=None, strict=True): self.derivedFrom = None """ Additional supporting information. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.dosage = None """ Details of how medication is/was taken or should be taken. List of `Dosage` items (represented as `dict` in JSON). """ self.effectiveDateTime = None - """ The date/time or interval when the medication was taken. + """ The date/time or interval when the medication is/was/will be taken. Type `FHIRDate` (represented as `str` in JSON). """ self.effectivePeriod = None - """ The date/time or interval when the medication was taken. + """ The date/time or interval when the medication is/was/will be taken. Type `Period` (represented as `dict` in JSON). """ self.identifier = None @@ -85,7 +85,7 @@ def __init__(self, jsondict=None, strict=True): self.informationSource = None """ Person or organization that provided the information about the taking of this medication. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.medicationCodeableConcept = None """ What medication was taken. @@ -93,7 +93,7 @@ def __init__(self, jsondict=None, strict=True): self.medicationReference = None """ What medication was taken. - Type `FHIRReference` referencing `Medication` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.note = None """ Further information about the statement. @@ -101,33 +101,29 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Part of referenced event. - List of `FHIRReference` items referencing `MedicationAdministration, MedicationDispense, MedicationStatement, Procedure, Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.reasonCode = None """ Reason for why the medication is being/was taken. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.reasonNotTaken = None - """ True if asserting medication was not given. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.reasonReference = None """ Condition or observation that supports why the medication is being/was taken. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ active | completed | entered-in-error | intended | stopped | on- - hold. + hold | unknown | not-taken. Type `str`. """ + self.statusReason = None + """ Reason for current status. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.subject = None """ Who is/was taking the medication. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ - - self.taken = None - """ y | n | unk | na. - Type `str`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(MedicationStatement, self).__init__(jsondict=jsondict, strict=strict) @@ -149,11 +145,10 @@ def elementProperties(self): ("note", "note", annotation.Annotation, True, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), - ("reasonNotTaken", "reasonNotTaken", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, True, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("taken", "taken", str, False, None, True), ]) return js diff --git a/fhirclient/models/medicinalproduct.py b/fhirclient/models/medicinalproduct.py new file mode 100644 index 000000000..4c80f4132 --- /dev/null +++ b/fhirclient/models/medicinalproduct.py @@ -0,0 +1,396 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProduct) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProduct(domainresource.DomainResource): + """ Detailed definition of a medicinal product, typically for uses other than + direct patient care (e.g. regulatory use). + """ + + resource_type = "MedicinalProduct" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additionalMonitoringIndicator = None + """ Whether the Medicinal Product is subject to additional monitoring + for regulatory reasons. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.attachedDocument = None + """ Supporting documentation, typically for regulatory submission. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.clinicalTrial = None + """ Clinical trials or studies that this product is involved in. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.combinedPharmaceuticalDoseForm = None + """ The dose form for a single part product, or combined form of a + multiple part product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.contact = None + """ A product specific contact, person (in a role), or an organization. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.crossReference = None + """ Reference to another product, e.g. for linking authorised to + investigational product. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.domain = None + """ If this medicine applies to human or veterinary uses. + Type `Coding` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier for this product. Could be an MPID. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.legalStatusOfSupply = None + """ The legal status of supply of the medicinal product as classified + by the regulator. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manufacturingBusinessOperation = None + """ An operation applied to the product, for manufacturing or + adminsitrative purpose. + List of `MedicinalProductManufacturingBusinessOperation` items (represented as `dict` in JSON). """ + + self.marketingStatus = None + """ Marketing status of the medicinal product, in contrast to marketing + authorizaton. + List of `MarketingStatus` items (represented as `dict` in JSON). """ + + self.masterFile = None + """ A master file for to the medicinal product (e.g. Pharmacovigilance + System Master File). + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.name = None + """ The product's name, including full name and possibly coded parts. + List of `MedicinalProductName` items (represented as `dict` in JSON). """ + + self.packagedMedicinalProduct = None + """ Package representation for the product. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.paediatricUseIndicator = None + """ If authorised for use in children. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.pharmaceuticalProduct = None + """ Pharmaceutical aspects of product. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.productClassification = None + """ Allows the product to be classified by various systems. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.specialDesignation = None + """ Indicates if the medicinal product has an orphan designation for + the treatment of a rare disease. + List of `MedicinalProductSpecialDesignation` items (represented as `dict` in JSON). """ + + self.specialMeasures = None + """ Whether the Medicinal Product is subject to special measures for + regulatory reasons. + List of `str` items. """ + + self.type = None + """ Regulatory type, e.g. Investigational or Authorized. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProduct, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProduct, self).elementProperties() + js.extend([ + ("additionalMonitoringIndicator", "additionalMonitoringIndicator", codeableconcept.CodeableConcept, False, None, False), + ("attachedDocument", "attachedDocument", fhirreference.FHIRReference, True, None, False), + ("clinicalTrial", "clinicalTrial", fhirreference.FHIRReference, True, None, False), + ("combinedPharmaceuticalDoseForm", "combinedPharmaceuticalDoseForm", codeableconcept.CodeableConcept, False, None, False), + ("contact", "contact", fhirreference.FHIRReference, True, None, False), + ("crossReference", "crossReference", identifier.Identifier, True, None, False), + ("domain", "domain", coding.Coding, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("legalStatusOfSupply", "legalStatusOfSupply", codeableconcept.CodeableConcept, False, None, False), + ("manufacturingBusinessOperation", "manufacturingBusinessOperation", MedicinalProductManufacturingBusinessOperation, True, None, False), + ("marketingStatus", "marketingStatus", marketingstatus.MarketingStatus, True, None, False), + ("masterFile", "masterFile", fhirreference.FHIRReference, True, None, False), + ("name", "name", MedicinalProductName, True, None, True), + ("packagedMedicinalProduct", "packagedMedicinalProduct", fhirreference.FHIRReference, True, None, False), + ("paediatricUseIndicator", "paediatricUseIndicator", codeableconcept.CodeableConcept, False, None, False), + ("pharmaceuticalProduct", "pharmaceuticalProduct", fhirreference.FHIRReference, True, None, False), + ("productClassification", "productClassification", codeableconcept.CodeableConcept, True, None, False), + ("specialDesignation", "specialDesignation", MedicinalProductSpecialDesignation, True, None, False), + ("specialMeasures", "specialMeasures", str, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductManufacturingBusinessOperation(backboneelement.BackboneElement): + """ An operation applied to the product, for manufacturing or adminsitrative + purpose. + """ + + resource_type = "MedicinalProductManufacturingBusinessOperation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authorisationReferenceNumber = None + """ Regulatory authorization reference number. + Type `Identifier` (represented as `dict` in JSON). """ + + self.confidentialityIndicator = None + """ To indicate if this proces is commercially confidential. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.effectiveDate = None + """ Regulatory authorization date. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.manufacturer = None + """ The manufacturer or establishment associated with the process. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.operationType = None + """ The type of manufacturing operation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.regulator = None + """ A regulator which oversees the operation. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(MedicinalProductManufacturingBusinessOperation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductManufacturingBusinessOperation, self).elementProperties() + js.extend([ + ("authorisationReferenceNumber", "authorisationReferenceNumber", identifier.Identifier, False, None, False), + ("confidentialityIndicator", "confidentialityIndicator", codeableconcept.CodeableConcept, False, None, False), + ("effectiveDate", "effectiveDate", fhirdate.FHIRDate, False, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, True, None, False), + ("operationType", "operationType", codeableconcept.CodeableConcept, False, None, False), + ("regulator", "regulator", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class MedicinalProductName(backboneelement.BackboneElement): + """ The product's name, including full name and possibly coded parts. + """ + + resource_type = "MedicinalProductName" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.countryLanguage = None + """ Country where the name applies. + List of `MedicinalProductNameCountryLanguage` items (represented as `dict` in JSON). """ + + self.namePart = None + """ Coding words or phrases of the name. + List of `MedicinalProductNameNamePart` items (represented as `dict` in JSON). """ + + self.productName = None + """ The full product name. + Type `str`. """ + + super(MedicinalProductName, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductName, self).elementProperties() + js.extend([ + ("countryLanguage", "countryLanguage", MedicinalProductNameCountryLanguage, True, None, False), + ("namePart", "namePart", MedicinalProductNameNamePart, True, None, False), + ("productName", "productName", str, False, None, True), + ]) + return js + + +class MedicinalProductNameCountryLanguage(backboneelement.BackboneElement): + """ Country where the name applies. + """ + + resource_type = "MedicinalProductNameCountryLanguage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.country = None + """ Country code for where this name applies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Jurisdiction code for where this name applies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.language = None + """ Language code for this name. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductNameCountryLanguage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductNameCountryLanguage, self).elementProperties() + js.extend([ + ("country", "country", codeableconcept.CodeableConcept, False, None, True), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, False, None, False), + ("language", "language", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +class MedicinalProductNameNamePart(backboneelement.BackboneElement): + """ Coding words or phrases of the name. + """ + + resource_type = "MedicinalProductNameNamePart" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.part = None + """ A fragment of a product name. + Type `str`. """ + + self.type = None + """ Idenifying type for this part of the name (e.g. strength part). + Type `Coding` (represented as `dict` in JSON). """ + + super(MedicinalProductNameNamePart, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductNameNamePart, self).elementProperties() + js.extend([ + ("part", "part", str, False, None, True), + ("type", "type", coding.Coding, False, None, True), + ]) + return js + + +class MedicinalProductSpecialDesignation(backboneelement.BackboneElement): + """ Indicates if the medicinal product has an orphan designation for the + treatment of a rare disease. + """ + + resource_type = "MedicinalProductSpecialDesignation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.date = None + """ Date when the designation was granted. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.identifier = None + """ Identifier for the designation, or procedure number. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.indicationCodeableConcept = None + """ Condition for which the medicinal use applies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.indicationReference = None + """ Condition for which the medicinal use applies. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.intendedUse = None + """ The intended use of the product, e.g. prevention, treatment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.species = None + """ Animal species for which this applies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ For example granted, pending, expired or withdrawn. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ The type of special designation, e.g. orphan drug, minor use. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductSpecialDesignation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductSpecialDesignation, self).elementProperties() + js.extend([ + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("indicationCodeableConcept", "indicationCodeableConcept", codeableconcept.CodeableConcept, False, "indication", False), + ("indicationReference", "indicationReference", fhirreference.FHIRReference, False, "indication", False), + ("intendedUse", "intendedUse", codeableconcept.CodeableConcept, False, None, False), + ("species", "species", codeableconcept.CodeableConcept, False, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import coding +except ImportError: + coding = sys.modules[__package__ + '.coding'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import marketingstatus +except ImportError: + marketingstatus = sys.modules[__package__ + '.marketingstatus'] diff --git a/fhirclient/models/medicinalproduct_tests.py b/fhirclient/models/medicinalproduct_tests.py new file mode 100644 index 000000000..44ad5b778 --- /dev/null +++ b/fhirclient/models/medicinalproduct_tests.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproduct +from .fhirdate import FHIRDate + + +class MedicinalProductTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProduct", js["resourceType"]) + return medicinalproduct.MedicinalProduct(js) + + def testMedicinalProduct1(self): + inst = self.instantiate_from("medicinalproduct-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProduct instance") + self.implMedicinalProduct1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProduct", js["resourceType"]) + inst2 = medicinalproduct.MedicinalProduct(js) + self.implMedicinalProduct1(inst2) + + def implMedicinalProduct1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://ema.europa.eu/example/MPID") + self.assertEqual(inst.identifier[0].value, "{mpid}") + self.assertEqual(inst.manufacturingBusinessOperation[0].authorisationReferenceNumber.system, "http://ema.europa.eu/example/manufacturingAuthorisationReferenceNumber") + self.assertEqual(inst.manufacturingBusinessOperation[0].authorisationReferenceNumber.value, "1324TZ") + self.assertEqual(inst.manufacturingBusinessOperation[0].effectiveDate.date, FHIRDate("2013-03-15").date) + self.assertEqual(inst.manufacturingBusinessOperation[0].effectiveDate.as_json(), "2013-03-15") + self.assertEqual(inst.manufacturingBusinessOperation[0].operationType.coding[0].code, "Batchrelease") + self.assertEqual(inst.manufacturingBusinessOperation[0].operationType.coding[0].system, "http://ema.europa.eu/example/manufacturingOperationType") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].countryLanguage[0].country.coding[0].code, "EU") + self.assertEqual(inst.name[0].countryLanguage[0].country.coding[0].system, "http://ema.europa.eu/example/countryCode") + self.assertEqual(inst.name[0].countryLanguage[0].jurisdiction.coding[0].code, "EU") + self.assertEqual(inst.name[0].countryLanguage[0].jurisdiction.coding[0].system, "http://ema.europa.eu/example/jurisdictionCode") + self.assertEqual(inst.name[0].countryLanguage[0].language.coding[0].code, "EN") + self.assertEqual(inst.name[0].countryLanguage[0].language.coding[0].system, "http://ema.europa.eu/example/languageCode") + self.assertEqual(inst.name[0].namePart[0].part, "Equilidem") + self.assertEqual(inst.name[0].namePart[0].type.code, "INV") + self.assertEqual(inst.name[0].namePart[1].part, "2.5 mg") + self.assertEqual(inst.name[0].namePart[1].type.code, "STR") + self.assertEqual(inst.name[0].namePart[2].part, "film-coated tablets") + self.assertEqual(inst.name[0].namePart[2].type.code, "FRM") + self.assertEqual(inst.name[0].productName, "Equilidem 2.5 mg film-coated tablets") + self.assertEqual(inst.productClassification[0].coding[0].code, "WHOAnatomicalTherapeuticChemicalATCClassificationSystem|B01AF02") + self.assertEqual(inst.productClassification[0].coding[0].system, "http://ema.europa.eu/example/WHOAnatomicalTherapeuticChemicalATCClassificationSystem") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/medicinalproductauthorization.py b/fhirclient/models/medicinalproductauthorization.py new file mode 100644 index 000000000..00c892210 --- /dev/null +++ b/fhirclient/models/medicinalproductauthorization.py @@ -0,0 +1,240 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductAuthorization) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductAuthorization(domainresource.DomainResource): + """ The regulatory authorization of a medicinal product. + """ + + resource_type = "MedicinalProductAuthorization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.country = None + """ The country in which the marketing authorization has been granted. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.dataExclusivityPeriod = None + """ A period of time after authorization before generic product + applicatiosn can be submitted. + Type `Period` (represented as `dict` in JSON). """ + + self.dateOfFirstAuthorization = None + """ The date when the first authorization was granted by a Medicines + Regulatory Agency. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.holder = None + """ Marketing Authorization Holder. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier for the marketing authorization, as assigned by + a regulator. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.internationalBirthDate = None + """ Date of first marketing authorization for a company's new medicinal + product in any country in the World. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.jurisdiction = None + """ Jurisdiction within a country. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.jurisdictionalAuthorization = None + """ Authorization in areas within a country. + List of `MedicinalProductAuthorizationJurisdictionalAuthorization` items (represented as `dict` in JSON). """ + + self.legalBasis = None + """ The legal framework against which this authorization is granted. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.procedure = None + """ The regulatory procedure for granting or amending a marketing + authorization. + Type `MedicinalProductAuthorizationProcedure` (represented as `dict` in JSON). """ + + self.regulator = None + """ Medicines Regulatory Agency. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.restoreDate = None + """ The date when a suspended the marketing or the marketing + authorization of the product is anticipated to be restored. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ The status of the marketing authorization. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.statusDate = None + """ The date at which the given status has become applicable. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.subject = None + """ The medicinal product that is being authorized. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.validityPeriod = None + """ The beginning of the time period in which the marketing + authorization is in the specific status shall be specified A + complete date consisting of day, month and year shall be specified + using the ISO 8601 date format. + Type `Period` (represented as `dict` in JSON). """ + + super(MedicinalProductAuthorization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductAuthorization, self).elementProperties() + js.extend([ + ("country", "country", codeableconcept.CodeableConcept, True, None, False), + ("dataExclusivityPeriod", "dataExclusivityPeriod", period.Period, False, None, False), + ("dateOfFirstAuthorization", "dateOfFirstAuthorization", fhirdate.FHIRDate, False, None, False), + ("holder", "holder", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("internationalBirthDate", "internationalBirthDate", fhirdate.FHIRDate, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("jurisdictionalAuthorization", "jurisdictionalAuthorization", MedicinalProductAuthorizationJurisdictionalAuthorization, True, None, False), + ("legalBasis", "legalBasis", codeableconcept.CodeableConcept, False, None, False), + ("procedure", "procedure", MedicinalProductAuthorizationProcedure, False, None, False), + ("regulator", "regulator", fhirreference.FHIRReference, False, None, False), + ("restoreDate", "restoreDate", fhirdate.FHIRDate, False, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, False), + ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("validityPeriod", "validityPeriod", period.Period, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductAuthorizationJurisdictionalAuthorization(backboneelement.BackboneElement): + """ Authorization in areas within a country. + """ + + resource_type = "MedicinalProductAuthorizationJurisdictionalAuthorization" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.country = None + """ Country of authorization. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ The assigned number for the marketing authorization. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Jurisdiction within a country. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.legalStatusOfSupply = None + """ The legal status of supply in a jurisdiction or region. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.validityPeriod = None + """ The start and expected end date of the authorization. + Type `Period` (represented as `dict` in JSON). """ + + super(MedicinalProductAuthorizationJurisdictionalAuthorization, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductAuthorizationJurisdictionalAuthorization, self).elementProperties() + js.extend([ + ("country", "country", codeableconcept.CodeableConcept, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("legalStatusOfSupply", "legalStatusOfSupply", codeableconcept.CodeableConcept, False, None, False), + ("validityPeriod", "validityPeriod", period.Period, False, None, False), + ]) + return js + + +class MedicinalProductAuthorizationProcedure(backboneelement.BackboneElement): + """ The regulatory procedure for granting or amending a marketing authorization. + """ + + resource_type = "MedicinalProductAuthorizationProcedure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.application = None + """ Applcations submitted to obtain a marketing authorization. + List of `MedicinalProductAuthorizationProcedure` items (represented as `dict` in JSON). """ + + self.dateDateTime = None + """ Date of procedure. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.datePeriod = None + """ Date of procedure. + Type `Period` (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifier for this procedure. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ Type of procedure. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductAuthorizationProcedure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductAuthorizationProcedure, self).elementProperties() + js.extend([ + ("application", "application", MedicinalProductAuthorizationProcedure, True, None, False), + ("dateDateTime", "dateDateTime", fhirdate.FHIRDate, False, "date", False), + ("datePeriod", "datePeriod", period.Period, False, "date", False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/medicinalproductauthorization_tests.py b/fhirclient/models/medicinalproductauthorization_tests.py new file mode 100644 index 000000000..06bfbe368 --- /dev/null +++ b/fhirclient/models/medicinalproductauthorization_tests.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductauthorization +from .fhirdate import FHIRDate + + +class MedicinalProductAuthorizationTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductAuthorization", js["resourceType"]) + return medicinalproductauthorization.MedicinalProductAuthorization(js) + + def testMedicinalProductAuthorization1(self): + inst = self.instantiate_from("medicinalproductauthorization-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductAuthorization instance") + self.implMedicinalProductAuthorization1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductAuthorization", js["resourceType"]) + inst2 = medicinalproductauthorization.MedicinalProductAuthorization(js) + self.implMedicinalProductAuthorization1(inst2) + + def implMedicinalProductAuthorization1(self, inst): + self.assertEqual(inst.country[0].coding[0].code, "EU") + self.assertEqual(inst.country[0].coding[0].system, "http://ema.europa.eu/example/country") + self.assertEqual(inst.dataExclusivityPeriod.end.date, FHIRDate("2020-08-15").date) + self.assertEqual(inst.dataExclusivityPeriod.end.as_json(), "2020-08-15") + self.assertEqual(inst.dataExclusivityPeriod.start.date, FHIRDate("2010-08-15").date) + self.assertEqual(inst.dataExclusivityPeriod.start.as_json(), "2010-08-15") + self.assertEqual(inst.dateOfFirstAuthorization.date, FHIRDate("2010-08-15").date) + self.assertEqual(inst.dateOfFirstAuthorization.as_json(), "2010-08-15") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://ema.europa.eu/example/marketingAuthorisationNumber") + self.assertEqual(inst.identifier[0].value, "EU/1/11/999/001") + self.assertEqual(inst.internationalBirthDate.date, FHIRDate("2010-08-15").date) + self.assertEqual(inst.internationalBirthDate.as_json(), "2010-08-15") + self.assertEqual(inst.jurisdictionalAuthorization[0].country.coding[0].code, "NO") + self.assertEqual(inst.jurisdictionalAuthorization[0].country.coding[0].system, "http://ema.europa.eu/example/countryCode") + self.assertEqual(inst.jurisdictionalAuthorization[0].id, "1") + self.assertEqual(inst.jurisdictionalAuthorization[0].identifier[0].system, "http://ema.europa.eu/example/marketingauthorisationnumber") + self.assertEqual(inst.jurisdictionalAuthorization[0].identifier[0].value, "123-456-789") + self.assertEqual(inst.jurisdictionalAuthorization[1].country.coding[0].code, "NO") + self.assertEqual(inst.jurisdictionalAuthorization[1].country.coding[0].system, "http://ema.europa.eu/example/countryCode") + self.assertEqual(inst.jurisdictionalAuthorization[1].id, "2") + self.assertEqual(inst.jurisdictionalAuthorization[1].identifier[0].system, "http://ema.europa.eu/example/marketingauthorisationnumber") + self.assertEqual(inst.jurisdictionalAuthorization[1].identifier[0].value, "123-456-123") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.procedure.application[0].dateDateTime.date, FHIRDate("2015-08-01").date) + self.assertEqual(inst.procedure.application[0].dateDateTime.as_json(), "2015-08-01") + self.assertEqual(inst.procedure.application[0].identifier.system, "http://ema.europa.eu/example/applicationidentifier-number") + self.assertEqual(inst.procedure.application[0].identifier.value, "IA38G") + self.assertEqual(inst.procedure.application[0].type.coding[0].code, "GroupTypeIAVariationNotification") + self.assertEqual(inst.procedure.application[0].type.coding[0].system, "http://ema.europa.eu/example/marketingAuthorisationApplicationType") + self.assertEqual(inst.procedure.datePeriod.end.date, FHIRDate("2015-08-21").date) + self.assertEqual(inst.procedure.datePeriod.end.as_json(), "2015-08-21") + self.assertEqual(inst.procedure.datePeriod.start.date, FHIRDate("2015-08-02").date) + self.assertEqual(inst.procedure.datePeriod.start.as_json(), "2015-08-02") + self.assertEqual(inst.procedure.identifier.system, "http://ema.europa.eu/example/procedureidentifier-number") + self.assertEqual(inst.procedure.identifier.value, "EMEA/H/C/009999/IA/0099/G") + self.assertEqual(inst.procedure.type.coding[0].code, "VariationTypeIA") + self.assertEqual(inst.procedure.type.coding[0].system, "http://ema.europa.eu/example/marketingAuthorisationProcedureType") + self.assertEqual(inst.status.coding[0].code, "active") + self.assertEqual(inst.status.coding[0].system, "http://ema.europa.eu/example/authorisationstatus") + self.assertEqual(inst.statusDate.date, FHIRDate("2015-01-14").date) + self.assertEqual(inst.statusDate.as_json(), "2015-01-14") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.validityPeriod.end.date, FHIRDate("2020-05-20").date) + self.assertEqual(inst.validityPeriod.end.as_json(), "2020-05-20") + self.assertEqual(inst.validityPeriod.start.date, FHIRDate("2015-08-16").date) + self.assertEqual(inst.validityPeriod.start.as_json(), "2015-08-16") + diff --git a/fhirclient/models/medicinalproductcontraindication.py b/fhirclient/models/medicinalproductcontraindication.py new file mode 100644 index 000000000..6cb443b4a --- /dev/null +++ b/fhirclient/models/medicinalproductcontraindication.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductContraindication) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductContraindication(domainresource.DomainResource): + """ MedicinalProductContraindication. + + The clinical particulars - indications, contraindications etc. of a + medicinal product, including for regulatory purposes. + """ + + resource_type = "MedicinalProductContraindication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.comorbidity = None + """ A comorbidity (concurrent condition) or coinfection. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.disease = None + """ The disease, symptom or procedure for the contraindication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diseaseStatus = None + """ The status of the disease or symptom for the contraindication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.otherTherapy = None + """ Information about the use of the medicinal product in relation to + other therapies described as part of the indication. + List of `MedicinalProductContraindicationOtherTherapy` items (represented as `dict` in JSON). """ + + self.population = None + """ The population group to which this applies. + List of `Population` items (represented as `dict` in JSON). """ + + self.subject = None + """ The medication for which this is an indication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.therapeuticIndication = None + """ Information about the use of the medicinal product in relation to + other therapies as part of the indication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(MedicinalProductContraindication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductContraindication, self).elementProperties() + js.extend([ + ("comorbidity", "comorbidity", codeableconcept.CodeableConcept, True, None, False), + ("disease", "disease", codeableconcept.CodeableConcept, False, None, False), + ("diseaseStatus", "diseaseStatus", codeableconcept.CodeableConcept, False, None, False), + ("otherTherapy", "otherTherapy", MedicinalProductContraindicationOtherTherapy, True, None, False), + ("population", "population", population.Population, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ("therapeuticIndication", "therapeuticIndication", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductContraindicationOtherTherapy(backboneelement.BackboneElement): + """ Information about the use of the medicinal product in relation to other + therapies described as part of the indication. + """ + + resource_type = "MedicinalProductContraindicationOtherTherapy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.medicationCodeableConcept = None + """ Reference to a specific medication (active substance, medicinal + product or class of products) as part of an indication or + contraindication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ Reference to a specific medication (active substance, medicinal + product or class of products) as part of an indication or + contraindication. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.therapyRelationshipType = None + """ The type of relationship between the medicinal product indication + or contraindication and another therapy. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductContraindicationOtherTherapy, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductContraindicationOtherTherapy, self).elementProperties() + js.extend([ + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("therapyRelationshipType", "therapyRelationshipType", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import population +except ImportError: + population = sys.modules[__package__ + '.population'] diff --git a/fhirclient/models/medicinalproductcontraindication_tests.py b/fhirclient/models/medicinalproductcontraindication_tests.py new file mode 100644 index 000000000..35880578a --- /dev/null +++ b/fhirclient/models/medicinalproductcontraindication_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductcontraindication +from .fhirdate import FHIRDate + + +class MedicinalProductContraindicationTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductContraindication", js["resourceType"]) + return medicinalproductcontraindication.MedicinalProductContraindication(js) + + def testMedicinalProductContraindication1(self): + inst = self.instantiate_from("medicinalproductcontraindication-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductContraindication instance") + self.implMedicinalProductContraindication1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductContraindication", js["resourceType"]) + inst2 = medicinalproductcontraindication.MedicinalProductContraindication(js) + self.implMedicinalProductContraindication1(inst2) + + def implMedicinalProductContraindication1(self, inst): + self.assertEqual(inst.comorbidity[0].coding[0].code, "Hepaticdisease") + self.assertEqual(inst.comorbidity[0].coding[0].system, "http://ema.europa.eu/example/comorbidity") + self.assertEqual(inst.disease.coding[0].code, "Coagulopathiesandbleedingdiatheses(exclthrombocytopenic)") + self.assertEqual(inst.disease.coding[0].system, "http://ema.europa.eu/example/contraindicationsasdisease-symptom-procedure") + self.assertEqual(inst.disease.text, "Hepatic disease associated with coagulopathy and clinically relevant bleeding risk") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/medicinalproductindication.py b/fhirclient/models/medicinalproductindication.py new file mode 100644 index 000000000..39b04a03b --- /dev/null +++ b/fhirclient/models/medicinalproductindication.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductIndication) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductIndication(domainresource.DomainResource): + """ MedicinalProductIndication. + + Indication for the Medicinal Product. + """ + + resource_type = "MedicinalProductIndication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.comorbidity = None + """ Comorbidity (concurrent condition) or co-infection as part of the + indication. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.diseaseStatus = None + """ The status of the disease or symptom for which the indication + applies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.diseaseSymptomProcedure = None + """ The disease, symptom or procedure that is the indication for + treatment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.duration = None + """ Timing or duration information as part of the indication. + Type `Quantity` (represented as `dict` in JSON). """ + + self.intendedEffect = None + """ The intended effect, aim or strategy to be achieved by the + indication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.otherTherapy = None + """ Information about the use of the medicinal product in relation to + other therapies described as part of the indication. + List of `MedicinalProductIndicationOtherTherapy` items (represented as `dict` in JSON). """ + + self.population = None + """ The population group to which this applies. + List of `Population` items (represented as `dict` in JSON). """ + + self.subject = None + """ The medication for which this is an indication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.undesirableEffect = None + """ Describe the undesirable effects of the medicinal product. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(MedicinalProductIndication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductIndication, self).elementProperties() + js.extend([ + ("comorbidity", "comorbidity", codeableconcept.CodeableConcept, True, None, False), + ("diseaseStatus", "diseaseStatus", codeableconcept.CodeableConcept, False, None, False), + ("diseaseSymptomProcedure", "diseaseSymptomProcedure", codeableconcept.CodeableConcept, False, None, False), + ("duration", "duration", quantity.Quantity, False, None, False), + ("intendedEffect", "intendedEffect", codeableconcept.CodeableConcept, False, None, False), + ("otherTherapy", "otherTherapy", MedicinalProductIndicationOtherTherapy, True, None, False), + ("population", "population", population.Population, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ("undesirableEffect", "undesirableEffect", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductIndicationOtherTherapy(backboneelement.BackboneElement): + """ Information about the use of the medicinal product in relation to other + therapies described as part of the indication. + """ + + resource_type = "MedicinalProductIndicationOtherTherapy" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.medicationCodeableConcept = None + """ Reference to a specific medication (active substance, medicinal + product or class of products) as part of an indication or + contraindication. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.medicationReference = None + """ Reference to a specific medication (active substance, medicinal + product or class of products) as part of an indication or + contraindication. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.therapyRelationshipType = None + """ The type of relationship between the medicinal product indication + or contraindication and another therapy. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductIndicationOtherTherapy, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductIndicationOtherTherapy, self).elementProperties() + js.extend([ + ("medicationCodeableConcept", "medicationCodeableConcept", codeableconcept.CodeableConcept, False, "medication", True), + ("medicationReference", "medicationReference", fhirreference.FHIRReference, False, "medication", True), + ("therapyRelationshipType", "therapyRelationshipType", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import population +except ImportError: + population = sys.modules[__package__ + '.population'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/medicinalproductindication_tests.py b/fhirclient/models/medicinalproductindication_tests.py new file mode 100644 index 000000000..7fdccd884 --- /dev/null +++ b/fhirclient/models/medicinalproductindication_tests.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductindication +from .fhirdate import FHIRDate + + +class MedicinalProductIndicationTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductIndication", js["resourceType"]) + return medicinalproductindication.MedicinalProductIndication(js) + + def testMedicinalProductIndication1(self): + inst = self.instantiate_from("medicinalproductindication-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductIndication instance") + self.implMedicinalProductIndication1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductIndication", js["resourceType"]) + inst2 = medicinalproductindication.MedicinalProductIndication(js) + self.implMedicinalProductIndication1(inst2) + + def implMedicinalProductIndication1(self, inst): + self.assertEqual(inst.comorbidity[0].coding[0].code, "Hipsurgery") + self.assertEqual(inst.comorbidity[0].coding[0].system, "http://ema.europa.eu/example/comorbidity") + self.assertEqual(inst.diseaseSymptomProcedure.coding[0].code, "Venousthromboembolismprophylaxis") + self.assertEqual(inst.diseaseSymptomProcedure.coding[0].system, "http://ema.europa.eu/example/indicationasdisease-symptom-procedure") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.intendedEffect.coding[0].code, "PRYLX") + self.assertEqual(inst.intendedEffect.coding[0].system, "http://ema.europa.eu/example/intendedeffect") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.population[0].ageRange.low.unit, "a") + self.assertEqual(inst.population[0].ageRange.low.value, 18) + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/medicinalproductingredient.py b/fhirclient/models/medicinalproductingredient.py new file mode 100644 index 000000000..109b408fc --- /dev/null +++ b/fhirclient/models/medicinalproductingredient.py @@ -0,0 +1,273 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductIngredient) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductIngredient(domainresource.DomainResource): + """ An ingredient of a manufactured item or pharmaceutical product. + """ + + resource_type = "MedicinalProductIngredient" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.allergenicIndicator = None + """ If the ingredient is a known or suspected allergen. + Type `bool`. """ + + self.identifier = None + """ Identifier for the ingredient. + Type `Identifier` (represented as `dict` in JSON). """ + + self.manufacturer = None + """ Manufacturer of this Ingredient. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.role = None + """ Ingredient role e.g. Active ingredient, excipient. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.specifiedSubstance = None + """ A specified substance that comprises this ingredient. + List of `MedicinalProductIngredientSpecifiedSubstance` items (represented as `dict` in JSON). """ + + self.substance = None + """ The ingredient substance. + Type `MedicinalProductIngredientSubstance` (represented as `dict` in JSON). """ + + super(MedicinalProductIngredient, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductIngredient, self).elementProperties() + js.extend([ + ("allergenicIndicator", "allergenicIndicator", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, True, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, True), + ("specifiedSubstance", "specifiedSubstance", MedicinalProductIngredientSpecifiedSubstance, True, None, False), + ("substance", "substance", MedicinalProductIngredientSubstance, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductIngredientSpecifiedSubstance(backboneelement.BackboneElement): + """ A specified substance that comprises this ingredient. + """ + + resource_type = "MedicinalProductIngredientSpecifiedSubstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ The specified substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.confidentiality = None + """ Confidentiality level of the specified substance as the ingredient. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.group = None + """ The group of specified substance, e.g. group 1 to 4. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.strength = None + """ Quantity of the substance or specified substance present in the + manufactured item or pharmaceutical product. + List of `MedicinalProductIngredientSpecifiedSubstanceStrength` items (represented as `dict` in JSON). """ + + super(MedicinalProductIngredientSpecifiedSubstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductIngredientSpecifiedSubstance, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("confidentiality", "confidentiality", codeableconcept.CodeableConcept, False, None, False), + ("group", "group", codeableconcept.CodeableConcept, False, None, True), + ("strength", "strength", MedicinalProductIngredientSpecifiedSubstanceStrength, True, None, False), + ]) + return js + + +class MedicinalProductIngredientSpecifiedSubstanceStrength(backboneelement.BackboneElement): + """ Quantity of the substance or specified substance present in the + manufactured item or pharmaceutical product. + """ + + resource_type = "MedicinalProductIngredientSpecifiedSubstanceStrength" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.concentration = None + """ The strength per unitary volume (or mass). + Type `Ratio` (represented as `dict` in JSON). """ + + self.concentrationLowLimit = None + """ A lower limit for the strength per unitary volume (or mass), for + when there is a range. The concentration attribute then becomes the + upper limit. + Type `Ratio` (represented as `dict` in JSON). """ + + self.country = None + """ The country or countries for which the strength range applies. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.measurementPoint = None + """ For when strength is measured at a particular point or distance. + Type `str`. """ + + self.presentation = None + """ The quantity of substance in the unit of presentation, or in the + volume (or mass) of the single pharmaceutical product or + manufactured item. + Type `Ratio` (represented as `dict` in JSON). """ + + self.presentationLowLimit = None + """ A lower limit for the quantity of substance in the unit of + presentation. For use when there is a range of strengths, this is + the lower limit, with the presentation attribute becoming the upper + limit. + Type `Ratio` (represented as `dict` in JSON). """ + + self.referenceStrength = None + """ Strength expressed in terms of a reference substance. + List of `MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength` items (represented as `dict` in JSON). """ + + super(MedicinalProductIngredientSpecifiedSubstanceStrength, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductIngredientSpecifiedSubstanceStrength, self).elementProperties() + js.extend([ + ("concentration", "concentration", ratio.Ratio, False, None, False), + ("concentrationLowLimit", "concentrationLowLimit", ratio.Ratio, False, None, False), + ("country", "country", codeableconcept.CodeableConcept, True, None, False), + ("measurementPoint", "measurementPoint", str, False, None, False), + ("presentation", "presentation", ratio.Ratio, False, None, True), + ("presentationLowLimit", "presentationLowLimit", ratio.Ratio, False, None, False), + ("referenceStrength", "referenceStrength", MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength, True, None, False), + ]) + return js + + +class MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength(backboneelement.BackboneElement): + """ Strength expressed in terms of a reference substance. + """ + + resource_type = "MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.country = None + """ The country or countries for which the strength range applies. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.measurementPoint = None + """ For when strength is measured at a particular point or distance. + Type `str`. """ + + self.strength = None + """ Strength expressed in terms of a reference substance. + Type `Ratio` (represented as `dict` in JSON). """ + + self.strengthLowLimit = None + """ Strength expressed in terms of a reference substance. + Type `Ratio` (represented as `dict` in JSON). """ + + self.substance = None + """ Relevant reference substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength, self).elementProperties() + js.extend([ + ("country", "country", codeableconcept.CodeableConcept, True, None, False), + ("measurementPoint", "measurementPoint", str, False, None, False), + ("strength", "strength", ratio.Ratio, False, None, True), + ("strengthLowLimit", "strengthLowLimit", ratio.Ratio, False, None, False), + ("substance", "substance", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class MedicinalProductIngredientSubstance(backboneelement.BackboneElement): + """ The ingredient substance. + """ + + resource_type = "MedicinalProductIngredientSubstance" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ The ingredient substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.strength = None + """ Quantity of the substance or specified substance present in the + manufactured item or pharmaceutical product. + List of `MedicinalProductIngredientSpecifiedSubstanceStrength` items (represented as `dict` in JSON). """ + + super(MedicinalProductIngredientSubstance, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductIngredientSubstance, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("strength", "strength", MedicinalProductIngredientSpecifiedSubstanceStrength, True, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/medicinalproductingredient_tests.py b/fhirclient/models/medicinalproductingredient_tests.py new file mode 100644 index 000000000..0d12ce536 --- /dev/null +++ b/fhirclient/models/medicinalproductingredient_tests.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductingredient +from .fhirdate import FHIRDate + + +class MedicinalProductIngredientTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductIngredient", js["resourceType"]) + return medicinalproductingredient.MedicinalProductIngredient(js) + + def testMedicinalProductIngredient1(self): + inst = self.instantiate_from("medicinalproductingredient-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductIngredient instance") + self.implMedicinalProductIngredient1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductIngredient", js["resourceType"]) + inst2 = medicinalproductingredient.MedicinalProductIngredient(js) + self.implMedicinalProductIngredient1(inst2) + + def implMedicinalProductIngredient1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.role.coding[0].code, "ActiveBase") + self.assertEqual(inst.role.coding[0].system, "http://ema.europa.eu/example/ingredientRole") + self.assertEqual(inst.specifiedSubstance[0].code.coding[0].code, "equixabanCompanyequixaban1") + self.assertEqual(inst.specifiedSubstance[0].code.coding[0].system, "http://ema.europa.eu/example/specifiedSubstance") + self.assertEqual(inst.specifiedSubstance[0].group.coding[0].code, "2") + self.assertEqual(inst.specifiedSubstance[0].group.coding[0].system, "http://ema.europa.eu/example/specifiedSubstanceGroup") + self.assertEqual(inst.substance.code.coding[0].code, "EQUIXABAN") + self.assertEqual(inst.substance.code.coding[0].system, "http://ema.europa.eu/example/substance") + self.assertEqual(inst.substance.strength[0].presentation.denominator.unit, "{tablet}") + self.assertEqual(inst.substance.strength[0].presentation.denominator.value, 1) + self.assertEqual(inst.substance.strength[0].presentation.numerator.unit, "mg") + self.assertEqual(inst.substance.strength[0].presentation.numerator.value, 2.5) + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/medicinalproductinteraction.py b/fhirclient/models/medicinalproductinteraction.py new file mode 100644 index 000000000..7509dc063 --- /dev/null +++ b/fhirclient/models/medicinalproductinteraction.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductInteraction) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductInteraction(domainresource.DomainResource): + """ MedicinalProductInteraction. + + The interactions of the medicinal product with other medicinal products, or + other forms of interactions. + """ + + resource_type = "MedicinalProductInteraction" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ The interaction described. + Type `str`. """ + + self.effect = None + """ The effect of the interaction, for example "reduced gastric + absorption of primary medication". + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.incidence = None + """ The incidence of the interaction, e.g. theoretical, observed. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.interactant = None + """ The specific medication, food or laboratory test that interacts. + List of `MedicinalProductInteractionInteractant` items (represented as `dict` in JSON). """ + + self.management = None + """ Actions for managing the interaction. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subject = None + """ The medication for which this is a described interaction. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ The type of the interaction e.g. drug-drug interaction, drug-food + interaction, drug-lab test interaction. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductInteraction, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductInteraction, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("effect", "effect", codeableconcept.CodeableConcept, False, None, False), + ("incidence", "incidence", codeableconcept.CodeableConcept, False, None, False), + ("interactant", "interactant", MedicinalProductInteractionInteractant, True, None, False), + ("management", "management", codeableconcept.CodeableConcept, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductInteractionInteractant(backboneelement.BackboneElement): + """ The specific medication, food or laboratory test that interacts. + """ + + resource_type = "MedicinalProductInteractionInteractant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.itemCodeableConcept = None + """ The specific medication, food or laboratory test that interacts. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ The specific medication, food or laboratory test that interacts. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(MedicinalProductInteractionInteractant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductInteractionInteractant, self).elementProperties() + js.extend([ + ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", True), + ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/medicinalproductinteraction_tests.py b/fhirclient/models/medicinalproductinteraction_tests.py new file mode 100644 index 000000000..5b588b398 --- /dev/null +++ b/fhirclient/models/medicinalproductinteraction_tests.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductinteraction +from .fhirdate import FHIRDate + + +class MedicinalProductInteractionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductInteraction", js["resourceType"]) + return medicinalproductinteraction.MedicinalProductInteraction(js) + + def testMedicinalProductInteraction1(self): + inst = self.instantiate_from("medicinalproductinteraction-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductInteraction instance") + self.implMedicinalProductInteraction1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductInteraction", js["resourceType"]) + inst2 = medicinalproductinteraction.MedicinalProductInteraction(js) + self.implMedicinalProductInteraction1(inst2) + + def implMedicinalProductInteraction1(self, inst): + self.assertEqual(inst.effect.coding[0].code, "Increasedplasmaconcentrations") + self.assertEqual(inst.effect.coding[0].system, "http://ema.europa.eu/example/interactionseffect") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.interactant[0].itemCodeableConcept.coding[0].code, "ketoconazole") + self.assertEqual(inst.interactant[0].itemCodeableConcept.coding[0].system, "http://ema.europa.eu/example/interactant") + self.assertEqual(inst.interactant[1].itemCodeableConcept.coding[0].code, "itraconazole") + self.assertEqual(inst.interactant[1].itemCodeableConcept.coding[0].system, "http://ema.europa.eu/example/interactant") + self.assertEqual(inst.management.text, "Coadministration not recommended in patients receiving concomitant systemic treatment strong inhibitors of both CYP3A4 and P-gp") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "StrongInhibitorofCYP3A4") + self.assertEqual(inst.type.coding[0].system, "http://ema.europa.eu/example/interactionsType") + diff --git a/fhirclient/models/medicinalproductmanufactured.py b/fhirclient/models/medicinalproductmanufactured.py new file mode 100644 index 000000000..7c41b0165 --- /dev/null +++ b/fhirclient/models/medicinalproductmanufactured.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductManufactured) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductManufactured(domainresource.DomainResource): + """ The manufactured item as contained in the packaged medicinal product. + """ + + resource_type = "MedicinalProductManufactured" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.ingredient = None + """ Ingredient. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.manufacturedDoseForm = None + """ Dose form as manufactured and before any transformation into the + pharmaceutical product. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manufacturer = None + """ Manufacturer of the item (Note that this should be named + "manufacturer" but it currently causes technical issues). + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.otherCharacteristics = None + """ Other codeable characteristics. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.physicalCharacteristics = None + """ Dimensions, color etc.. + Type `ProdCharacteristic` (represented as `dict` in JSON). """ + + self.quantity = None + """ The quantity or "count number" of the manufactured item. + Type `Quantity` (represented as `dict` in JSON). """ + + self.unitOfPresentation = None + """ The “real world” units in which the quantity of the manufactured + item is described. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductManufactured, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductManufactured, self).elementProperties() + js.extend([ + ("ingredient", "ingredient", fhirreference.FHIRReference, True, None, False), + ("manufacturedDoseForm", "manufacturedDoseForm", codeableconcept.CodeableConcept, False, None, True), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, True, None, False), + ("otherCharacteristics", "otherCharacteristics", codeableconcept.CodeableConcept, True, None, False), + ("physicalCharacteristics", "physicalCharacteristics", prodcharacteristic.ProdCharacteristic, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, True), + ("unitOfPresentation", "unitOfPresentation", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import prodcharacteristic +except ImportError: + prodcharacteristic = sys.modules[__package__ + '.prodcharacteristic'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/medicinalproductmanufactured_tests.py b/fhirclient/models/medicinalproductmanufactured_tests.py new file mode 100644 index 000000000..af54dfd0b --- /dev/null +++ b/fhirclient/models/medicinalproductmanufactured_tests.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductmanufactured +from .fhirdate import FHIRDate + + +class MedicinalProductManufacturedTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductManufactured", js["resourceType"]) + return medicinalproductmanufactured.MedicinalProductManufactured(js) + + def testMedicinalProductManufactured1(self): + inst = self.instantiate_from("medicinalproductmanufactured-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductManufactured instance") + self.implMedicinalProductManufactured1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductManufactured", js["resourceType"]) + inst2 = medicinalproductmanufactured.MedicinalProductManufactured(js) + self.implMedicinalProductManufactured1(inst2) + + def implMedicinalProductManufactured1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.manufacturedDoseForm.coding[0].code, "Film-coatedtablet") + self.assertEqual(inst.manufacturedDoseForm.coding[0].system, "http://ema.europa.eu/example/manufactureddoseform") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.physicalCharacteristics.color[0], "Pink") + self.assertEqual(inst.physicalCharacteristics.imprint[0], "894") + self.assertEqual(inst.physicalCharacteristics.shape, "Oval") + self.assertEqual(inst.quantity.unit, "1") + self.assertEqual(inst.quantity.value, 10) + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.unitOfPresentation.coding[0].code, "Tablet") + self.assertEqual(inst.unitOfPresentation.coding[0].system, "http://ema.europa.eu/example/unitofpresentation") + diff --git a/fhirclient/models/medicinalproductpackaged.py b/fhirclient/models/medicinalproductpackaged.py new file mode 100644 index 000000000..3af1de8a1 --- /dev/null +++ b/fhirclient/models/medicinalproductpackaged.py @@ -0,0 +1,230 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductPackaged) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductPackaged(domainresource.DomainResource): + """ A medicinal product in a container or package. + """ + + resource_type = "MedicinalProductPackaged" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.batchIdentifier = None + """ Batch numbering. + List of `MedicinalProductPackagedBatchIdentifier` items (represented as `dict` in JSON). """ + + self.description = None + """ Textual description. + Type `str`. """ + + self.identifier = None + """ Unique identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.legalStatusOfSupply = None + """ The legal status of supply of the medicinal product as classified + by the regulator. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.manufacturer = None + """ Manufacturer of this Package Item. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.marketingAuthorization = None + """ Manufacturer of this Package Item. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.marketingStatus = None + """ Marketing information. + List of `MarketingStatus` items (represented as `dict` in JSON). """ + + self.packageItem = None + """ A packaging item, as a contained for medicine, possibly with other + packaging items within. + List of `MedicinalProductPackagedPackageItem` items (represented as `dict` in JSON). """ + + self.subject = None + """ The product with this is a pack for. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(MedicinalProductPackaged, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPackaged, self).elementProperties() + js.extend([ + ("batchIdentifier", "batchIdentifier", MedicinalProductPackagedBatchIdentifier, True, None, False), + ("description", "description", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("legalStatusOfSupply", "legalStatusOfSupply", codeableconcept.CodeableConcept, False, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, True, None, False), + ("marketingAuthorization", "marketingAuthorization", fhirreference.FHIRReference, False, None, False), + ("marketingStatus", "marketingStatus", marketingstatus.MarketingStatus, True, None, False), + ("packageItem", "packageItem", MedicinalProductPackagedPackageItem, True, None, True), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductPackagedBatchIdentifier(backboneelement.BackboneElement): + """ Batch numbering. + """ + + resource_type = "MedicinalProductPackagedBatchIdentifier" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.immediatePackaging = None + """ A number appearing on the immediate packaging (and not the outer + packaging). + Type `Identifier` (represented as `dict` in JSON). """ + + self.outerPackaging = None + """ A number appearing on the outer packaging of a specific batch. + Type `Identifier` (represented as `dict` in JSON). """ + + super(MedicinalProductPackagedBatchIdentifier, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPackagedBatchIdentifier, self).elementProperties() + js.extend([ + ("immediatePackaging", "immediatePackaging", identifier.Identifier, False, None, False), + ("outerPackaging", "outerPackaging", identifier.Identifier, False, None, True), + ]) + return js + + +class MedicinalProductPackagedPackageItem(backboneelement.BackboneElement): + """ A packaging item, as a contained for medicine, possibly with other + packaging items within. + """ + + resource_type = "MedicinalProductPackagedPackageItem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.alternateMaterial = None + """ A possible alternate material for the packaging. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.device = None + """ A device accompanying a medicinal product. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Including possibly Data Carrier Identifier. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.manufacturedItem = None + """ The manufactured item as contained in the packaged medicinal + product. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.manufacturer = None + """ Manufacturer of this Package Item. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.material = None + """ Material type of the package item. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.otherCharacteristics = None + """ Other codeable characteristics. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.packageItem = None + """ Allows containers within containers. + List of `MedicinalProductPackagedPackageItem` items (represented as `dict` in JSON). """ + + self.physicalCharacteristics = None + """ Dimensions, color etc.. + Type `ProdCharacteristic` (represented as `dict` in JSON). """ + + self.quantity = None + """ The quantity of this package in the medicinal product, at the + current level of packaging. The outermost is always 1. + Type `Quantity` (represented as `dict` in JSON). """ + + self.shelfLifeStorage = None + """ Shelf Life and storage information. + List of `ProductShelfLife` items (represented as `dict` in JSON). """ + + self.type = None + """ The physical type of the container of the medicine. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductPackagedPackageItem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPackagedPackageItem, self).elementProperties() + js.extend([ + ("alternateMaterial", "alternateMaterial", codeableconcept.CodeableConcept, True, None, False), + ("device", "device", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("manufacturedItem", "manufacturedItem", fhirreference.FHIRReference, True, None, False), + ("manufacturer", "manufacturer", fhirreference.FHIRReference, True, None, False), + ("material", "material", codeableconcept.CodeableConcept, True, None, False), + ("otherCharacteristics", "otherCharacteristics", codeableconcept.CodeableConcept, True, None, False), + ("packageItem", "packageItem", MedicinalProductPackagedPackageItem, True, None, False), + ("physicalCharacteristics", "physicalCharacteristics", prodcharacteristic.ProdCharacteristic, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, True), + ("shelfLifeStorage", "shelfLifeStorage", productshelflife.ProductShelfLife, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import marketingstatus +except ImportError: + marketingstatus = sys.modules[__package__ + '.marketingstatus'] +try: + from . import prodcharacteristic +except ImportError: + prodcharacteristic = sys.modules[__package__ + '.prodcharacteristic'] +try: + from . import productshelflife +except ImportError: + productshelflife = sys.modules[__package__ + '.productshelflife'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/medicinalproductpackaged_tests.py b/fhirclient/models/medicinalproductpackaged_tests.py new file mode 100644 index 000000000..4fa5bf77e --- /dev/null +++ b/fhirclient/models/medicinalproductpackaged_tests.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductpackaged +from .fhirdate import FHIRDate + + +class MedicinalProductPackagedTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductPackaged", js["resourceType"]) + return medicinalproductpackaged.MedicinalProductPackaged(js) + + def testMedicinalProductPackaged1(self): + inst = self.instantiate_from("medicinalproductpackaged-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductPackaged instance") + self.implMedicinalProductPackaged1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductPackaged", js["resourceType"]) + inst2 = medicinalproductpackaged.MedicinalProductPackaged(js) + self.implMedicinalProductPackaged1(inst2) + + def implMedicinalProductPackaged1(self, inst): + self.assertEqual(inst.batchIdentifier[0].outerPackaging.period.end.date, FHIRDate("2016-06-06").date) + self.assertEqual(inst.batchIdentifier[0].outerPackaging.period.end.as_json(), "2016-06-06") + self.assertEqual(inst.batchIdentifier[0].outerPackaging.system, "http://ema.europa.eu/example/baid1") + self.assertEqual(inst.batchIdentifier[0].outerPackaging.value, "AAF5699") + self.assertEqual(inst.description, "ALU-PVC/PVDC BLISTERS. CARTONS OF 10 FILM-COATED TABLETS. ") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://ema.europa.eu/example/pcid") + self.assertEqual(inst.identifier[0].value, "{PCID}") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.packageItem[0].material[0].coding[0].code, "PVC") + self.assertEqual(inst.packageItem[0].material[0].coding[0].system, "http://ema.europa.eu/example/packageItemContainerMaterial") + self.assertEqual(inst.packageItem[0].material[1].coding[0].code, "PVDC") + self.assertEqual(inst.packageItem[0].material[1].coding[0].system, "http://ema.europa.eu/example/packageItemContainerMaterial") + self.assertEqual(inst.packageItem[0].material[2].coding[0].code, "alu") + self.assertEqual(inst.packageItem[0].material[2].coding[0].system, "http://ema.europa.eu/example/packageItemContainerMaterial") + self.assertEqual(inst.packageItem[0].packageItem[0].material[0].coding[0].code, "Paperboard") + self.assertEqual(inst.packageItem[0].packageItem[0].material[0].coding[0].system, "http://ema.europa.eu/example/packageItemContainerMaterial") + self.assertEqual(inst.packageItem[0].packageItem[0].physicalCharacteristics.height.unit, "mm") + self.assertEqual(inst.packageItem[0].packageItem[0].physicalCharacteristics.height.value, 125) + self.assertEqual(inst.packageItem[0].packageItem[0].physicalCharacteristics.width.unit, "mm") + self.assertEqual(inst.packageItem[0].packageItem[0].physicalCharacteristics.width.value, 45) + self.assertEqual(inst.packageItem[0].packageItem[0].quantity.unit, "1") + self.assertEqual(inst.packageItem[0].packageItem[0].quantity.value, 1) + self.assertEqual(inst.packageItem[0].packageItem[0].shelfLifeStorage[0].period.unit, "a") + self.assertEqual(inst.packageItem[0].packageItem[0].shelfLifeStorage[0].period.value, 3) + self.assertEqual(inst.packageItem[0].packageItem[0].shelfLifeStorage[0].specialPrecautionsForStorage[0].coding[0].code, "Thismedicinalproductdoesnotrequireanyspecialstoragecondition.") + self.assertEqual(inst.packageItem[0].packageItem[0].shelfLifeStorage[0].specialPrecautionsForStorage[0].coding[0].system, "http://ema.europa.eu/example/specialprecautionsforstorage") + self.assertEqual(inst.packageItem[0].packageItem[0].shelfLifeStorage[0].type.coding[0].code, "ShelfLifeofPackagedMedicinalProduct") + self.assertEqual(inst.packageItem[0].packageItem[0].shelfLifeStorage[0].type.coding[0].system, "http://ema.europa.eu/example/shelfLifeTypePlaceHolder") + self.assertEqual(inst.packageItem[0].packageItem[0].type.coding[0].code, "Blister") + self.assertEqual(inst.packageItem[0].packageItem[0].type.coding[0].system, "http://ema.europa.eu/example/packageitemcontainertype") + self.assertEqual(inst.packageItem[0].physicalCharacteristics.depth.unit, "mm") + self.assertEqual(inst.packageItem[0].physicalCharacteristics.depth.value, 23.5) + self.assertEqual(inst.packageItem[0].physicalCharacteristics.height.unit, "mm") + self.assertEqual(inst.packageItem[0].physicalCharacteristics.height.value, 50) + self.assertEqual(inst.packageItem[0].physicalCharacteristics.width.unit, "mm") + self.assertEqual(inst.packageItem[0].physicalCharacteristics.width.value, 136) + self.assertEqual(inst.packageItem[0].quantity.unit, "1") + self.assertEqual(inst.packageItem[0].quantity.value, 1) + self.assertEqual(inst.packageItem[0].type.coding[0].code, "Carton") + self.assertEqual(inst.packageItem[0].type.coding[0].system, "http://ema.europa.eu/example/packageitemcontainertype") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/medicinalproductpharmaceutical.py b/fhirclient/models/medicinalproductpharmaceutical.py new file mode 100644 index 000000000..b4f9363d0 --- /dev/null +++ b/fhirclient/models/medicinalproductpharmaceutical.py @@ -0,0 +1,271 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductPharmaceutical) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductPharmaceutical(domainresource.DomainResource): + """ A pharmaceutical product described in terms of its composition and dose + form. + """ + + resource_type = "MedicinalProductPharmaceutical" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.administrableDoseForm = None + """ The administrable dose form, after necessary reconstitution. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.characteristics = None + """ Characteristics e.g. a products onset of action. + List of `MedicinalProductPharmaceuticalCharacteristics` items (represented as `dict` in JSON). """ + + self.device = None + """ Accompanying device. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.identifier = None + """ An identifier for the pharmaceutical medicinal product. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.ingredient = None + """ Ingredient. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.routeOfAdministration = None + """ The path by which the pharmaceutical product is taken into or makes + contact with the body. + List of `MedicinalProductPharmaceuticalRouteOfAdministration` items (represented as `dict` in JSON). """ + + self.unitOfPresentation = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductPharmaceutical, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPharmaceutical, self).elementProperties() + js.extend([ + ("administrableDoseForm", "administrableDoseForm", codeableconcept.CodeableConcept, False, None, True), + ("characteristics", "characteristics", MedicinalProductPharmaceuticalCharacteristics, True, None, False), + ("device", "device", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("ingredient", "ingredient", fhirreference.FHIRReference, True, None, False), + ("routeOfAdministration", "routeOfAdministration", MedicinalProductPharmaceuticalRouteOfAdministration, True, None, True), + ("unitOfPresentation", "unitOfPresentation", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class MedicinalProductPharmaceuticalCharacteristics(backboneelement.BackboneElement): + """ Characteristics e.g. a products onset of action. + """ + + resource_type = "MedicinalProductPharmaceuticalCharacteristics" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ A coded characteristic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.status = None + """ The status of characteristic e.g. assigned or pending. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductPharmaceuticalCharacteristics, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPharmaceuticalCharacteristics, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("status", "status", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class MedicinalProductPharmaceuticalRouteOfAdministration(backboneelement.BackboneElement): + """ The path by which the pharmaceutical product is taken into or makes contact + with the body. + """ + + resource_type = "MedicinalProductPharmaceuticalRouteOfAdministration" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Coded expression for the route. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.firstDose = None + """ The first dose (dose quantity) administered in humans can be + specified, for a product under investigation, using a numerical + value and its unit of measurement. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxDosePerDay = None + """ The maximum dose per day (maximum dose quantity to be administered + in any one 24-h period) that can be administered as per the + protocol referenced in the clinical trial authorisation. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxDosePerTreatmentPeriod = None + """ The maximum dose per treatment period that can be administered as + per the protocol referenced in the clinical trial authorisation. + Type `Ratio` (represented as `dict` in JSON). """ + + self.maxSingleDose = None + """ The maximum single dose that can be administered as per the + protocol of a clinical trial can be specified using a numerical + value and its unit of measurement. + Type `Quantity` (represented as `dict` in JSON). """ + + self.maxTreatmentPeriod = None + """ The maximum treatment period during which an Investigational + Medicinal Product can be administered as per the protocol + referenced in the clinical trial authorisation. + Type `Duration` (represented as `dict` in JSON). """ + + self.targetSpecies = None + """ A species for which this route applies. + List of `MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies` items (represented as `dict` in JSON). """ + + super(MedicinalProductPharmaceuticalRouteOfAdministration, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPharmaceuticalRouteOfAdministration, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("firstDose", "firstDose", quantity.Quantity, False, None, False), + ("maxDosePerDay", "maxDosePerDay", quantity.Quantity, False, None, False), + ("maxDosePerTreatmentPeriod", "maxDosePerTreatmentPeriod", ratio.Ratio, False, None, False), + ("maxSingleDose", "maxSingleDose", quantity.Quantity, False, None, False), + ("maxTreatmentPeriod", "maxTreatmentPeriod", duration.Duration, False, None, False), + ("targetSpecies", "targetSpecies", MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies, True, None, False), + ]) + return js + + +class MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies(backboneelement.BackboneElement): + """ A species for which this route applies. + """ + + resource_type = "MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Coded expression for the species. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.withdrawalPeriod = None + """ A species specific time during which consumption of animal product + is not appropriate. + List of `MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod` items (represented as `dict` in JSON). """ + + super(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("withdrawalPeriod", "withdrawalPeriod", MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod, True, None, False), + ]) + return js + + +class MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod(backboneelement.BackboneElement): + """ A species specific time during which consumption of animal product is not + appropriate. + """ + + resource_type = "MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.supportingInformation = None + """ Extra information about the withdrawal period. + Type `str`. """ + + self.tissue = None + """ Coded expression for the type of tissue for which the withdrawal + period applues, e.g. meat, milk. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ A value for the time. + Type `Quantity` (represented as `dict` in JSON). """ + + super(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriod, self).elementProperties() + js.extend([ + ("supportingInformation", "supportingInformation", str, False, None, False), + ("tissue", "tissue", codeableconcept.CodeableConcept, False, None, True), + ("value", "value", quantity.Quantity, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/medicinalproductpharmaceutical_tests.py b/fhirclient/models/medicinalproductpharmaceutical_tests.py new file mode 100644 index 000000000..1d7376a7f --- /dev/null +++ b/fhirclient/models/medicinalproductpharmaceutical_tests.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductpharmaceutical +from .fhirdate import FHIRDate + + +class MedicinalProductPharmaceuticalTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductPharmaceutical", js["resourceType"]) + return medicinalproductpharmaceutical.MedicinalProductPharmaceutical(js) + + def testMedicinalProductPharmaceutical1(self): + inst = self.instantiate_from("medicinalproductpharmaceutical-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductPharmaceutical instance") + self.implMedicinalProductPharmaceutical1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductPharmaceutical", js["resourceType"]) + inst2 = medicinalproductpharmaceutical.MedicinalProductPharmaceutical(js) + self.implMedicinalProductPharmaceutical1(inst2) + + def implMedicinalProductPharmaceutical1(self, inst): + self.assertEqual(inst.administrableDoseForm.coding[0].code, "Film-coatedtablet") + self.assertEqual(inst.administrableDoseForm.coding[0].system, "http://ema.europa.eu/example/administrabledoseform") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://ema.europa.eu/example/phpididentifiersets") + self.assertEqual(inst.identifier[0].value, "{PhPID}") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.routeOfAdministration[0].code.coding[0].code, "OralUse") + self.assertEqual(inst.routeOfAdministration[0].code.coding[0].system, "http://ema.europa.eu/example/routeofadministration") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.unitOfPresentation.coding[0].code, "Tablet") + self.assertEqual(inst.unitOfPresentation.coding[0].system, "http://ema.europa.eu/example/unitofpresentation") + diff --git a/fhirclient/models/medicinalproductundesirableeffect.py b/fhirclient/models/medicinalproductundesirableeffect.py new file mode 100644 index 000000000..6b9b8119d --- /dev/null +++ b/fhirclient/models/medicinalproductundesirableeffect.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicinalProductUndesirableEffect) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class MedicinalProductUndesirableEffect(domainresource.DomainResource): + """ MedicinalProductUndesirableEffect. + + Describe the undesirable effects of the medicinal product. + """ + + resource_type = "MedicinalProductUndesirableEffect" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.classification = None + """ Classification of the effect. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.frequencyOfOccurrence = None + """ The frequency of occurrence of the effect. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.population = None + """ The population group to which this applies. + List of `Population` items (represented as `dict` in JSON). """ + + self.subject = None + """ The medication for which this is an indication. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.symptomConditionEffect = None + """ The symptom, condition or undesirable effect. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MedicinalProductUndesirableEffect, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MedicinalProductUndesirableEffect, self).elementProperties() + js.extend([ + ("classification", "classification", codeableconcept.CodeableConcept, False, None, False), + ("frequencyOfOccurrence", "frequencyOfOccurrence", codeableconcept.CodeableConcept, False, None, False), + ("population", "population", population.Population, True, None, False), + ("subject", "subject", fhirreference.FHIRReference, True, None, False), + ("symptomConditionEffect", "symptomConditionEffect", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import population +except ImportError: + population = sys.modules[__package__ + '.population'] diff --git a/fhirclient/models/medicinalproductundesirableeffect_tests.py b/fhirclient/models/medicinalproductundesirableeffect_tests.py new file mode 100644 index 000000000..018715ea0 --- /dev/null +++ b/fhirclient/models/medicinalproductundesirableeffect_tests.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import medicinalproductundesirableeffect +from .fhirdate import FHIRDate + + +class MedicinalProductUndesirableEffectTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("MedicinalProductUndesirableEffect", js["resourceType"]) + return medicinalproductundesirableeffect.MedicinalProductUndesirableEffect(js) + + def testMedicinalProductUndesirableEffect1(self): + inst = self.instantiate_from("medicinalproductundesirableeffect-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MedicinalProductUndesirableEffect instance") + self.implMedicinalProductUndesirableEffect1(inst) + + js = inst.as_json() + self.assertEqual("MedicinalProductUndesirableEffect", js["resourceType"]) + inst2 = medicinalproductundesirableeffect.MedicinalProductUndesirableEffect(js) + self.implMedicinalProductUndesirableEffect1(inst2) + + def implMedicinalProductUndesirableEffect1(self, inst): + self.assertEqual(inst.classification.coding[0].code, "Bloodandlymphaticsystemdisorders") + self.assertEqual(inst.classification.coding[0].system, "http://ema.europa.eu/example/symptom-condition-effectclassification") + self.assertEqual(inst.frequencyOfOccurrence.coding[0].code, "Common") + self.assertEqual(inst.frequencyOfOccurrence.coding[0].system, "http://ema.europa.eu/example/frequencyofoccurrence") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.symptomConditionEffect.coding[0].code, "Anaemia") + self.assertEqual(inst.symptomConditionEffect.coding[0].system, "http://ema.europa.eu/example/undesirableeffectassymptom-condition-effect") + self.assertEqual(inst.symptomConditionEffect.text, "Prevention of\\nVTE in adult\\npatients who have\\nundergone\\nelective hip or\\nknee replacement\\nsurgery (VTEp)") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/messagedefinition.py b/fhirclient/models/messagedefinition.py index 071ec5909..965528a11 100644 --- a/fhirclient/models/messagedefinition.py +++ b/fhirclient/models/messagedefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MessageDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MessageDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -32,10 +32,10 @@ def __init__(self, jsondict=None, strict=True): self.base = None """ Definition this one is based on. - Type `FHIRReference` referencing `MessageDefinition` (represented as `dict` in JSON). """ + Type `str`. """ self.category = None - """ Consequence | Currency | Notification. + """ consequence | currency | notification. Type `str`. """ self.contact = None @@ -47,17 +47,21 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None """ Natural language description of the message definition. Type `str`. """ - self.event = None - """ Event type. + self.eventCoding = None + """ Event code or link to the EventDefinition. Type `Coding` (represented as `dict` in JSON). """ + self.eventUri = None + """ Event code or link to the EventDefinition. + Type `str`. """ + self.experimental = None """ For testing purposes, not real usage. Type `bool`. """ @@ -66,9 +70,13 @@ def __init__(self, jsondict=None, strict=True): """ Resource(s) that are the subject of the event. List of `MessageDefinitionFocus` items (represented as `dict` in JSON). """ + self.graph = None + """ Canonical reference to a GraphDefinition. + List of `str` items. """ + self.identifier = None - """ Additional identifier for the message definition. - Type `Identifier` (represented as `dict` in JSON). """ + """ Primary key for the message definition on a given server. + List of `Identifier` items (represented as `dict` in JSON). """ self.jurisdiction = None """ Intended jurisdiction for message definition (if applicable). @@ -80,7 +88,7 @@ def __init__(self, jsondict=None, strict=True): self.parent = None """ Protocol/workflow this is part of. - List of `FHIRReference` items referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ + List of `str` items. """ self.publisher = None """ Name of the publisher (organization or individual). @@ -92,11 +100,11 @@ def __init__(self, jsondict=None, strict=True): self.replaces = None """ Takes the place of. - List of `FHIRReference` items referencing `MessageDefinition` (represented as `dict` in JSON). """ + List of `str` items. """ self.responseRequired = None - """ Is a response required?. - Type `bool`. """ + """ always | on-error | never | on-success. + Type `str`. """ self.status = None """ draft | active | retired | unknown. @@ -107,11 +115,11 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this message definition (globally unique). + """ Business Identifier for a given MessageDefinition. Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -124,23 +132,25 @@ def elementProperties(self): js = super(MessageDefinition, self).elementProperties() js.extend([ ("allowedResponse", "allowedResponse", MessageDefinitionAllowedResponse, True, None, False), - ("base", "base", fhirreference.FHIRReference, False, None, False), + ("base", "base", str, False, None, False), ("category", "category", str, False, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, True), ("description", "description", str, False, None, False), - ("event", "event", coding.Coding, False, None, True), + ("eventCoding", "eventCoding", coding.Coding, False, "event", True), + ("eventUri", "eventUri", str, False, "event", True), ("experimental", "experimental", bool, False, None, False), ("focus", "focus", MessageDefinitionFocus, True, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("graph", "graph", str, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("name", "name", str, False, None, False), - ("parent", "parent", fhirreference.FHIRReference, True, None, False), + ("parent", "parent", str, True, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), - ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), - ("responseRequired", "responseRequired", bool, False, None, False), + ("replaces", "replaces", str, True, None, False), + ("responseRequired", "responseRequired", str, False, None, False), ("status", "status", str, False, None, True), ("title", "title", str, False, None, False), ("url", "url", str, False, None, False), @@ -171,7 +181,7 @@ def __init__(self, jsondict=None, strict=True): self.message = None """ Reference to allowed message definition response. - Type `FHIRReference` referencing `MessageDefinition` (represented as `dict` in JSON). """ + Type `str`. """ self.situation = None """ When should this response be used. @@ -182,7 +192,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(MessageDefinitionAllowedResponse, self).elementProperties() js.extend([ - ("message", "message", fhirreference.FHIRReference, False, None, True), + ("message", "message", str, False, None, True), ("situation", "situation", str, False, None, False), ]) return js @@ -220,7 +230,7 @@ def __init__(self, jsondict=None, strict=True): self.profile = None """ Profile that must be adhered to by focus. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + Type `str`. """ super(MessageDefinitionFocus, self).__init__(jsondict=jsondict, strict=strict) @@ -229,8 +239,8 @@ def elementProperties(self): js.extend([ ("code", "code", str, False, None, True), ("max", "max", str, False, None, False), - ("min", "min", int, False, None, False), - ("profile", "profile", fhirreference.FHIRReference, False, None, False), + ("min", "min", int, False, None, True), + ("profile", "profile", str, False, None, False), ]) return js @@ -252,10 +262,6 @@ def elementProperties(self): from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import identifier except ImportError: diff --git a/fhirclient/models/messagedefinition_tests.py b/fhirclient/models/messagedefinition_tests.py index 92068b22d..ac42936ad 100644 --- a/fhirclient/models/messagedefinition_tests.py +++ b/fhirclient/models/messagedefinition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,19 +32,18 @@ def testMessageDefinition1(self): self.implMessageDefinition1(inst2) def implMessageDefinition1(self, inst): - self.assertEqual(inst.category, "Notification") + self.assertEqual(inst.category, "notification") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org") self.assertEqual(inst.date.date, FHIRDate("2016-11-09").date) self.assertEqual(inst.date.as_json(), "2016-11-09") - self.assertEqual(inst.event.code, "communication-request") - self.assertEqual(inst.event.system, "http://hl7.org/fhir/message-events") + self.assertEqual(inst.eventCoding.code, "admin-notify") + self.assertEqual(inst.eventCoding.system, "http://example.org/fhir/message-events") self.assertTrue(inst.experimental) self.assertEqual(inst.id, "example") self.assertEqual(inst.name, "EXAMPLE") self.assertEqual(inst.publisher, "Health Level Seven, Int'l") - self.assertEqual(inst.purpose, "Defines a base example for other MessageDefintion instances.") - self.assertFalse(inst.responseRequired) + self.assertEqual(inst.purpose, "Defines a base example for other MessageDefinition instances.") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.div, "
Message definition base example
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/messageheader.py b/fhirclient/models/messageheader.py index 0d582e180..9940371c5 100644 --- a/fhirclient/models/messageheader.py +++ b/fhirclient/models/messageheader.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -29,7 +29,11 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ The source of the decision. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.definition = None + """ Link to the definition for this message. + Type `str`. """ self.destination = None """ Message destination application(s). @@ -37,61 +41,59 @@ def __init__(self, jsondict=None, strict=True): self.enterer = None """ The source of the data entry. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.event = None - """ Code for the event this message represents. + self.eventCoding = None + """ Code for the event this message represents or link to event + definition. Type `Coding` (represented as `dict` in JSON). """ + self.eventUri = None + """ Code for the event this message represents or link to event + definition. + Type `str`. """ + self.focus = None """ The actual content of the message. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.reason = None """ Cause of event. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.receiver = None - """ Intended "real-world" recipient for the data. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ - self.response = None """ If this is a reply to prior message. Type `MessageHeaderResponse` (represented as `dict` in JSON). """ self.responsible = None """ Final responsibility for event. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.sender = None """ Real world sender of the message. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.source = None """ Message source application. Type `MessageHeaderSource` (represented as `dict` in JSON). """ - self.timestamp = None - """ Time that the message was sent. - Type `FHIRDate` (represented as `str` in JSON). """ - super(MessageHeader, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(MessageHeader, self).elementProperties() js.extend([ ("author", "author", fhirreference.FHIRReference, False, None, False), + ("definition", "definition", str, False, None, False), ("destination", "destination", MessageHeaderDestination, True, None, False), ("enterer", "enterer", fhirreference.FHIRReference, False, None, False), - ("event", "event", coding.Coding, False, None, True), + ("eventCoding", "eventCoding", coding.Coding, False, "event", True), + ("eventUri", "eventUri", str, False, "event", True), ("focus", "focus", fhirreference.FHIRReference, True, None, False), ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), - ("receiver", "receiver", fhirreference.FHIRReference, False, None, False), ("response", "response", MessageHeaderResponse, False, None, False), ("responsible", "responsible", fhirreference.FHIRReference, False, None, False), ("sender", "sender", fhirreference.FHIRReference, False, None, False), ("source", "source", MessageHeaderSource, False, None, True), - ("timestamp", "timestamp", fhirdate.FHIRDate, False, None, True), ]) return js @@ -122,9 +124,13 @@ def __init__(self, jsondict=None, strict=True): """ Name of system. Type `str`. """ + self.receiver = None + """ Intended "real-world" recipient for the data. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.target = None """ Particular delivery destination within the destination. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(MessageHeaderDestination, self).__init__(jsondict=jsondict, strict=strict) @@ -133,6 +139,7 @@ def elementProperties(self): js.extend([ ("endpoint", "endpoint", str, False, None, True), ("name", "name", str, False, None, False), + ("receiver", "receiver", fhirreference.FHIRReference, False, None, False), ("target", "target", fhirreference.FHIRReference, False, None, False), ]) return js @@ -161,7 +168,7 @@ def __init__(self, jsondict=None, strict=True): self.details = None """ Specific list of hints/warnings/errors. - Type `FHIRReference` referencing `OperationOutcome` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ Id of original message. @@ -242,10 +249,6 @@ def elementProperties(self): from . import contactpoint except ImportError: contactpoint = sys.modules[__package__ + '.contactpoint'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] try: from . import fhirreference except ImportError: diff --git a/fhirclient/models/messageheader_tests.py b/fhirclient/models/messageheader_tests.py index c0dff3aa7..f16e4d6e5 100644 --- a/fhirclient/models/messageheader_tests.py +++ b/fhirclient/models/messageheader_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,13 +32,17 @@ def testMessageHeader1(self): self.implMessageHeader1(inst2) def implMessageHeader1(self, inst): + self.assertEqual(inst.definition, "http:////acme.com/ehr/fhir/messagedefinition/patientrequest") self.assertEqual(inst.destination[0].endpoint, "llp:10.11.12.14:5432") self.assertEqual(inst.destination[0].name, "Acme Message Gateway") - self.assertEqual(inst.event.code, "admin-notify") - self.assertEqual(inst.event.system, "http://hl7.org/fhir/message-events") + self.assertEqual(inst.eventCoding.code, "admin-notify") + self.assertEqual(inst.eventCoding.system, "http://example.org/fhir/message-events") self.assertEqual(inst.id, "1cbdfb97-5859-48a4-8301-d54eab818d68") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.reason.coding[0].code, "admit") - self.assertEqual(inst.reason.coding[0].system, "http://hl7.org/fhir/message-reasons-encounter") + self.assertEqual(inst.reason.coding[0].system, "http://terminology.hl7.org/CodeSystem/message-reasons-encounter") self.assertEqual(inst.response.code, "ok") self.assertEqual(inst.response.identifier, "5015fe84-8e76-4526-89d8-44b322e8d4fb") self.assertEqual(inst.source.contact.system, "phone") @@ -48,6 +52,4 @@ def implMessageHeader1(self, inst): self.assertEqual(inst.source.software, "FooBar Patient Manager") self.assertEqual(inst.source.version, "3.1.45.AABB") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.timestamp.date, FHIRDate("2012-01-04T09:10:14Z").date) - self.assertEqual(inst.timestamp.as_json(), "2012-01-04T09:10:14Z") diff --git a/fhirclient/models/meta.py b/fhirclient/models/meta.py index 008dfad45..dcad7467c 100644 --- a/fhirclient/models/meta.py +++ b/fhirclient/models/meta.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Meta) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Meta) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -11,8 +11,8 @@ class Meta(element.Element): """ Metadata about a resource. The metadata about a resource. This is content in the resource that is - maintained by the infrastructure. Changes to the content may not always be - associated with version changes to the resource. + maintained by the infrastructure. Changes to the content might not always + be associated with version changes to the resource. """ resource_type = "Meta" @@ -37,6 +37,10 @@ def __init__(self, jsondict=None, strict=True): """ Security Labels applied to this resource. List of `Coding` items (represented as `dict` in JSON). """ + self.source = None + """ Identifies where the resource comes from. + Type `str`. """ + self.tag = None """ Tags applied to this resource. List of `Coding` items (represented as `dict` in JSON). """ @@ -53,6 +57,7 @@ def elementProperties(self): ("lastUpdated", "lastUpdated", fhirdate.FHIRDate, False, None, False), ("profile", "profile", str, True, None, False), ("security", "security", coding.Coding, True, None, False), + ("source", "source", str, False, None, False), ("tag", "tag", coding.Coding, True, None, False), ("versionId", "versionId", str, False, None, False), ]) diff --git a/fhirclient/models/metadataresource.py b/fhirclient/models/metadataresource.py index afe388efc..174f94fb1 100644 --- a/fhirclient/models/metadataresource.py +++ b/fhirclient/models/metadataresource.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/MetadataResource) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MetadataResource) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -29,7 +29,7 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -61,11 +61,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this metadata resource (globally unique). + """ Canonical identifier for this metadata resource, represented as a + URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None diff --git a/fhirclient/models/sequence.py b/fhirclient/models/molecularsequence.py similarity index 56% rename from fhirclient/models/sequence.py rename to fhirclient/models/molecularsequence.py index 5355604f9..f881a1d06 100644 --- a/fhirclient/models/sequence.py +++ b/fhirclient/models/molecularsequence.py @@ -1,19 +1,19 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Sequence) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MolecularSequence) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource -class Sequence(domainresource.DomainResource): +class MolecularSequence(domainresource.DomainResource): """ Information about a biological sequence. Raw data describing a biological sequence. """ - resource_type = "Sequence" + resource_type = "MolecularSequence" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -31,7 +31,7 @@ def __init__(self, jsondict=None, strict=True): self.device = None """ The method for sequencing. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ Unique ID for this particular sequence. This is a FHIR-defined id. @@ -43,22 +43,22 @@ def __init__(self, jsondict=None, strict=True): self.patient = None """ Who and/or what this is about. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.performer = None """ Who should be responsible for test result. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.pointer = None """ Pointer to next atomic sequence. - List of `FHIRReference` items referencing `Sequence` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.quality = None """ An set of value as quality of sequence. - List of `SequenceQuality` items (represented as `dict` in JSON). """ + List of `MolecularSequenceQuality` items (represented as `dict` in JSON). """ self.quantity = None - """ The number of copies of the seqeunce of interest. (RNASeq). + """ The number of copies of the sequence of interest. (RNASeq). Type `Quantity` (represented as `dict` in JSON). """ self.readCoverage = None @@ -68,16 +68,20 @@ def __init__(self, jsondict=None, strict=True): self.referenceSeq = None """ A sequence used as reference. - Type `SequenceReferenceSeq` (represented as `dict` in JSON). """ + Type `MolecularSequenceReferenceSeq` (represented as `dict` in JSON). """ self.repository = None """ External repository which contains detailed report related with observedSeq in this resource. - List of `SequenceRepository` items (represented as `dict` in JSON). """ + List of `MolecularSequenceRepository` items (represented as `dict` in JSON). """ self.specimen = None """ Specimen used for sequencing. - Type `FHIRReference` referencing `Specimen` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.structureVariant = None + """ Structural variant. + List of `MolecularSequenceStructureVariant` items (represented as `dict` in JSON). """ self.type = None """ aa | dna | rna. @@ -85,12 +89,12 @@ def __init__(self, jsondict=None, strict=True): self.variant = None """ Variant in sequence. - List of `SequenceVariant` items (represented as `dict` in JSON). """ + List of `MolecularSequenceVariant` items (represented as `dict` in JSON). """ - super(Sequence, self).__init__(jsondict=jsondict, strict=strict) + super(MolecularSequence, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(Sequence, self).elementProperties() + js = super(MolecularSequence, self).elementProperties() js.extend([ ("coordinateSystem", "coordinateSystem", int, False, None, True), ("device", "device", fhirreference.FHIRReference, False, None, False), @@ -99,21 +103,22 @@ def elementProperties(self): ("patient", "patient", fhirreference.FHIRReference, False, None, False), ("performer", "performer", fhirreference.FHIRReference, False, None, False), ("pointer", "pointer", fhirreference.FHIRReference, True, None, False), - ("quality", "quality", SequenceQuality, True, None, False), + ("quality", "quality", MolecularSequenceQuality, True, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ("readCoverage", "readCoverage", int, False, None, False), - ("referenceSeq", "referenceSeq", SequenceReferenceSeq, False, None, False), - ("repository", "repository", SequenceRepository, True, None, False), + ("referenceSeq", "referenceSeq", MolecularSequenceReferenceSeq, False, None, False), + ("repository", "repository", MolecularSequenceRepository, True, None, False), ("specimen", "specimen", fhirreference.FHIRReference, False, None, False), + ("structureVariant", "structureVariant", MolecularSequenceStructureVariant, True, None, False), ("type", "type", str, False, None, False), - ("variant", "variant", SequenceVariant, True, None, False), + ("variant", "variant", MolecularSequenceVariant, True, None, False), ]) return js from . import backboneelement -class SequenceQuality(backboneelement.BackboneElement): +class MolecularSequenceQuality(backboneelement.BackboneElement): """ An set of value as quality of sequence. An experimental feature attribute that defines the quality of the feature @@ -121,7 +126,7 @@ class SequenceQuality(backboneelement.BackboneElement): ww.sequenceontology.org/browser/current_svn/term/SO:0001686)). """ - resource_type = "SequenceQuality" + resource_type = "MolecularSequenceQuality" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -164,6 +169,10 @@ def __init__(self, jsondict=None, strict=True): """ Recall of comparison. Type `float`. """ + self.roc = None + """ Receiver Operator Characteristic (ROC) Curve. + Type `MolecularSequenceQualityRoc` (represented as `dict` in JSON). """ + self.score = None """ Quality score for the comparison. Type `Quantity` (represented as `dict` in JSON). """ @@ -188,10 +197,10 @@ def __init__(self, jsondict=None, strict=True): """ indel | snp | unknown. Type `str`. """ - super(SequenceQuality, self).__init__(jsondict=jsondict, strict=strict) + super(MolecularSequenceQuality, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(SequenceQuality, self).elementProperties() + js = super(MolecularSequenceQuality, self).elementProperties() js.extend([ ("end", "end", int, False, None, False), ("fScore", "fScore", float, False, None, False), @@ -201,6 +210,7 @@ def elementProperties(self): ("queryFP", "queryFP", float, False, None, False), ("queryTP", "queryTP", float, False, None, False), ("recall", "recall", float, False, None, False), + ("roc", "roc", MolecularSequenceQualityRoc, False, None, False), ("score", "score", quantity.Quantity, False, None, False), ("standardSequence", "standardSequence", codeableconcept.CodeableConcept, False, None, False), ("start", "start", int, False, None, False), @@ -211,14 +221,75 @@ def elementProperties(self): return js -class SequenceReferenceSeq(backboneelement.BackboneElement): +class MolecularSequenceQualityRoc(backboneelement.BackboneElement): + """ Receiver Operator Characteristic (ROC) Curve. + + Receiver Operator Characteristic (ROC) Curve to give + sensitivity/specificity tradeoff. + """ + + resource_type = "MolecularSequenceQualityRoc" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.fMeasure = None + """ FScore of the GQ score. + List of `float` items. """ + + self.numFN = None + """ Roc score false negative numbers. + List of `int` items. """ + + self.numFP = None + """ Roc score false positive numbers. + List of `int` items. """ + + self.numTP = None + """ Roc score true positive numbers. + List of `int` items. """ + + self.precision = None + """ Precision of the GQ score. + List of `float` items. """ + + self.score = None + """ Genotype quality score. + List of `int` items. """ + + self.sensitivity = None + """ Sensitivity of the GQ score. + List of `float` items. """ + + super(MolecularSequenceQualityRoc, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MolecularSequenceQualityRoc, self).elementProperties() + js.extend([ + ("fMeasure", "fMeasure", float, True, None, False), + ("numFN", "numFN", int, True, None, False), + ("numFP", "numFP", int, True, None, False), + ("numTP", "numTP", int, True, None, False), + ("precision", "precision", float, True, None, False), + ("score", "score", int, True, None, False), + ("sensitivity", "sensitivity", float, True, None, False), + ]) + return js + + +class MolecularSequenceReferenceSeq(backboneelement.BackboneElement): """ A sequence used as reference. A sequence that is used as a reference to describe variants that are present in a sequence analyzed. """ - resource_type = "SequenceReferenceSeq" + resource_type = "MolecularSequenceReferenceSeq" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -237,21 +308,25 @@ def __init__(self, jsondict=None, strict=True): e.g. 'GRCh 37'. Type `str`. """ + self.orientation = None + """ sense | antisense. + Type `str`. """ + self.referenceSeqId = None """ Reference identifier. Type `CodeableConcept` (represented as `dict` in JSON). """ self.referenceSeqPointer = None - """ A Pointer to another Sequence entity as reference sequence. - Type `FHIRReference` referencing `Sequence` (represented as `dict` in JSON). """ + """ A pointer to another MolecularSequence entity as reference sequence. + Type `FHIRReference` (represented as `dict` in JSON). """ self.referenceSeqString = None """ A string to represent reference sequence. Type `str`. """ self.strand = None - """ Directionality of DNA ( +1/-1). - Type `int`. """ + """ watson | crick. + Type `str`. """ self.windowEnd = None """ End position of the window on the reference sequence. @@ -261,24 +336,25 @@ def __init__(self, jsondict=None, strict=True): """ Start position of the window on the reference sequence. Type `int`. """ - super(SequenceReferenceSeq, self).__init__(jsondict=jsondict, strict=strict) + super(MolecularSequenceReferenceSeq, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(SequenceReferenceSeq, self).elementProperties() + js = super(MolecularSequenceReferenceSeq, self).elementProperties() js.extend([ ("chromosome", "chromosome", codeableconcept.CodeableConcept, False, None, False), ("genomeBuild", "genomeBuild", str, False, None, False), + ("orientation", "orientation", str, False, None, False), ("referenceSeqId", "referenceSeqId", codeableconcept.CodeableConcept, False, None, False), ("referenceSeqPointer", "referenceSeqPointer", fhirreference.FHIRReference, False, None, False), ("referenceSeqString", "referenceSeqString", str, False, None, False), - ("strand", "strand", int, False, None, False), - ("windowEnd", "windowEnd", int, False, None, True), - ("windowStart", "windowStart", int, False, None, True), + ("strand", "strand", str, False, None, False), + ("windowEnd", "windowEnd", int, False, None, False), + ("windowStart", "windowStart", int, False, None, False), ]) return js -class SequenceRepository(backboneelement.BackboneElement): +class MolecularSequenceRepository(backboneelement.BackboneElement): """ External repository which contains detailed report related with observedSeq in this resource. @@ -286,7 +362,7 @@ class SequenceRepository(backboneelement.BackboneElement): target's observedSeq or records related with target's observedSeq. """ - resource_type = "SequenceRepository" + resource_type = "MolecularSequenceRepository" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -320,10 +396,10 @@ def __init__(self, jsondict=None, strict=True): """ Id of the variantset that used to call for variantset in repository. Type `str`. """ - super(SequenceRepository, self).__init__(jsondict=jsondict, strict=strict) + super(MolecularSequenceRepository, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(SequenceRepository, self).elementProperties() + js = super(MolecularSequenceRepository, self).elementProperties() js.extend([ ("datasetId", "datasetId", str, False, None, False), ("name", "name", str, False, None, False), @@ -335,7 +411,123 @@ def elementProperties(self): return js -class SequenceVariant(backboneelement.BackboneElement): +class MolecularSequenceStructureVariant(backboneelement.BackboneElement): + """ Structural variant. + + Information about chromosome structure variation. + """ + + resource_type = "MolecularSequenceStructureVariant" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.exact = None + """ Does the structural variant have base pair resolution breakpoints?. + Type `bool`. """ + + self.inner = None + """ Structural variant inner. + Type `MolecularSequenceStructureVariantInner` (represented as `dict` in JSON). """ + + self.length = None + """ Structural variant length. + Type `int`. """ + + self.outer = None + """ Structural variant outer. + Type `MolecularSequenceStructureVariantOuter` (represented as `dict` in JSON). """ + + self.variantType = None + """ Structural variant change type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(MolecularSequenceStructureVariant, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MolecularSequenceStructureVariant, self).elementProperties() + js.extend([ + ("exact", "exact", bool, False, None, False), + ("inner", "inner", MolecularSequenceStructureVariantInner, False, None, False), + ("length", "length", int, False, None, False), + ("outer", "outer", MolecularSequenceStructureVariantOuter, False, None, False), + ("variantType", "variantType", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class MolecularSequenceStructureVariantInner(backboneelement.BackboneElement): + """ Structural variant inner. + """ + + resource_type = "MolecularSequenceStructureVariantInner" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.end = None + """ Structural variant inner end. + Type `int`. """ + + self.start = None + """ Structural variant inner start. + Type `int`. """ + + super(MolecularSequenceStructureVariantInner, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MolecularSequenceStructureVariantInner, self).elementProperties() + js.extend([ + ("end", "end", int, False, None, False), + ("start", "start", int, False, None, False), + ]) + return js + + +class MolecularSequenceStructureVariantOuter(backboneelement.BackboneElement): + """ Structural variant outer. + """ + + resource_type = "MolecularSequenceStructureVariantOuter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.end = None + """ Structural variant outer end. + Type `int`. """ + + self.start = None + """ Structural variant outer start. + Type `int`. """ + + super(MolecularSequenceStructureVariantOuter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(MolecularSequenceStructureVariantOuter, self).elementProperties() + js.extend([ + ("end", "end", int, False, None, False), + ("start", "start", int, False, None, False), + ]) + return js + + +class MolecularSequenceVariant(backboneelement.BackboneElement): """ Variant in sequence. The definition of variant here originates from Sequence ontology ([variant_ @@ -345,7 +537,7 @@ class SequenceVariant(backboneelement.BackboneElement): segment variation with the assist of CIGAR string. """ - resource_type = "SequenceVariant" + resource_type = "MolecularSequenceVariant" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -378,12 +570,12 @@ def __init__(self, jsondict=None, strict=True): self.variantPointer = None """ Pointer to observed variant information. - Type `FHIRReference` referencing `Observation` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - super(SequenceVariant, self).__init__(jsondict=jsondict, strict=strict) + super(MolecularSequenceVariant, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(SequenceVariant, self).elementProperties() + js = super(MolecularSequenceVariant, self).elementProperties() js.extend([ ("cigar", "cigar", str, False, None, False), ("end", "end", int, False, None, False), diff --git a/fhirclient/models/sequence_tests.py b/fhirclient/models/molecularsequence_tests.py similarity index 55% rename from fhirclient/models/sequence_tests.py rename to fhirclient/models/molecularsequence_tests.py index c9da48314..49da9068b 100644 --- a/fhirclient/models/sequence_tests.py +++ b/fhirclient/models/molecularsequence_tests.py @@ -1,153 +1,99 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os import io import unittest import json -from . import sequence +from . import molecularsequence from .fhirdate import FHIRDate -class SequenceTests(unittest.TestCase): +class MolecularSequenceTests(unittest.TestCase): def instantiate_from(self, filename): datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: js = json.load(handle) - self.assertEqual("Sequence", js["resourceType"]) - return sequence.Sequence(js) + self.assertEqual("MolecularSequence", js["resourceType"]) + return molecularsequence.MolecularSequence(js) - def testSequence1(self): - inst = self.instantiate_from("coord-0base-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence1(inst) + def testMolecularSequence1(self): + inst = self.instantiate_from("sequence-genetics-example-breastcancer.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence1(inst) js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence1(inst2) + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence1(inst2) - def implSequence1(self, inst): + def implMolecularSequence1(self, inst): self.assertEqual(inst.coordinateSystem, 0) - self.assertEqual(inst.id, "coord-0-base") - self.assertEqual(inst.observedSeq, "ACATGGTAGC") - self.assertEqual(inst.referenceSeq.referenceSeqString, "ACGTAGTC") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 8) - self.assertEqual(inst.referenceSeq.windowStart, 0) + self.assertEqual(inst.id, "breastcancer") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NM_000059.3") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].display, "Homo sapiens BRCA2, DNA repair associated (BRCA2), mRNA") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore/") + self.assertEqual(inst.referenceSeq.windowEnd, 101499444) + self.assertEqual(inst.referenceSeq.windowStart, 101488058) self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "dna") - self.assertEqual(inst.variant[0].cigar, "3I") - self.assertEqual(inst.variant[0].end, 2) - self.assertEqual(inst.variant[0].observedAllele, "ATG") - self.assertEqual(inst.variant[0].referenceAllele, "-") - self.assertEqual(inst.variant[0].start, 2) - self.assertEqual(inst.variant[1].cigar, "1M") - self.assertEqual(inst.variant[1].end, 5) - self.assertEqual(inst.variant[1].observedAllele, "T") - self.assertEqual(inst.variant[1].referenceAllele, "A") - self.assertEqual(inst.variant[1].start, 4) - self.assertEqual(inst.variant[2].cigar, "1D") - self.assertEqual(inst.variant[2].end, 7) - self.assertEqual(inst.variant[2].observedAllele, "-") - self.assertEqual(inst.variant[2].referenceAllele, "T") - self.assertEqual(inst.variant[2].start, 6) - - def testSequence2(self): - inst = self.instantiate_from("coord-1base-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence2(inst) - - js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence2(inst2) - - def implSequence2(self, inst): - self.assertEqual(inst.coordinateSystem, 1) - self.assertEqual(inst.id, "coord-1-base") - self.assertEqual(inst.observedSeq, "ACATGGTAGC") - self.assertEqual(inst.referenceSeq.referenceSeqString, "ACGTAGTC") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 8) - self.assertEqual(inst.referenceSeq.windowStart, 1) - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "dna") - self.assertEqual(inst.variant[0].cigar, "3I") - self.assertEqual(inst.variant[0].end, 3) - self.assertEqual(inst.variant[0].observedAllele, "ATG") - self.assertEqual(inst.variant[0].referenceAllele, "-") - self.assertEqual(inst.variant[0].start, 2) - self.assertEqual(inst.variant[1].cigar, "3I") - self.assertEqual(inst.variant[1].end, 5) - self.assertEqual(inst.variant[1].observedAllele, "T") - self.assertEqual(inst.variant[1].referenceAllele, "A") - self.assertEqual(inst.variant[1].start, 5) - self.assertEqual(inst.variant[2].cigar, "1D") - self.assertEqual(inst.variant[2].end, 7) - self.assertEqual(inst.variant[2].observedAllele, "-") - self.assertEqual(inst.variant[2].referenceAllele, "T") - self.assertEqual(inst.variant[2].start, 7) + self.assertEqual(inst.type, "rna") + self.assertEqual(inst.variant[0].end, 32316187) + self.assertEqual(inst.variant[0].observedAllele, "A") + self.assertEqual(inst.variant[0].referenceAllele, "C") + self.assertEqual(inst.variant[0].start, 32316186) - def testSequence3(self): - inst = self.instantiate_from("sequence-example-fda-comparisons.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence3(inst) + def testMolecularSequence2(self): + inst = self.instantiate_from("sequence-graphic-example-1.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence2(inst) js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence3(inst2) + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence2(inst2) - def implSequence3(self, inst): - self.assertEqual(inst.coordinateSystem, 1) - self.assertEqual(inst.id, "fda-vcf-comparison") - self.assertEqual(inst.quality[0].end, 101770080) - self.assertEqual(inst.quality[0].fScore, 0.9823) - self.assertEqual(inst.quality[0].gtFP, 2186) - self.assertEqual(inst.quality[0].method.coding[0].code, "app-BqB9XZ8006ZZ2g5KzGXP3fpq") - self.assertEqual(inst.quality[0].method.coding[0].system, "https://precision.fda.gov/apps/") - self.assertEqual(inst.quality[0].method.text, "VCF Comparison") - self.assertEqual(inst.quality[0].precision, 0.9885) - self.assertEqual(inst.quality[0].queryFP, 1507) - self.assertEqual(inst.quality[0].score.value, 5.0) - self.assertEqual(inst.quality[0].standardSequence.coding[0].code, "file-BkZxBZ00bpJVk2q6x43b1YBx") - self.assertEqual(inst.quality[0].standardSequence.coding[0].system, "https://precision.fda.gov/files/") - self.assertEqual(inst.quality[0].start, 10453) - self.assertEqual(inst.quality[0].truthFN, 3168) - self.assertEqual(inst.quality[0].truthTP, 129481) - self.assertEqual(inst.quality[0].type, "unknown") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NC_000001.11") + def implMolecularSequence2(self, inst): + self.assertEqual(inst.coordinateSystem, 0) + self.assertEqual(inst.id, "graphic-example-1") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NC_000002.12") self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 101770080) - self.assertEqual(inst.referenceSeq.windowStart, 10453) - self.assertEqual(inst.repository[0].name, "FDA") - self.assertEqual(inst.repository[0].type, "login") - self.assertEqual(inst.repository[0].url, "https://precision.fda.gov/comparisons/1850") + self.assertEqual(inst.referenceSeq.strand, "watson") + self.assertEqual(inst.referenceSeq.windowEnd, 128273732) + self.assertEqual(inst.referenceSeq.windowStart, 128273724) self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.variant[0].end, 13117) - self.assertEqual(inst.variant[0].observedAllele, "T") - self.assertEqual(inst.variant[0].referenceAllele, "G") - self.assertEqual(inst.variant[0].start, 13116) + self.assertEqual(inst.type, "dna") + self.assertEqual(inst.variant[0].cigar, "1M") + self.assertEqual(inst.variant[0].end, 128273726) + self.assertEqual(inst.variant[0].observedAllele, "G") + self.assertEqual(inst.variant[0].referenceAllele, "T") + self.assertEqual(inst.variant[0].start, 128273725) - def testSequence4(self): + def testMolecularSequence3(self): inst = self.instantiate_from("sequence-example-fda-vcfeval.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence4(inst) + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence3(inst) js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence4(inst2) + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence3(inst2) - def implSequence4(self, inst): + def implMolecularSequence3(self, inst): self.assertEqual(inst.coordinateSystem, 1) self.assertEqual(inst.id, "fda-vcfeval-comparison") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.quality[0].end, 101770080) self.assertEqual(inst.quality[0].gtFP, 2186) self.assertEqual(inst.quality[0].method.coding[0].code, "app-BxfGF8j02pBZzZxbzZxP725P") @@ -178,7 +124,7 @@ def implSequence4(self, inst): self.assertEqual(inst.quality[1].type, "snp") self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NC_000001.11") self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) + self.assertEqual(inst.referenceSeq.strand, "watson") self.assertEqual(inst.referenceSeq.windowEnd, 101770080) self.assertEqual(inst.referenceSeq.windowStart, 10453) self.assertEqual(inst.repository[0].name, "FDA") @@ -190,19 +136,112 @@ def implSequence4(self, inst): self.assertEqual(inst.variant[0].referenceAllele, "G") self.assertEqual(inst.variant[0].start, 13116) - def testSequence5(self): + def testMolecularSequence4(self): + inst = self.instantiate_from("sequence-example-TPMT-one.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence4(inst) + + js = inst.as_json() + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence4(inst2) + + def implMolecularSequence4(self, inst): + self.assertEqual(inst.coordinateSystem, 1) + self.assertEqual(inst.id, "example-TPMT-one") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.observedSeq, "T-C-C-C-A-C-C-C") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NT_007592.15") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") + self.assertEqual(inst.referenceSeq.strand, "watson") + self.assertEqual(inst.referenceSeq.windowEnd, 18143955) + self.assertEqual(inst.referenceSeq.windowStart, 18130918) + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "dna") + self.assertEqual(inst.variant[0].end, 18139214) + self.assertEqual(inst.variant[0].observedAllele, "A") + self.assertEqual(inst.variant[0].referenceAllele, "G") + self.assertEqual(inst.variant[0].start, 18139214) + + def testMolecularSequence5(self): + inst = self.instantiate_from("sequence-example-pgx-2.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence5(inst) + + js = inst.as_json() + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence5(inst2) + + def implMolecularSequence5(self, inst): + self.assertEqual(inst.coordinateSystem, 0) + self.assertEqual(inst.id, "example-pgx-2") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.referenceSeq.orientation, "sense") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NG_007726.3") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") + self.assertEqual(inst.referenceSeq.strand, "watson") + self.assertEqual(inst.referenceSeq.windowEnd, 55227980) + self.assertEqual(inst.referenceSeq.windowStart, 55227970) + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "dna") + self.assertEqual(inst.variant[0].end, 55227979) + self.assertEqual(inst.variant[0].observedAllele, "G") + self.assertEqual(inst.variant[0].referenceAllele, "T") + self.assertEqual(inst.variant[0].start, 55227978) + + def testMolecularSequence6(self): + inst = self.instantiate_from("molecularsequence-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence6(inst) + + js = inst.as_json() + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence6(inst2) + + def implMolecularSequence6(self, inst): + self.assertEqual(inst.coordinateSystem, 0) + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NC_000009.11") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") + self.assertEqual(inst.referenceSeq.strand, "watson") + self.assertEqual(inst.referenceSeq.windowEnd, 22125510) + self.assertEqual(inst.referenceSeq.windowStart, 22125500) + self.assertEqual(inst.repository[0].name, "GA4GH API") + self.assertEqual(inst.repository[0].type, "openapi") + self.assertEqual(inst.repository[0].url, "http://grch37.rest.ensembl.org/ga4gh/variants/3:rs1333049?content-type=application/json") + self.assertEqual(inst.repository[0].variantsetId, "3:rs1333049") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "dna") + self.assertEqual(inst.variant[0].end, 22125504) + self.assertEqual(inst.variant[0].observedAllele, "C") + self.assertEqual(inst.variant[0].referenceAllele, "G") + self.assertEqual(inst.variant[0].start, 22125503) + + def testMolecularSequence7(self): inst = self.instantiate_from("sequence-example-fda.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence5(inst) + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence7(inst) js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence5(inst2) + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence7(inst2) - def implSequence5(self, inst): + def implMolecularSequence7(self, inst): self.assertEqual(inst.coordinateSystem, 1) self.assertEqual(inst.id, "fda-example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.quality[0].end, 101770080) self.assertEqual(inst.quality[0].fScore, 0.545551) self.assertEqual(inst.quality[0].gtFP, 2186) @@ -221,7 +260,7 @@ def implSequence5(self, inst): self.assertEqual(inst.quality[0].type, "snp") self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NC_000001.11") self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) + self.assertEqual(inst.referenceSeq.strand, "watson") self.assertEqual(inst.referenceSeq.windowEnd, 101770080) self.assertEqual(inst.referenceSeq.windowStart, 10453) self.assertEqual(inst.repository[0].name, "FDA") @@ -235,134 +274,92 @@ def implSequence5(self, inst): self.assertEqual(inst.variant[0].referenceAllele, "G") self.assertEqual(inst.variant[0].start, 13116) - def testSequence6(self): - inst = self.instantiate_from("sequence-example-pgx-1.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence6(inst) - - js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence6(inst2) - - def implSequence6(self, inst): - self.assertEqual(inst.coordinateSystem, 0) - self.assertEqual(inst.id, "example-pgx-1") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NG_007726.3") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 55227980) - self.assertEqual(inst.referenceSeq.windowStart, 55227970) - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "dna") - self.assertEqual(inst.variant[0].end, 55227977) - self.assertEqual(inst.variant[0].observedAllele, "G") - self.assertEqual(inst.variant[0].referenceAllele, "T") - self.assertEqual(inst.variant[0].start, 55227976) - - def testSequence7(self): - inst = self.instantiate_from("sequence-example-pgx-2.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence7(inst) - - js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence7(inst2) - - def implSequence7(self, inst): - self.assertEqual(inst.coordinateSystem, 0) - self.assertEqual(inst.id, "example-pgx-2") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NG_007726.3") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 55227980) - self.assertEqual(inst.referenceSeq.windowStart, 55227970) - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type, "dna") - self.assertEqual(inst.variant[0].end, 55227979) - self.assertEqual(inst.variant[0].observedAllele, "G") - self.assertEqual(inst.variant[0].referenceAllele, "T") - self.assertEqual(inst.variant[0].start, 55227978) - - def testSequence8(self): - inst = self.instantiate_from("sequence-example-TPMT-one.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence8(inst) + def testMolecularSequence8(self): + inst = self.instantiate_from("coord-1base-example.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence8(inst) js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence8(inst2) + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence8(inst2) - def implSequence8(self, inst): + def implMolecularSequence8(self, inst): self.assertEqual(inst.coordinateSystem, 1) - self.assertEqual(inst.id, "example-TPMT-one") - self.assertEqual(inst.observedSeq, "T-C-C-C-A-C-C-C") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NT_007592.15") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 18143955) - self.assertEqual(inst.referenceSeq.windowStart, 18130918) + self.assertEqual(inst.id, "coord-1-base") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.observedSeq, "ACATGGTAGC") + self.assertEqual(inst.referenceSeq.referenceSeqString, "ACGTAGTC") + self.assertEqual(inst.referenceSeq.strand, "watson") + self.assertEqual(inst.referenceSeq.windowEnd, 8) + self.assertEqual(inst.referenceSeq.windowStart, 1) self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type, "dna") - self.assertEqual(inst.variant[0].end, 18139214) - self.assertEqual(inst.variant[0].observedAllele, "A") - self.assertEqual(inst.variant[0].referenceAllele, "G") - self.assertEqual(inst.variant[0].start, 18139214) + self.assertEqual(inst.variant[0].cigar, "3I") + self.assertEqual(inst.variant[0].end, 3) + self.assertEqual(inst.variant[0].observedAllele, "ATG") + self.assertEqual(inst.variant[0].referenceAllele, "-") + self.assertEqual(inst.variant[0].start, 2) + self.assertEqual(inst.variant[1].cigar, "3I") + self.assertEqual(inst.variant[1].end, 5) + self.assertEqual(inst.variant[1].observedAllele, "T") + self.assertEqual(inst.variant[1].referenceAllele, "A") + self.assertEqual(inst.variant[1].start, 5) + self.assertEqual(inst.variant[2].cigar, "1D") + self.assertEqual(inst.variant[2].end, 7) + self.assertEqual(inst.variant[2].observedAllele, "-") + self.assertEqual(inst.variant[2].referenceAllele, "T") + self.assertEqual(inst.variant[2].start, 7) - def testSequence9(self): - inst = self.instantiate_from("sequence-example-TPMT-two.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence9(inst) + def testMolecularSequence9(self): + inst = self.instantiate_from("sequence-graphic-example-4.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence9(inst) js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence9(inst2) + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence9(inst2) - def implSequence9(self, inst): - self.assertEqual(inst.coordinateSystem, 1) - self.assertEqual(inst.id, "example-TPMT-two") - self.assertEqual(inst.observedSeq, "T-C-T-C-G-C-C-C") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NT_007592.15") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 18143955) - self.assertEqual(inst.referenceSeq.windowStart, 18130918) + def implMolecularSequence9(self, inst): + self.assertEqual(inst.coordinateSystem, 0) + self.assertEqual(inst.id, "graphic-example-4") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.referenceSeq.chromosome.coding[0].code, "2") + self.assertEqual(inst.referenceSeq.chromosome.coding[0].display, "chromosome 2") + self.assertEqual(inst.referenceSeq.chromosome.coding[0].system, "http://terminology.hl7.org/CodeSystem/chromosome-human") + self.assertEqual(inst.referenceSeq.genomeBuild, "GRCh 38") + self.assertEqual(inst.referenceSeq.strand, "watson") + self.assertEqual(inst.referenceSeq.windowEnd, 128273740) + self.assertEqual(inst.referenceSeq.windowStart, 128273736) self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type, "dna") - self.assertEqual(inst.variant[0].end, 18131012) - self.assertEqual(inst.variant[0].observedAllele, "T") - self.assertEqual(inst.variant[0].referenceAllele, "C") - self.assertEqual(inst.variant[0].start, 18131012) - def testSequence10(self): - inst = self.instantiate_from("sequence-example.json") - self.assertIsNotNone(inst, "Must have instantiated a Sequence instance") - self.implSequence10(inst) + def testMolecularSequence10(self): + inst = self.instantiate_from("sequence-graphic-example-5.json") + self.assertIsNotNone(inst, "Must have instantiated a MolecularSequence instance") + self.implMolecularSequence10(inst) js = inst.as_json() - self.assertEqual("Sequence", js["resourceType"]) - inst2 = sequence.Sequence(js) - self.implSequence10(inst2) + self.assertEqual("MolecularSequence", js["resourceType"]) + inst2 = molecularsequence.MolecularSequence(js) + self.implMolecularSequence10(inst2) - def implSequence10(self, inst): + def implMolecularSequence10(self, inst): self.assertEqual(inst.coordinateSystem, 0) - self.assertEqual(inst.id, "example") - self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NC_000009.11") + self.assertEqual(inst.id, "graphic-example-5") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].code, "NC_000002.12") self.assertEqual(inst.referenceSeq.referenceSeqId.coding[0].system, "http://www.ncbi.nlm.nih.gov/nuccore") - self.assertEqual(inst.referenceSeq.strand, 1) - self.assertEqual(inst.referenceSeq.windowEnd, 22125510) - self.assertEqual(inst.referenceSeq.windowStart, 22125500) - self.assertEqual(inst.repository[0].name, "GA4GH API") - self.assertEqual(inst.repository[0].type, "openapi") - self.assertEqual(inst.repository[0].url, "http://grch37.rest.ensembl.org/ga4gh/variants/3:rs1333049?content-type=application/json") - self.assertEqual(inst.repository[0].variantsetId, "3:rs1333049") + self.assertEqual(inst.referenceSeq.strand, "watson") + self.assertEqual(inst.referenceSeq.windowEnd, 128273736) + self.assertEqual(inst.referenceSeq.windowStart, 128273732) self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type, "dna") - self.assertEqual(inst.variant[0].end, 22125504) - self.assertEqual(inst.variant[0].observedAllele, "C") - self.assertEqual(inst.variant[0].referenceAllele, "G") - self.assertEqual(inst.variant[0].start, 22125503) diff --git a/fhirclient/models/money.py b/fhirclient/models/money.py index 4dfca6254..2d54db884 100644 --- a/fhirclient/models/money.py +++ b/fhirclient/models/money.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Money) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Money) on 2019-05-07. +# 2019, SMART Health IT. -from . import quantity +from . import element -class Money(quantity.Quantity): +class Money(element.Element): """ An amount of economic utility in some recognized currency. """ @@ -21,6 +21,22 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.currency = None + """ ISO 4217 Currency Code. + Type `str`. """ + + self.value = None + """ Numerical value (with implicit precision). + Type `float`. """ + super(Money, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Money, self).elementProperties() + js.extend([ + ("currency", "currency", str, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js diff --git a/fhirclient/models/namingsystem.py b/fhirclient/models/namingsystem.py index 6b052d611..6f283ef77 100644 --- a/fhirclient/models/namingsystem.py +++ b/fhirclient/models/namingsystem.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -30,7 +30,7 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -53,10 +53,6 @@ def __init__(self, jsondict=None, strict=True): """ Name of the publisher (organization or individual). Type `str`. """ - self.replacedBy = None - """ Use this instead. - Type `FHIRReference` referencing `NamingSystem` (represented as `dict` in JSON). """ - self.responsible = None """ Who maintains system namespace?. Type `str`. """ @@ -78,7 +74,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ super(NamingSystem, self).__init__(jsondict=jsondict, strict=strict) @@ -93,7 +89,6 @@ def elementProperties(self): ("kind", "kind", str, False, None, True), ("name", "name", str, False, None, True), ("publisher", "publisher", str, False, None, False), - ("replacedBy", "replacedBy", fhirreference.FHIRReference, False, None, False), ("responsible", "responsible", str, False, None, False), ("status", "status", str, False, None, True), ("type", "type", codeableconcept.CodeableConcept, False, None, False), @@ -170,10 +165,6 @@ def elementProperties(self): from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import period except ImportError: diff --git a/fhirclient/models/namingsystem_tests.py b/fhirclient/models/namingsystem_tests.py index 84d86fdb4..378dc8154 100644 --- a/fhirclient/models/namingsystem_tests.py +++ b/fhirclient/models/namingsystem_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,11 +37,14 @@ def implNamingSystem1(self, inst): self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7-australia.wikispaces.com/FHIR+Australia") self.assertEqual(inst.date.date, FHIRDate("2015-08-31").date) self.assertEqual(inst.date.as_json(), "2015-08-31") - self.assertEqual(inst.description, "Australian HI Identifier as established by relevant regulations etc") + self.assertEqual(inst.description, "Australian HI Identifier as established by relevant regulations etc.") self.assertEqual(inst.id, "example-id") self.assertEqual(inst.jurisdiction[0].coding[0].code, "AU") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") self.assertEqual(inst.kind, "identifier") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "Austalian Healthcare Identifier - Individual") self.assertEqual(inst.publisher, "HL7 Australia on behalf of NEHTA") self.assertEqual(inst.responsible, "HI Service Operator / NEHTA") @@ -49,7 +52,7 @@ def implNamingSystem1(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "NI") self.assertEqual(inst.type.coding[0].display, "National unique individual identifier") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v2/0203") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") self.assertEqual(inst.type.text, "IHI") self.assertEqual(inst.uniqueId[0].comment, "This value is used in Australian CDA documents") self.assertEqual(inst.uniqueId[0].type, "oid") @@ -62,7 +65,7 @@ def implNamingSystem1(self, inst): self.assertEqual(inst.usage, "Used in Australia for identifying patients") def testNamingSystem2(self): - inst = self.instantiate_from("namingsystem-example-replaced.json") + inst = self.instantiate_from("namingsystem-example.json") self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") self.implNamingSystem2(inst) @@ -72,29 +75,6 @@ def testNamingSystem2(self): self.implNamingSystem2(inst2) def implNamingSystem2(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2005-01-25").date) - self.assertEqual(inst.date.as_json(), "2005-01-25") - self.assertEqual(inst.description, "This was a wrong registration for the spanish editions of SNOMED CT. Do not use") - self.assertEqual(inst.id, "example-replaced") - self.assertEqual(inst.kind, "codesystem") - self.assertEqual(inst.name, "SNOMED CT Spanish") - self.assertEqual(inst.publisher, "Not HL7!") - self.assertEqual(inst.status, "retired") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.uniqueId[0].type, "oid") - self.assertEqual(inst.uniqueId[0].value, "2.16.840.1.113883.6.96.1") - - def testNamingSystem3(self): - inst = self.instantiate_from("namingsystem-example.json") - self.assertIsNotNone(inst, "Must have instantiated a NamingSystem instance") - self.implNamingSystem3(inst) - - js = inst.as_json() - self.assertEqual("NamingSystem", js["resourceType"]) - inst2 = namingsystem.NamingSystem(js) - self.implNamingSystem3(inst2) - - def implNamingSystem3(self, inst): self.assertEqual(inst.contact[0].name, "FHIR project team") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") @@ -102,6 +82,9 @@ def implNamingSystem3(self, inst): self.assertEqual(inst.date.as_json(), "2014-12-13") self.assertEqual(inst.id, "example") self.assertEqual(inst.kind, "codesystem") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "SNOMED CT") self.assertEqual(inst.publisher, "HL7 International on behalf of IHTSDO") self.assertEqual(inst.responsible, "IHTSDO & affiliates") diff --git a/fhirclient/models/narrative.py b/fhirclient/models/narrative.py index df00f181c..6c19f60c6 100644 --- a/fhirclient/models/narrative.py +++ b/fhirclient/models/narrative.py @@ -1,14 +1,18 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Narrative) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Narrative) on 2019-05-07. +# 2019, SMART Health IT. from . import element class Narrative(element.Element): - """ A human-readable formatted text, including images. + """ Human-readable summary of the resource (essential clinical and business + information). + + A human-readable summary of the resource conveying the essential clinical + and business information for the resource. """ resource_type = "Narrative" diff --git a/fhirclient/models/nutritionorder.py b/fhirclient/models/nutritionorder.py index 705c96e92..93d365623 100644 --- a/fhirclient/models/nutritionorder.py +++ b/fhirclient/models/nutritionorder.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,7 +27,7 @@ def __init__(self, jsondict=None, strict=True): self.allergyIntolerance = None """ List of the patient's food and nutrition-related allergies and intolerances. - List of `FHIRReference` items referencing `AllergyIntolerance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.dateTime = None """ Date and time the nutrition order was requested. @@ -35,7 +35,7 @@ def __init__(self, jsondict=None, strict=True): self.encounter = None """ The encounter associated with this nutrition order. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.enteralFormula = None """ Enteral formula components. @@ -54,17 +54,37 @@ def __init__(self, jsondict=None, strict=True): """ Identifiers assigned to this order. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiates = None + """ Instantiates protocol or definition. + List of `str` items. """ + + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + + self.intent = None + """ proposal | plan | order. + Type `str`. """ + + self.note = None + """ Comments. + List of `Annotation` items (represented as `dict` in JSON). """ + self.oralDiet = None """ Oral diet components. Type `NutritionOrderOralDiet` (represented as `dict` in JSON). """ self.orderer = None """ Who ordered the diet, formula or nutritional supplement. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.patient = None """ The person who requires the diet, formula or nutritional supplement. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ proposed | draft | planned | requested | active | on-hold | @@ -87,10 +107,15 @@ def elementProperties(self): ("excludeFoodModifier", "excludeFoodModifier", codeableconcept.CodeableConcept, True, None, False), ("foodPreferenceModifier", "foodPreferenceModifier", codeableconcept.CodeableConcept, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiates", "instantiates", str, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), + ("intent", "intent", str, False, None, True), + ("note", "note", annotation.Annotation, True, None, False), ("oralDiet", "oralDiet", NutritionOrderOralDiet, False, None, False), ("orderer", "orderer", fhirreference.FHIRReference, False, None, False), ("patient", "patient", fhirreference.FHIRReference, False, None, True), - ("status", "status", str, False, None, False), + ("status", "status", str, False, None, True), ("supplement", "supplement", NutritionOrderSupplement, True, None, False), ]) return js @@ -399,6 +424,10 @@ def elementProperties(self): import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] try: from . import codeableconcept except ImportError: diff --git a/fhirclient/models/nutritionorder_tests.py b/fhirclient/models/nutritionorder_tests.py index c3ba0d273..13c57493b 100644 --- a/fhirclient/models/nutritionorder_tests.py +++ b/fhirclient/models/nutritionorder_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return nutritionorder.NutritionOrder(js) def testNutritionOrder1(self): - inst = self.instantiate_from("nutritionorder-example-cardiacdiet.json") + inst = self.instantiate_from("nutritionorder-example-diabeticsupplement.json") self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") self.implNutritionOrder1(inst) @@ -32,104 +32,6 @@ def testNutritionOrder1(self): self.implNutritionOrder1(inst2) def implNutritionOrder1(self, inst): - self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) - self.assertEqual(inst.dateTime.as_json(), "2014-09-17") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].display, "Cashew Nut") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "dairy-free") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/diet") - self.assertEqual(inst.id, "cardiacdiet") - self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") - self.assertEqual(inst.identifier[0].value, "123") - self.assertEqual(inst.oralDiet.instruction, "Starting on 2/10 breakfast, maximum 400 ml fluids per meal") - self.assertEqual(inst.oralDiet.nutrient[0].amount.code, "g") - self.assertEqual(inst.oralDiet.nutrient[0].amount.system, "http://unitsofmeasure.org") - self.assertEqual(inst.oralDiet.nutrient[0].amount.unit, "grams") - self.assertEqual(inst.oralDiet.nutrient[0].amount.value, 2) - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "39972003") - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Sodium") - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.nutrient[1].amount.code, "mL") - self.assertEqual(inst.oralDiet.nutrient[1].amount.system, "http://unitsofmeasure.org") - self.assertEqual(inst.oralDiet.nutrient[1].amount.unit, "milliliter") - self.assertEqual(inst.oralDiet.nutrient[1].amount.value, 1500) - self.assertEqual(inst.oralDiet.nutrient[1].modifier.coding[0].code, "33463005") - self.assertEqual(inst.oralDiet.nutrient[1].modifier.coding[0].display, "Fluid") - self.assertEqual(inst.oralDiet.nutrient[1].modifier.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.type[0].coding[0].code, "386619000") - self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Low sodium diet") - self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1040") - self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Low Sodium Diet") - self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") - self.assertEqual(inst.oralDiet.type[0].text, "Low sodium diet") - self.assertEqual(inst.oralDiet.type[1].coding[0].code, "226208002") - self.assertEqual(inst.oralDiet.type[1].coding[0].display, "Fluid restricted diet") - self.assertEqual(inst.oralDiet.type[1].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.type[1].coding[1].code, "1040") - self.assertEqual(inst.oralDiet.type[1].coding[1].display, "Fluid restricted diet") - self.assertEqual(inst.oralDiet.type[1].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") - self.assertEqual(inst.oralDiet.type[1].text, "Fluid restricted diet") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - def testNutritionOrder2(self): - inst = self.instantiate_from("nutritionorder-example-diabeticdiet.json") - self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder2(inst) - - js = inst.as_json() - self.assertEqual("NutritionOrder", js["resourceType"]) - inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder2(inst2) - - def implNutritionOrder2(self, inst): - self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) - self.assertEqual(inst.dateTime.as_json(), "2014-09-17") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].display, "Cashew Nut") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "dairy-free") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/diet") - self.assertEqual(inst.id, "diabeticdiet") - self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") - self.assertEqual(inst.identifier[0].value, "123") - self.assertEqual(inst.oralDiet.nutrient[0].amount.code, "g") - self.assertEqual(inst.oralDiet.nutrient[0].amount.system, "http://unitsofmeasure.org") - self.assertEqual(inst.oralDiet.nutrient[0].amount.unit, "grams") - self.assertEqual(inst.oralDiet.nutrient[0].amount.value, 75) - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "2331003") - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Carbohydrate") - self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10").date) - self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10") - self.assertEqual(inst.oralDiet.schedule[0].repeat.frequency, 3) - self.assertEqual(inst.oralDiet.schedule[0].repeat.period, 1) - self.assertEqual(inst.oralDiet.schedule[0].repeat.periodUnit, "d") - self.assertEqual(inst.oralDiet.type[0].coding[0].code, "160670007") - self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Diabetic diet") - self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1030") - self.assertEqual(inst.oralDiet.type[0].coding[1].display, "DD - Diabetic diet") - self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") - self.assertEqual(inst.oralDiet.type[0].text, "DD - Diabetic diet") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - def testNutritionOrder3(self): - inst = self.instantiate_from("nutritionorder-example-diabeticsupplement.json") - self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder3(inst) - - js = inst.as_json() - self.assertEqual("NutritionOrder", js["resourceType"]) - inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder3(inst2) - - def implNutritionOrder3(self, inst): self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) self.assertEqual(inst.dateTime.as_json(), "2014-09-17") self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") @@ -137,10 +39,14 @@ def implNutritionOrder3(self, inst): self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "kosher") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/diet") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/diet") self.assertEqual(inst.id, "diabeticsupplement") self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") self.assertEqual(inst.supplement[0].productName, "Glucerna") self.assertEqual(inst.supplement[0].quantity.unit, "8 oz bottle") @@ -162,63 +68,23 @@ def implNutritionOrder3(self, inst): self.assertEqual(inst.supplement[0].type.text, "Adult diabetic formula") self.assertEqual(inst.text.status, "generated") - def testNutritionOrder4(self): - inst = self.instantiate_from("nutritionorder-example-energysupplement.json") - self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder4(inst) - - js = inst.as_json() - self.assertEqual("NutritionOrder", js["resourceType"]) - inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder4(inst2) - - def implNutritionOrder4(self, inst): - self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) - self.assertEqual(inst.dateTime.as_json(), "2014-09-17") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].display, "Cashew Nut") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "kosher") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/diet") - self.assertEqual(inst.id, "energysupplement") - self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") - self.assertEqual(inst.identifier[0].value, "123") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.supplement[0].productName, "Ensure") - self.assertEqual(inst.supplement[0].quantity.unit, "8 oz can") - self.assertEqual(inst.supplement[0].quantity.value, 1) - self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10").date) - self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10") - self.assertEqual(inst.supplement[0].schedule[0].repeat.frequency, 3) - self.assertEqual(inst.supplement[0].schedule[0].repeat.period, 1) - self.assertEqual(inst.supplement[0].schedule[0].repeat.periodUnit, "d") - self.assertEqual(inst.supplement[0].type.coding[0].code, "442971000124100") - self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult high energy formula") - self.assertEqual(inst.supplement[0].type.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.supplement[0].type.coding[1].code, "1010") - self.assertEqual(inst.supplement[0].type.coding[1].display, "Adult high energy drink") - self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") - self.assertEqual(inst.supplement[0].type.text, "Adult high energy drink") - self.assertEqual(inst.text.status, "generated") - - def testNutritionOrder5(self): + def testNutritionOrder2(self): inst = self.instantiate_from("nutritionorder-example-enteralbolus.json") self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder5(inst) + self.implNutritionOrder2(inst) js = inst.as_json() self.assertEqual("NutritionOrder", js["resourceType"]) inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder5(inst2) + self.implNutritionOrder2(inst2) - def implNutritionOrder5(self, inst): + def implNutritionOrder2(self, inst): self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) self.assertEqual(inst.dateTime.as_json(), "2014-09-17") self.assertEqual(inst.enteralFormula.additiveProductName, "Acme Lipid Additive") self.assertEqual(inst.enteralFormula.additiveType.coding[0].code, "lipid") self.assertEqual(inst.enteralFormula.additiveType.coding[0].display, "Lipid") - self.assertEqual(inst.enteralFormula.additiveType.coding[0].system, "http://hl7.org/fhir/entformula-additive") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].system, "http://terminology.hl7.org/CodeSystem/entformula-additive") self.assertEqual(inst.enteralFormula.administrationInstruction, "240 mls every 4hrs ") self.assertEqual(inst.enteralFormula.administration[0].quantity.code, "mL") self.assertEqual(inst.enteralFormula.administration[0].quantity.system, "http://unitsofmeasure.org") @@ -230,9 +96,9 @@ def implNutritionOrder5(self, inst): self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.period, 4) self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.periodUnit, "h") self.assertEqual(inst.enteralFormula.baseFormulaProductName, "Acme High Protein Formula") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "659311000124118") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "442991000124104") self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "Adult high protein formula") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://usextension/snomed.info/sct") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.enteralFormula.caloricDensity.code, "cal/mL") self.assertEqual(inst.enteralFormula.caloricDensity.system, "http://unitsofmeasure.org") self.assertEqual(inst.enteralFormula.caloricDensity.unit, "calories per milliliter") @@ -243,83 +109,34 @@ def implNutritionOrder5(self, inst): self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.value, 1440) self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].code, "GT") self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].display, "Instillation, gastrostomy tube") - self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].system, "http://hl7.org/fhir/v3/RouteOfAdministration") + self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration") self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") self.assertEqual(inst.excludeFoodModifier[0].coding[0].display, "Cashew Nut") self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "dairy-free") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/diet") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/diet") self.assertEqual(inst.id, "enteralbolus") self.assertEqual(inst.identifier[0].system, "http://www.acme.org/nutritionorders") self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") - def testNutritionOrder6(self): - inst = self.instantiate_from("nutritionorder-example-enteralcontinuous.json") - self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder6(inst) - - js = inst.as_json() - self.assertEqual("NutritionOrder", js["resourceType"]) - inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder6(inst2) - - def implNutritionOrder6(self, inst): - self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) - self.assertEqual(inst.dateTime.as_json(), "2014-09-17") - self.assertEqual(inst.enteralFormula.administrationInstruction, "Hold feedings from 7 pm to 7 am. Add MCT oil to increase calories from 1.0 cal/mL to 1.5 cal/mL") - self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.code, "mL/h") - self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.unit, "ml/hr") - self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.value, 60) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T07:00:00Z").date) - self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T07:00:00Z") - self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.code, "mL/h") - self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.unit, "ml/hr") - self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.value, 80) - self.assertEqual(inst.enteralFormula.administration[1].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T11:00:00Z").date) - self.assertEqual(inst.enteralFormula.administration[1].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T11:00:00Z") - self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.code, "mL/h") - self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.unit, "ml/hr") - self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.value, 100) - self.assertEqual(inst.enteralFormula.administration[2].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T15:00:00Z").date) - self.assertEqual(inst.enteralFormula.administration[2].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T15:00:00Z") - self.assertEqual(inst.enteralFormula.baseFormulaProductName, " Acme Diabetes Formula") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "6547210000124112") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "Diabetic specialty enteral formula") - self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://snomed/sct") - self.assertEqual(inst.enteralFormula.caloricDensity.code, "cal/mL") - self.assertEqual(inst.enteralFormula.caloricDensity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.enteralFormula.caloricDensity.unit, "calories per milliliter") - self.assertEqual(inst.enteralFormula.caloricDensity.value, 1) - self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.code, "mL/d") - self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.system, "http://unitsofmeasure.org") - self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.unit, "milliliter/day") - self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.value, 880) - self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].code, "NGT") - self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].display, "Instillation, nasogastric tube") - self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].system, "http://hl7.org/fhir/v3/RouteOfAdministration") - self.assertEqual(inst.id, "enteralcontinuous") - self.assertEqual(inst.identifier[0].system, "http://www.acme.org/nutritionorders") - self.assertEqual(inst.identifier[0].value, "123") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - def testNutritionOrder7(self): + def testNutritionOrder3(self): inst = self.instantiate_from("nutritionorder-example-fiberrestricteddiet.json") self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder7(inst) + self.implNutritionOrder3(inst) js = inst.as_json() self.assertEqual("NutritionOrder", js["resourceType"]) inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder7(inst2) + self.implNutritionOrder3(inst2) - def implNutritionOrder7(self, inst): + def implNutritionOrder3(self, inst): self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) self.assertEqual(inst.dateTime.as_json(), "2014-09-17") self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") @@ -327,10 +144,14 @@ def implNutritionOrder7(self, inst): self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "dairy-free") - self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://hl7.org/fhir/diet") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/diet") self.assertEqual(inst.id, "fiberrestricteddiet") self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.oralDiet.nutrient[0].amount.code, "g") self.assertEqual(inst.oralDiet.nutrient[0].amount.system, "http://unitsofmeasure.org") self.assertEqual(inst.oralDiet.nutrient[0].amount.unit, "grams") @@ -360,23 +181,118 @@ def implNutritionOrder7(self, inst): self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") - def testNutritionOrder8(self): + def testNutritionOrder4(self): + inst = self.instantiate_from("nutritionorder-example-texture-modified.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder4(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder4(inst2) + + def implNutritionOrder4(self, inst): + self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.dateTime.as_json(), "2014-09-17") + self.assertEqual(inst.id, "texturemodified") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10").date) + self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10") + self.assertEqual(inst.oralDiet.schedule[0].repeat.frequency, 3) + self.assertEqual(inst.oralDiet.schedule[0].repeat.period, 1) + self.assertEqual(inst.oralDiet.schedule[0].repeat.periodUnit, "d") + self.assertEqual(inst.oralDiet.texture[0].foodType.coding[0].code, "28647000") + self.assertEqual(inst.oralDiet.texture[0].foodType.coding[0].display, "Meat") + self.assertEqual(inst.oralDiet.texture[0].foodType.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.texture[0].foodType.text, "Regular, Chopped Meat") + self.assertEqual(inst.oralDiet.texture[0].modifier.coding[0].code, "228049004") + self.assertEqual(inst.oralDiet.texture[0].modifier.coding[0].display, "Chopped food") + self.assertEqual(inst.oralDiet.texture[0].modifier.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.texture[0].modifier.text, "Regular, Chopped Meat") + self.assertEqual(inst.oralDiet.type[0].coding[0].code, "435801000124108") + self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Texture modified diet") + self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1010") + self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Texture modified diet") + self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[0].text, "Texture modified diet") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder5(self): + inst = self.instantiate_from("nutritionorder-example-pureeddiet-simple.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder5(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder5(inst2) + + def implNutritionOrder5(self, inst): + self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.dateTime.as_json(), "2014-09-17") + self.assertEqual(inst.id, "pureeddiet-simple") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.oralDiet.fluidConsistencyType[0].coding[0].code, "439021000124105") + self.assertEqual(inst.oralDiet.fluidConsistencyType[0].coding[0].display, "Dietary liquid consistency - nectar thick liquid") + self.assertEqual(inst.oralDiet.fluidConsistencyType[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.fluidConsistencyType[0].text, "Nectar thick liquids") + self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10").date) + self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10") + self.assertEqual(inst.oralDiet.schedule[0].repeat.frequency, 3) + self.assertEqual(inst.oralDiet.schedule[0].repeat.period, 1) + self.assertEqual(inst.oralDiet.schedule[0].repeat.periodUnit, "d") + self.assertEqual(inst.oralDiet.texture[0].modifier.coding[0].code, "228055009") + self.assertEqual(inst.oralDiet.texture[0].modifier.coding[0].display, "Liquidized food") + self.assertEqual(inst.oralDiet.texture[0].modifier.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.texture[0].modifier.text, "Pureed") + self.assertEqual(inst.oralDiet.type[0].coding[0].code, "226211001") + self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Pureed diet") + self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1010") + self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Pureed diet") + self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[0].text, "Pureed diet") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.supplement[0].instruction, "Ensure Pudding at breakfast, lunch, supper") + self.assertEqual(inst.supplement[0].productName, "Ensure Pudding 4 oz container") + self.assertEqual(inst.supplement[0].type.coding[0].code, "442971000124100") + self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult high energy formula") + self.assertEqual(inst.supplement[0].type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.supplement[0].type.coding[1].code, "1040") + self.assertEqual(inst.supplement[0].type.coding[1].display, "Adult high energy pudding") + self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") + self.assertEqual(inst.supplement[0].type.text, "Adult high energy pudding") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder6(self): inst = self.instantiate_from("nutritionorder-example-infantenteral.json") self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder8(inst) + self.implNutritionOrder6(inst) js = inst.as_json() self.assertEqual("NutritionOrder", js["resourceType"]) inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder8(inst2) + self.implNutritionOrder6(inst2) - def implNutritionOrder8(self, inst): + def implNutritionOrder6(self, inst): self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) self.assertEqual(inst.dateTime.as_json(), "2014-09-17") self.assertEqual(inst.enteralFormula.additiveProductName, "Acme High Carbohydrate Additive") self.assertEqual(inst.enteralFormula.additiveType.coding[0].code, "carbohydrate") self.assertEqual(inst.enteralFormula.additiveType.coding[0].display, "Carbohydrate") - self.assertEqual(inst.enteralFormula.additiveType.coding[0].system, "http://hl7.org/fhir/entformula-additive") + self.assertEqual(inst.enteralFormula.additiveType.coding[0].system, "http://terminology.hl7.org/CodeSystem/entformula-additive") self.assertEqual(inst.enteralFormula.administrationInstruction, "Add high calorie high carbohydrate additive to increase cal/oz from 24 cal/oz to 27 cal/oz.") self.assertEqual(inst.enteralFormula.administration[0].quantity.code, "[foz_us]") self.assertEqual(inst.enteralFormula.administration[0].quantity.system, "http://unitsofmeasure.org") @@ -401,65 +317,159 @@ def implNutritionOrder8(self, inst): self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.value, 32) self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].code, "PO") self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].display, "Swallow, oral") - self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].system, "http://hl7.org/fhir/v3/RouteOfAdministration") + self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration") self.assertTrue(inst.enteralFormula.routeofAdministration.coding[0].userSelected) self.assertEqual(inst.id, "infantenteral") self.assertEqual(inst.identifier[0].system, "http://www.acme.org/nutritionorders") self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") - def testNutritionOrder9(self): - inst = self.instantiate_from("nutritionorder-example-proteinsupplement.json") + def testNutritionOrder7(self): + inst = self.instantiate_from("nutritionorder-example-enteralcontinuous.json") self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder9(inst) + self.implNutritionOrder7(inst) js = inst.as_json() self.assertEqual("NutritionOrder", js["resourceType"]) inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder9(inst2) + self.implNutritionOrder7(inst2) - def implNutritionOrder9(self, inst): + def implNutritionOrder7(self, inst): self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) self.assertEqual(inst.dateTime.as_json(), "2014-09-17") - self.assertEqual(inst.id, "proteinsupplement") + self.assertEqual(inst.enteralFormula.administrationInstruction, "Hold feedings from 7 pm to 7 am. Add MCT oil to increase calories from 1.0 cal/mL to 1.5 cal/mL") + self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.code, "mL/h") + self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.unit, "ml/hr") + self.assertEqual(inst.enteralFormula.administration[0].rateQuantity.value, 60) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T07:00:00Z").date) + self.assertEqual(inst.enteralFormula.administration[0].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T07:00:00Z") + self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.code, "mL/h") + self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.unit, "ml/hr") + self.assertEqual(inst.enteralFormula.administration[1].rateQuantity.value, 80) + self.assertEqual(inst.enteralFormula.administration[1].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T11:00:00Z").date) + self.assertEqual(inst.enteralFormula.administration[1].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T11:00:00Z") + self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.code, "mL/h") + self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.unit, "ml/hr") + self.assertEqual(inst.enteralFormula.administration[2].rateQuantity.value, 100) + self.assertEqual(inst.enteralFormula.administration[2].schedule.repeat.boundsPeriod.start.date, FHIRDate("2014-09-17T15:00:00Z").date) + self.assertEqual(inst.enteralFormula.administration[2].schedule.repeat.boundsPeriod.start.as_json(), "2014-09-17T15:00:00Z") + self.assertEqual(inst.enteralFormula.baseFormulaProductName, " Acme Diabetes Formula") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].code, "6547210000124112") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].display, "Diabetic specialty enteral formula") + self.assertEqual(inst.enteralFormula.baseFormulaType.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.enteralFormula.caloricDensity.code, "cal/mL") + self.assertEqual(inst.enteralFormula.caloricDensity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.caloricDensity.unit, "calories per milliliter") + self.assertEqual(inst.enteralFormula.caloricDensity.value, 1) + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.code, "mL/d") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.system, "http://unitsofmeasure.org") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.unit, "milliliter/day") + self.assertEqual(inst.enteralFormula.maxVolumeToDeliver.value, 880) + self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].code, "NGT") + self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].display, "Instillation, nasogastric tube") + self.assertEqual(inst.enteralFormula.routeofAdministration.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration") + self.assertEqual(inst.id, "enteralcontinuous") + self.assertEqual(inst.identifier[0].system, "http://www.acme.org/nutritionorders") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder8(self): + inst = self.instantiate_from("nutritionorder-example-cardiacdiet.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder8(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder8(inst2) + + def implNutritionOrder8(self, inst): + self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.dateTime.as_json(), "2014-09-17") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].display, "Cashew Nut") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "dairy-free") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/diet") + self.assertEqual(inst.id, "cardiacdiet") self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.oralDiet.instruction, "Starting on 2/10 breakfast, maximum 400 ml fluids per meal") + self.assertEqual(inst.oralDiet.nutrient[0].amount.code, "g") + self.assertEqual(inst.oralDiet.nutrient[0].amount.system, "http://unitsofmeasure.org") + self.assertEqual(inst.oralDiet.nutrient[0].amount.unit, "grams") + self.assertEqual(inst.oralDiet.nutrient[0].amount.value, 2) + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "39972003") + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Sodium") + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.nutrient[1].amount.code, "mL") + self.assertEqual(inst.oralDiet.nutrient[1].amount.system, "http://unitsofmeasure.org") + self.assertEqual(inst.oralDiet.nutrient[1].amount.unit, "milliliter") + self.assertEqual(inst.oralDiet.nutrient[1].amount.value, 1500) + self.assertEqual(inst.oralDiet.nutrient[1].modifier.coding[0].code, "33463005") + self.assertEqual(inst.oralDiet.nutrient[1].modifier.coding[0].display, "Fluid") + self.assertEqual(inst.oralDiet.nutrient[1].modifier.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[0].code, "386619000") + self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Low sodium diet") + self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1040") + self.assertEqual(inst.oralDiet.type[0].coding[1].display, "Low Sodium Diet") + self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[0].text, "Low sodium diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].code, "226208002") + self.assertEqual(inst.oralDiet.type[1].coding[0].display, "Fluid restricted diet") + self.assertEqual(inst.oralDiet.type[1].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[1].coding[1].code, "1040") + self.assertEqual(inst.oralDiet.type[1].coding[1].display, "Fluid restricted diet") + self.assertEqual(inst.oralDiet.type[1].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[1].text, "Fluid restricted diet") self.assertEqual(inst.status, "active") - self.assertEqual(inst.supplement[0].instruction, "Beneprotein 1 scoop TID with meal.starting on 2015-02-10") - self.assertEqual(inst.supplement[0].productName, "Beneprotein") - self.assertEqual(inst.supplement[0].quantity.code, "{scoop}") - self.assertEqual(inst.supplement[0].quantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.supplement[0].quantity.unit, "scoop") - self.assertEqual(inst.supplement[0].quantity.value, 1) - self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10").date) - self.assertEqual(inst.supplement[0].schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10") - self.assertEqual(inst.supplement[0].schedule[0].repeat.when[0], "C") - self.assertEqual(inst.supplement[0].type.coding[0].code, "442991000124104") - self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult high protein formula") - self.assertEqual(inst.supplement[0].type.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.supplement[0].type.coding[1].code, "1000") - self.assertEqual(inst.supplement[0].type.coding[1].display, "High Protein Powder") - self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") - self.assertEqual(inst.supplement[0].type.text, "High Protein Powder") self.assertEqual(inst.text.status, "generated") - def testNutritionOrder10(self): - inst = self.instantiate_from("nutritionorder-example-pureeddiet-simple.json") + def testNutritionOrder9(self): + inst = self.instantiate_from("nutritionorder-example-pureeddiet.json") self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") - self.implNutritionOrder10(inst) + self.implNutritionOrder9(inst) js = inst.as_json() self.assertEqual("NutritionOrder", js["resourceType"]) inst2 = nutritionorder.NutritionOrder(js) - self.implNutritionOrder10(inst2) + self.implNutritionOrder9(inst2) - def implNutritionOrder10(self, inst): + def implNutritionOrder9(self, inst): self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) self.assertEqual(inst.dateTime.as_json(), "2014-09-17") - self.assertEqual(inst.id, "pureeddiet-simple") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].display, "Cashew Nut") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "dairy-free") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/diet") + self.assertEqual(inst.id, "pureeddiet") self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.oralDiet.fluidConsistencyType[0].coding[0].code, "439021000124105") self.assertEqual(inst.oralDiet.fluidConsistencyType[0].coding[0].display, "Dietary liquid consistency - nectar thick liquid") self.assertEqual(inst.oralDiet.fluidConsistencyType[0].coding[0].system, "http://snomed.info/sct") @@ -481,14 +491,53 @@ def implNutritionOrder10(self, inst): self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") self.assertEqual(inst.oralDiet.type[0].text, "Pureed diet") self.assertEqual(inst.status, "active") - self.assertEqual(inst.supplement[0].instruction, "Ensure Pudding at breakfast, lunch, supper") - self.assertEqual(inst.supplement[0].productName, "Ensure Pudding 4 oz container") - self.assertEqual(inst.supplement[0].type.coding[0].code, "442971000124100") - self.assertEqual(inst.supplement[0].type.coding[0].display, "Adult high energy formula") - self.assertEqual(inst.supplement[0].type.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.supplement[0].type.coding[1].code, "1040") - self.assertEqual(inst.supplement[0].type.coding[1].display, "Adult high energy pudding") - self.assertEqual(inst.supplement[0].type.coding[1].system, "http://goodhealthhospital.org/supplement-type-codes") - self.assertEqual(inst.supplement[0].type.text, "Adult high energy pudding") + self.assertEqual(inst.text.status, "generated") + + def testNutritionOrder10(self): + inst = self.instantiate_from("nutritionorder-example-diabeticdiet.json") + self.assertIsNotNone(inst, "Must have instantiated a NutritionOrder instance") + self.implNutritionOrder10(inst) + + js = inst.as_json() + self.assertEqual("NutritionOrder", js["resourceType"]) + inst2 = nutritionorder.NutritionOrder(js) + self.implNutritionOrder10(inst2) + + def implNutritionOrder10(self, inst): + self.assertEqual(inst.dateTime.date, FHIRDate("2014-09-17").date) + self.assertEqual(inst.dateTime.as_json(), "2014-09-17") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].code, "227493005") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].display, "Cashew Nut") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.excludeFoodModifier[0].coding[0].version, "20140730") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].code, "dairy-free") + self.assertEqual(inst.foodPreferenceModifier[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/diet") + self.assertEqual(inst.id, "diabeticdiet") + self.assertEqual(inst.identifier[0].system, "http://goodhealthhospital.org/nutrition-requests") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.oralDiet.nutrient[0].amount.code, "g") + self.assertEqual(inst.oralDiet.nutrient[0].amount.system, "http://unitsofmeasure.org") + self.assertEqual(inst.oralDiet.nutrient[0].amount.unit, "grams") + self.assertEqual(inst.oralDiet.nutrient[0].amount.value, 75) + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].code, "2331003") + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].display, "Carbohydrate") + self.assertEqual(inst.oralDiet.nutrient[0].modifier.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.date, FHIRDate("2015-02-10").date) + self.assertEqual(inst.oralDiet.schedule[0].repeat.boundsPeriod.start.as_json(), "2015-02-10") + self.assertEqual(inst.oralDiet.schedule[0].repeat.frequency, 3) + self.assertEqual(inst.oralDiet.schedule[0].repeat.period, 1) + self.assertEqual(inst.oralDiet.schedule[0].repeat.periodUnit, "d") + self.assertEqual(inst.oralDiet.type[0].coding[0].code, "160670007") + self.assertEqual(inst.oralDiet.type[0].coding[0].display, "Diabetic diet") + self.assertEqual(inst.oralDiet.type[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.oralDiet.type[0].coding[1].code, "1030") + self.assertEqual(inst.oralDiet.type[0].coding[1].display, "DD - Diabetic diet") + self.assertEqual(inst.oralDiet.type[0].coding[1].system, "http://goodhealthhospital.org/diet-type-codes") + self.assertEqual(inst.oralDiet.type[0].text, "DD - Diabetic diet") + self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/observation.py b/fhirclient/models/observation.py index f963508ce..7814cb68a 100644 --- a/fhirclient/models/observation.py +++ b/fhirclient/models/observation.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Observation) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Observation) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -26,7 +26,7 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Fulfills plan, proposal or order. - List of `FHIRReference` items referencing `CarePlan, DeviceRequest, ImmunizationRecommendation, MedicationRequest, NutritionOrder, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.bodySite = None """ Observed body part. @@ -40,77 +40,94 @@ def __init__(self, jsondict=None, strict=True): """ Type of observation (code / type). Type `CodeableConcept` (represented as `dict` in JSON). """ - self.comment = None - """ Comments about result. - Type `str`. """ - self.component = None """ Component results. List of `ObservationComponent` items (represented as `dict` in JSON). """ - self.context = None - """ Healthcare event during which this observation is made. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - self.dataAbsentReason = None """ Why the result is missing. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.derivedFrom = None + """ Related measurements the observation is made from. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.device = None """ (Measurement) Device. - Type `FHIRReference` referencing `Device, DeviceMetric` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.effectiveDateTime = None """ Clinically relevant time/time-period for observation. Type `FHIRDate` (represented as `str` in JSON). """ + self.effectiveInstant = None + """ Clinically relevant time/time-period for observation. + Type `FHIRDate` (represented as `str` in JSON). """ + self.effectivePeriod = None """ Clinically relevant time/time-period for observation. Type `Period` (represented as `dict` in JSON). """ + self.effectiveTiming = None + """ Clinically relevant time/time-period for observation. + Type `Timing` (represented as `dict` in JSON). """ + + self.encounter = None + """ Healthcare event during which this observation is made. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.focus = None + """ What the observation is about, when it is not about the subject of + record. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.hasMember = None + """ Related resource that belongs to the Observation group. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.identifier = None """ Business Identifier for observation. List of `Identifier` items (represented as `dict` in JSON). """ self.interpretation = None """ High, low, normal, etc.. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.issued = None - """ Date/Time this was made available. + """ Date/Time this version was made available. Type `FHIRDate` (represented as `str` in JSON). """ self.method = None """ How it was done. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.note = None + """ Comments about the observation. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.partOf = None + """ Part of referenced event. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.performer = None """ Who is responsible for the observation. - List of `FHIRReference` items referencing `Practitioner, Organization, Patient, RelatedPerson` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.referenceRange = None """ Provides guide for interpretation. List of `ObservationReferenceRange` items (represented as `dict` in JSON). """ - self.related = None - """ Resource related to this observation. - List of `ObservationRelated` items (represented as `dict` in JSON). """ - self.specimen = None """ Specimen used for this observation. - Type `FHIRReference` referencing `Specimen` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ registered | preliminary | final | amended +. Type `str`. """ self.subject = None - """ Who and/or what this is about. - Type `FHIRReference` referencing `Patient, Group, Device, Location` (represented as `dict` in JSON). """ - - self.valueAttachment = None - """ Actual result. - Type `Attachment` (represented as `dict` in JSON). """ + """ Who and/or what the observation is about. + Type `FHIRReference` (represented as `dict` in JSON). """ self.valueBoolean = None """ Actual result. @@ -124,6 +141,10 @@ def __init__(self, jsondict=None, strict=True): """ Actual result. Type `FHIRDate` (represented as `str` in JSON). """ + self.valueInteger = None + """ Actual result. + Type `int`. """ + self.valuePeriod = None """ Actual result. Type `Period` (represented as `dict` in JSON). """ @@ -161,27 +182,32 @@ def elementProperties(self): ("bodySite", "bodySite", codeableconcept.CodeableConcept, False, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("comment", "comment", str, False, None, False), ("component", "component", ObservationComponent, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), + ("derivedFrom", "derivedFrom", fhirreference.FHIRReference, True, None, False), ("device", "device", fhirreference.FHIRReference, False, None, False), ("effectiveDateTime", "effectiveDateTime", fhirdate.FHIRDate, False, "effective", False), + ("effectiveInstant", "effectiveInstant", fhirdate.FHIRDate, False, "effective", False), ("effectivePeriod", "effectivePeriod", period.Period, False, "effective", False), + ("effectiveTiming", "effectiveTiming", timing.Timing, False, "effective", False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("focus", "focus", fhirreference.FHIRReference, True, None, False), + ("hasMember", "hasMember", fhirreference.FHIRReference, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("interpretation", "interpretation", codeableconcept.CodeableConcept, False, None, False), + ("interpretation", "interpretation", codeableconcept.CodeableConcept, True, None, False), ("issued", "issued", fhirdate.FHIRDate, False, None, False), ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("performer", "performer", fhirreference.FHIRReference, True, None, False), ("referenceRange", "referenceRange", ObservationReferenceRange, True, None, False), - ("related", "related", ObservationRelated, True, None, False), ("specimen", "specimen", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, True), ("subject", "subject", fhirreference.FHIRReference, False, None, False), - ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), ("valueBoolean", "valueBoolean", bool, False, "value", False), ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueInteger", "valueInteger", int, False, "value", False), ("valuePeriod", "valuePeriod", period.Period, False, "value", False), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), ("valueRange", "valueRange", range.Range, False, "value", False), @@ -225,15 +251,15 @@ def __init__(self, jsondict=None, strict=True): self.interpretation = None """ High, low, normal, etc.. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.referenceRange = None """ Provides guide for interpretation of component result. List of `ObservationReferenceRange` items (represented as `dict` in JSON). """ - self.valueAttachment = None + self.valueBoolean = None """ Actual component result. - Type `Attachment` (represented as `dict` in JSON). """ + Type `bool`. """ self.valueCodeableConcept = None """ Actual component result. @@ -243,6 +269,10 @@ def __init__(self, jsondict=None, strict=True): """ Actual component result. Type `FHIRDate` (represented as `str` in JSON). """ + self.valueInteger = None + """ Actual component result. + Type `int`. """ + self.valuePeriod = None """ Actual component result. Type `Period` (represented as `dict` in JSON). """ @@ -278,11 +308,12 @@ def elementProperties(self): js.extend([ ("code", "code", codeableconcept.CodeableConcept, False, None, True), ("dataAbsentReason", "dataAbsentReason", codeableconcept.CodeableConcept, False, None, False), - ("interpretation", "interpretation", codeableconcept.CodeableConcept, False, None, False), + ("interpretation", "interpretation", codeableconcept.CodeableConcept, True, None, False), ("referenceRange", "referenceRange", ObservationReferenceRange, True, None, False), - ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), + ("valueInteger", "valueInteger", int, False, "value", False), ("valuePeriod", "valuePeriod", period.Period, False, "value", False), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), ("valueRange", "valueRange", range.Range, False, "value", False), @@ -298,7 +329,9 @@ class ObservationReferenceRange(backboneelement.BackboneElement): """ Provides guide for interpretation. Guidance on how to interpret the value by comparison to a normal or - recommended range. + recommended range. Multiple reference ranges are interpreted as an "OR". + In other words, to represent two distinct target populations, two + `referenceRange` elements would be used. """ resource_type = "ObservationReferenceRange" @@ -350,48 +383,11 @@ def elementProperties(self): return js -class ObservationRelated(backboneelement.BackboneElement): - """ Resource related to this observation. - - A reference to another resource (usually another Observation) whose - relationship is defined by the relationship type code. - """ - - resource_type = "ObservationRelated" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.target = None - """ Resource that is related to this one. - Type `FHIRReference` referencing `Observation, QuestionnaireResponse, Sequence` (represented as `dict` in JSON). """ - - self.type = None - """ has-member | derived-from | sequel-to | replaces | qualified-by | - interfered-by. - Type `str`. """ - - super(ObservationRelated, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ObservationRelated, self).elementProperties() - js.extend([ - ("target", "target", fhirreference.FHIRReference, False, None, True), - ("type", "type", str, False, None, False), - ]) - return js - - import sys try: - from . import attachment + from . import annotation except ImportError: - attachment = sys.modules[__package__ + '.attachment'] + annotation = sys.modules[__package__ + '.annotation'] try: from . import codeableconcept except ImportError: @@ -428,3 +424,7 @@ def elementProperties(self): from . import sampleddata except ImportError: sampleddata = sys.modules[__package__ + '.sampleddata'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/observation_tests.py b/fhirclient/models/observation_tests.py index 8fe6ac171..11260390d 100644 --- a/fhirclient/models/observation_tests.py +++ b/fhirclient/models/observation_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return observation.Observation(js) def testObservation1(self): - inst = self.instantiate_from("observation-example-10minute-apgar-score.json") + inst = self.instantiate_from("observation-example-genetics-1.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation1(inst) @@ -32,104 +32,33 @@ def testObservation1(self): self.implObservation1(inst2) def implObservation1(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "survey") - self.assertEqual(inst.category[0].coding[0].display, "Survey") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.category[0].text, "Survey") - self.assertEqual(inst.code.coding[0].code, "9271-8") - self.assertEqual(inst.code.coding[0].display, "10 minute Apgar Score") + self.assertEqual(inst.code.coding[0].code, "55233-1") + self.assertEqual(inst.code.coding[0].display, "Genetic analysis master panel-- This is the parent OBR for the panel holding all of the associated observations that can be reported with a molecular genetics analysis result.") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.coding[1].code, "169922007") - self.assertEqual(inst.code.coding[1].display, "Apgar at 10 minutes") - self.assertEqual(inst.code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "10 minute Apgar Score") - self.assertEqual(inst.component[0].code.coding[0].code, "32401-2") - self.assertEqual(inst.component[0].code.coding[0].display, "10 minute Apgar Color") - self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[0].code.coding[1].code, "249227004") - self.assertEqual(inst.component[0].code.coding[1].display, "Apgar color score") - self.assertEqual(inst.component[0].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.text, "Apgar color score") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6724-4") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "Good color all over") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarcolor") - self.assertEqual(inst.component[0].valueCodeableConcept.text, "2. Good color all over") - self.assertEqual(inst.component[1].code.coding[0].code, "32402-0") - self.assertEqual(inst.component[1].code.coding[0].display, "10 minute Apgar Heart Rate") - self.assertEqual(inst.component[1].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[1].code.coding[1].code, "249223000") - self.assertEqual(inst.component[1].code.coding[1].display, "Apgar heart rate score") - self.assertEqual(inst.component[1].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[1].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].code, "LA6718-6") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].display, "At least 100 beats per minute") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarheartrate") - self.assertEqual(inst.component[1].valueCodeableConcept.text, "2. At least 100 beats per minute") - self.assertEqual(inst.component[2].code.coding[0].code, "32404-6") - self.assertEqual(inst.component[2].code.coding[0].display, "10 minute Apgar Reflex Irritability") - self.assertEqual(inst.component[2].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[2].code.coding[1].code, "249226008") - self.assertEqual(inst.component[2].code.coding[1].display, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[2].code.text, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].code, "LA6721-0") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].display, "Grimace and pulling away, cough, or sneeze during suctioning") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarreflexirritability") - self.assertEqual(inst.component[2].valueCodeableConcept.text, "2. Grimace and pulling away, cough, or sneeze during suctioning") - self.assertEqual(inst.component[3].code.coding[0].code, "32403-8") - self.assertEqual(inst.component[3].code.coding[0].display, "10 minute Apgar Muscle Tone") - self.assertEqual(inst.component[3].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[3].code.coding[1].code, "249225007") - self.assertEqual(inst.component[3].code.coding[1].display, "Apgar muscle tone score") - self.assertEqual(inst.component[3].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[3].code.text, "Apgar muscle tone score") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].code, "LA6715-2") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].display, "Active motion ") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarmuscletone") - self.assertEqual(inst.component[3].valueCodeableConcept.text, "2. Active motion") - self.assertEqual(inst.component[4].code.coding[0].code, "32405-3") - self.assertEqual(inst.component[4].code.coding[0].display, "10 minute Apgar Respiratory effort") - self.assertEqual(inst.component[4].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[4].code.coding[1].code, "249224006") - self.assertEqual(inst.component[4].code.coding[1].display, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[4].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].code, "LA6727-7") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].display, "Good, strong cry; normal rate and effort of breathing ") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarrespiratoryeffort") - self.assertEqual(inst.component[4].valueCodeableConcept.text, "2. Good, strong cry; normal rate and effort of breathing") - self.assertEqual(inst.contained[0].id, "newborn") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-05-18T22:33:22Z").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2016-05-18T22:33:22Z") - self.assertEqual(inst.id, "10minute-apgar-score") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsGene") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].code, "3236") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].display, "EGFR") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].system, "http://www.genenames.org") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsDNARegionName") + self.assertEqual(inst.extension[1].valueString, "Exon 21") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsGenomicSourceClass") + self.assertEqual(inst.extension[2].valueCodeableConcept.coding[0].code, "LA6684-0") + self.assertEqual(inst.extension[2].valueCodeableConcept.coding[0].display, "somatic") + self.assertEqual(inst.extension[2].valueCodeableConcept.coding[0].system, "http://loinc.org") + self.assertEqual(inst.id, "example-genetics-1") + self.assertEqual(inst.issued.date, FHIRDate("2013-04-03T15:30:10+01:00").date) + self.assertEqual(inst.issued.as_json(), "2013-04-03T15:30:10+01:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.valueQuantity.code, "{score}") - self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.value, 10) + self.assertEqual(inst.valueCodeableConcept.coding[0].code, "10828004") + self.assertEqual(inst.valueCodeableConcept.coding[0].display, "Positive") + self.assertEqual(inst.valueCodeableConcept.coding[0].system, "http://snomed.info/sct") def testObservation2(self): - inst = self.instantiate_from("observation-example-1minute-apgar-score.json") + inst = self.instantiate_from("observation-example-bmd.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation2(inst) @@ -139,104 +68,26 @@ def testObservation2(self): self.implObservation2(inst2) def implObservation2(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "survey") - self.assertEqual(inst.category[0].coding[0].display, "Survey") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.category[0].text, "Survey") - self.assertEqual(inst.code.coding[0].code, "9272-6") - self.assertEqual(inst.code.coding[0].display, "1 minute Apgar Score") + self.assertEqual(inst.bodySite.coding[0].code, "71341001:272741003=7771000") + self.assertEqual(inst.bodySite.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.bodySite.text, "Left Femur") + self.assertEqual(inst.code.coding[0].code, "24701-5") + self.assertEqual(inst.code.coding[0].display, "Femur DXA Bone density") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.coding[1].code, "169895004") - self.assertEqual(inst.code.coding[1].display, "Apgar at 1 minute") - self.assertEqual(inst.code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "1 minute Apgar Score") - self.assertEqual(inst.component[0].code.coding[0].code, "32406-1") - self.assertEqual(inst.component[0].code.coding[0].display, "1 minute Apgar Color") - self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[0].code.coding[1].code, "249227004") - self.assertEqual(inst.component[0].code.coding[1].display, "Apgar color score") - self.assertEqual(inst.component[0].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.text, "Apgar color score") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6722-8") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "The baby's whole body is completely bluish-gray or pale") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].valueDecimal, 0) - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].code, "0") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarcolor") - self.assertEqual(inst.component[0].valueCodeableConcept.text, "0. The baby's whole body is completely bluish-gray or pale") - self.assertEqual(inst.component[1].code.coding[0].code, "32407-9") - self.assertEqual(inst.component[1].code.coding[0].display, "1 minute Apgar Heart Rate") - self.assertEqual(inst.component[1].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[1].code.coding[1].code, "249223000") - self.assertEqual(inst.component[1].code.coding[1].display, "Apgar heart rate score") - self.assertEqual(inst.component[1].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[1].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].code, "LA6716-0") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].display, "No heart rate") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].valueDecimal, 0) - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].code, "0") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarheartrate") - self.assertEqual(inst.component[1].valueCodeableConcept.text, "0. No heart rate") - self.assertEqual(inst.component[2].code.coding[0].code, "32409-5") - self.assertEqual(inst.component[2].code.coding[0].display, "1 minute Apgar Reflex Irritability") - self.assertEqual(inst.component[2].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[2].code.coding[1].code, "249226008") - self.assertEqual(inst.component[2].code.coding[1].display, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[2].code.text, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].code, "LA6719-4") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].display, "No response to airways being suctioned") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].valueDecimal, 0) - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].code, "0") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarreflexirritability") - self.assertEqual(inst.component[2].valueCodeableConcept.text, "0. No response to airways being suctioned") - self.assertEqual(inst.component[3].code.coding[0].code, "32408-7") - self.assertEqual(inst.component[3].code.coding[0].display, "1 minute Apgar Muscle Tone") - self.assertEqual(inst.component[3].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[3].code.coding[1].code, "249225007") - self.assertEqual(inst.component[3].code.coding[1].display, "Apgar muscle tone score") - self.assertEqual(inst.component[3].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[3].code.text, "Apgar muscle tone score") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].code, "LA6713-7") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].display, "Limp; no movement") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].valueDecimal, 0) - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].code, "0") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarmuscletone") - self.assertEqual(inst.component[3].valueCodeableConcept.text, "0. Limp; no movement") - self.assertEqual(inst.component[4].code.coding[0].code, "32410-3") - self.assertEqual(inst.component[4].code.coding[0].display, "1 minute Apgar Respiratory effort") - self.assertEqual(inst.component[4].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[4].code.coding[1].code, "249224006") - self.assertEqual(inst.component[4].code.coding[1].display, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[4].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].code, "LA6725-1") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].display, "Not breathing") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].valueDecimal, 0) - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].code, "0") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarrespiratoryeffort") - self.assertEqual(inst.component[4].valueCodeableConcept.text, "0. Not breathing") - self.assertEqual(inst.contained[0].id, "newborn") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-05-18T22:33:22Z").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2016-05-18T22:33:22Z") - self.assertEqual(inst.id, "1minute-apgar-score") + self.assertEqual(inst.code.text, "BMD - Left Femur") + self.assertEqual(inst.id, "bmd") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.valueQuantity.code, "{score}") + self.assertEqual(inst.valueQuantity.code, "g/cm-2") self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.value, 0) + self.assertEqual(inst.valueQuantity.unit, "g/cm²") + self.assertEqual(inst.valueQuantity.value, 0.887) def testObservation3(self): - inst = self.instantiate_from("observation-example-20minute-apgar-score.json") + inst = self.instantiate_from("observation-example-respiratory-rate.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation3(inst) @@ -246,86 +97,30 @@ def testObservation3(self): self.implObservation3(inst2) def implObservation3(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "survey") - self.assertEqual(inst.category[0].coding[0].display, "Survey") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.category[0].text, "Survey") - self.assertEqual(inst.code.coding[0].code, "443849008") - self.assertEqual(inst.code.coding[0].display, "Apgar score at 20 minutes") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "20 minute Apgar Score") - self.assertEqual(inst.component[0].code.coding[0].code, "249227004") - self.assertEqual(inst.component[0].code.coding[0].display, "Apgar color score") - self.assertEqual(inst.component[0].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.text, "Apgar color score") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6724-4") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "Good color all over") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarcolor") - self.assertEqual(inst.component[0].valueCodeableConcept.text, "2. Good color all over") - self.assertEqual(inst.component[1].code.coding[0].code, "249223000") - self.assertEqual(inst.component[1].code.coding[0].display, "Apgar heart rate score") - self.assertEqual(inst.component[1].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[1].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].code, "LA6718-6") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].display, "At least 100 beats per minute") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarheartrate") - self.assertEqual(inst.component[1].valueCodeableConcept.text, "2. At least 100 beats per minute") - self.assertEqual(inst.component[2].code.coding[0].code, "249226008") - self.assertEqual(inst.component[2].code.coding[0].display, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[2].code.text, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].code, "LA6721-0") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].display, "Grimace and pulling away, cough, or sneeze during suctioning") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarreflexirritability") - self.assertEqual(inst.component[2].valueCodeableConcept.text, "2. Grimace and pulling away, cough, or sneeze during suctioning") - self.assertEqual(inst.component[3].code.coding[0].code, "249225007") - self.assertEqual(inst.component[3].code.coding[0].display, "Apgar muscle tone score") - self.assertEqual(inst.component[3].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[3].code.text, "Apgar muscle tone score") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].code, "LA6715-2") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].display, "Active motion ") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarmuscletone") - self.assertEqual(inst.component[3].valueCodeableConcept.text, "2. Active motion") - self.assertEqual(inst.component[4].code.coding[0].code, "249224006") - self.assertEqual(inst.component[4].code.coding[0].display, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[4].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].code, "LA6727-7") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].display, "Good, strong cry; normal rate and effort of breathing ") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarrespiratoryeffort") - self.assertEqual(inst.component[4].valueCodeableConcept.text, "2. Good, strong cry; normal rate and effort of breathing") - self.assertEqual(inst.contained[0].id, "newborn") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-05-18T22:33:22Z").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2016-05-18T22:33:22Z") - self.assertEqual(inst.id, "20minute-apgar-score") + self.assertEqual(inst.category[0].coding[0].code, "vital-signs") + self.assertEqual(inst.category[0].coding[0].display, "Vital Signs") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/observation-category") + self.assertEqual(inst.category[0].text, "Vital Signs") + self.assertEqual(inst.code.coding[0].code, "9279-1") + self.assertEqual(inst.code.coding[0].display, "Respiratory rate") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "Respiratory rate") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("1999-07-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "1999-07-02") + self.assertEqual(inst.id, "respiratory-rate") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/vitalsigns") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.valueQuantity.code, "{score}") + self.assertEqual(inst.valueQuantity.code, "/min") self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.value, 10) + self.assertEqual(inst.valueQuantity.unit, "breaths/minute") + self.assertEqual(inst.valueQuantity.value, 26) def testObservation4(self): - inst = self.instantiate_from("observation-example-2minute-apgar-score.json") + inst = self.instantiate_from("observation-example.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation4(inst) @@ -335,86 +130,36 @@ def testObservation4(self): self.implObservation4(inst2) def implObservation4(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "survey") - self.assertEqual(inst.category[0].coding[0].display, "Survey") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.category[0].text, "Survey") - self.assertEqual(inst.code.coding[0].code, "9273-4") - self.assertEqual(inst.code.coding[0].display, "2 minute Apgar Score") + self.assertEqual(inst.category[0].coding[0].code, "vital-signs") + self.assertEqual(inst.category[0].coding[0].display, "Vital Signs") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/observation-category") + self.assertEqual(inst.code.coding[0].code, "29463-7") + self.assertEqual(inst.code.coding[0].display, "Body Weight") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "2 minute Apgar Score") - self.assertEqual(inst.component[0].code.coding[0].code, "249227004") - self.assertEqual(inst.component[0].code.coding[0].display, "Apgar color score") - self.assertEqual(inst.component[0].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.text, "Apgar color score") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6723-6") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "Good color in body with bluish hands or feet") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].valueDecimal, 1) - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].code, "1") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarcolor") - self.assertEqual(inst.component[0].valueCodeableConcept.text, "1. Good color in body with bluish hands or feet") - self.assertEqual(inst.component[1].code.coding[0].code, "249223000") - self.assertEqual(inst.component[1].code.coding[0].display, "Apgar heart rate score") - self.assertEqual(inst.component[1].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[1].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].code, "LA6720-2") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].display, "Fewer than 100 beats per minute") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].valueDecimal, 1) - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].code, "1") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarheartrate") - self.assertEqual(inst.component[1].valueCodeableConcept.text, "1. Fewer than 100 beats per minute") - self.assertEqual(inst.component[2].code.coding[0].code, "249226008") - self.assertEqual(inst.component[2].code.coding[0].display, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[2].code.text, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].code, "LA6721-0") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].display, "Grimace during suctioning") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].valueDecimal, 1) - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].code, "1") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarreflexirritability") - self.assertEqual(inst.component[2].valueCodeableConcept.text, "1. Grimace during suctioning") - self.assertEqual(inst.component[3].code.coding[0].code, "249225007") - self.assertEqual(inst.component[3].code.coding[0].display, "Apgar muscle tone score") - self.assertEqual(inst.component[3].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[3].code.text, "Apgar muscle tone score") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].code, "LA6714-5") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].display, "Some flexion of arms and legs") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].valueDecimal, 1) - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].code, "1") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarmuscletone") - self.assertEqual(inst.component[3].valueCodeableConcept.text, "1. Some flexion of arms and legs") - self.assertEqual(inst.component[4].code.coding[0].code, "249224006") - self.assertEqual(inst.component[4].code.coding[0].display, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.component[4].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].code, "LA6726-9") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].display, "Weak cry; may sound like whimpering, slow or irregular breathing") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].valueDecimal, 1) - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].code, "1") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarrespiratoryeffort") - self.assertEqual(inst.component[4].valueCodeableConcept.text, "1. Weak cry; may sound like whimpering, slow or irregular breathing") - self.assertEqual(inst.contained[0].id, "newborn") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-05-18T22:33:22Z").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2016-05-18T22:33:22Z") - self.assertEqual(inst.id, "2minute-apgar-score") + self.assertEqual(inst.code.coding[1].code, "3141-9") + self.assertEqual(inst.code.coding[1].display, "Body weight Measured") + self.assertEqual(inst.code.coding[1].system, "http://loinc.org") + self.assertEqual(inst.code.coding[2].code, "27113001") + self.assertEqual(inst.code.coding[2].display, "Body weight") + self.assertEqual(inst.code.coding[2].system, "http://snomed.info/sct") + self.assertEqual(inst.code.coding[3].code, "body-weight") + self.assertEqual(inst.code.coding[3].display, "Body Weight") + self.assertEqual(inst.code.coding[3].system, "http://acme.org/devices/clinical-codes") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-03-28").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2016-03-28") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.valueQuantity.code, "{score}") + self.assertEqual(inst.valueQuantity.code, "[lb_av]") self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.value, 5) + self.assertEqual(inst.valueQuantity.unit, "lbs") + self.assertEqual(inst.valueQuantity.value, 185) def testObservation5(self): - inst = self.instantiate_from("observation-example-5minute-apgar-score.json") + inst = self.instantiate_from("observation-example-haplotype2.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation5(inst) @@ -424,104 +169,27 @@ def testObservation5(self): self.implObservation5(inst2) def implObservation5(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "survey") - self.assertEqual(inst.category[0].coding[0].display, "Survey") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.category[0].text, "Survey") - self.assertEqual(inst.code.coding[0].code, "9274-2") - self.assertEqual(inst.code.coding[0].display, "5 minute Apgar Score") + self.assertEqual(inst.code.coding[0].code, "55233-1") + self.assertEqual(inst.code.coding[0].display, "Genetic analysis master panel-- This is the parent OBR for the panel holding all of the associated observations that can be reported with a molecular genetics analysis result.") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.coding[1].code, "169909004") - self.assertEqual(inst.code.coding[1].display, "Apgar at 5 minutes") - self.assertEqual(inst.code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "5 minute Apgar Score") - self.assertEqual(inst.component[0].code.coding[0].code, "32411-1") - self.assertEqual(inst.component[0].code.coding[0].display, "5 minute Apgar Color") - self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[0].code.coding[1].code, "249227004") - self.assertEqual(inst.component[0].code.coding[1].display, "Apgar color score") - self.assertEqual(inst.component[0].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.text, "Apgar color score") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].code, "LA6724-4") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].display, "Good color all over") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[0].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[0].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarcolor") - self.assertEqual(inst.component[0].valueCodeableConcept.text, "2. Good color all over") - self.assertEqual(inst.component[1].code.coding[0].code, "32412-9") - self.assertEqual(inst.component[1].code.coding[0].display, "5 minute Apgar Heart Rate") - self.assertEqual(inst.component[1].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[1].code.coding[1].code, "249223000") - self.assertEqual(inst.component[1].code.coding[1].display, "Apgar heart rate score") - self.assertEqual(inst.component[1].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[1].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].code, "LA6718-6") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].display, "At least 100 beats per minute") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[1].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[1].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarheartrate") - self.assertEqual(inst.component[1].valueCodeableConcept.text, "2. At least 100 beats per minute") - self.assertEqual(inst.component[2].code.coding[0].code, "32414-5") - self.assertEqual(inst.component[2].code.coding[0].display, "5 minute Apgar Reflex Irritability") - self.assertEqual(inst.component[2].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[2].code.coding[1].code, "249226008") - self.assertEqual(inst.component[2].code.coding[1].display, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[2].code.text, "Apgar response to stimulus score") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].code, "LA6721-0") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].display, "Grimace and pulling away, cough, or sneeze during suctioning") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[2].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[2].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarreflexirritability") - self.assertEqual(inst.component[2].valueCodeableConcept.text, "2. Grimace and pulling away, cough, or sneeze during suctioning") - self.assertEqual(inst.component[3].code.coding[0].code, "32413-7") - self.assertEqual(inst.component[3].code.coding[0].display, "5 minute Apgar Muscle Tone") - self.assertEqual(inst.component[3].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[3].code.coding[1].code, "249225007") - self.assertEqual(inst.component[3].code.coding[1].display, "Apgar muscle tone score") - self.assertEqual(inst.component[3].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[3].code.text, "Apgar muscle tone score") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].code, "LA6715-2") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].display, "Active motion ") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[3].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[3].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarmuscletone") - self.assertEqual(inst.component[3].valueCodeableConcept.text, "2. Active motion") - self.assertEqual(inst.component[4].code.coding[0].code, "32415-2") - self.assertEqual(inst.component[4].code.coding[0].display, "5 minute Apgar Respiratory effort") - self.assertEqual(inst.component[4].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[4].code.coding[1].code, "249224006") - self.assertEqual(inst.component[4].code.coding[1].display, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[4].code.text, "Apgar respiratory effort score") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].code, "LA6727-7") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].display, "Good, strong cry; normal rate and effort of breathing ") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].extension[0].valueDecimal, 2) - self.assertEqual(inst.component[4].valueCodeableConcept.coding[0].system, "http://loinc.org/la") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].code, "2") - self.assertEqual(inst.component[4].valueCodeableConcept.coding[1].system, "http:/acme.ped/apgarrespiratoryeffort") - self.assertEqual(inst.component[4].valueCodeableConcept.text, "2. Good, strong cry; normal rate and effort of breathing") - self.assertEqual(inst.contained[0].id, "newborn") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-05-18T22:33:22Z").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2016-05-18T22:33:22Z") - self.assertEqual(inst.id, "5minute-apgar-score") - self.assertEqual(inst.status, "final") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsGene") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].code, "2623") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].display, "CYP2C9") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].system, "http://www.genenames.org") + self.assertEqual(inst.id, "example-haplotype2") + self.assertEqual(inst.issued.date, FHIRDate("2013-04-03T15:30:10+01:00").date) + self.assertEqual(inst.issued.as_json(), "2013-04-03T15:30:10+01:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "unknown") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.valueQuantity.code, "{score}") - self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.value, 10) + self.assertEqual(inst.valueCodeableConcept.coding[0].code, "PA16581679") + self.assertEqual(inst.valueCodeableConcept.coding[0].display, "*4") + self.assertEqual(inst.valueCodeableConcept.coding[0].system, "http://pharmakb.org") def testObservation6(self): - inst = self.instantiate_from("observation-example-bloodpressure-cancel.json") + inst = self.instantiate_from("observation-example-mbp.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation6(inst) @@ -531,50 +199,29 @@ def testObservation6(self): self.implObservation6(inst2) def implObservation6(self, inst): - self.assertEqual(inst.bodySite.coding[0].code, "368209003") - self.assertEqual(inst.bodySite.coding[0].display, "Right arm") - self.assertEqual(inst.bodySite.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.category[0].coding[0].code, "vital-signs") self.assertEqual(inst.category[0].coding[0].display, "Vital Signs") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.code.coding[0].code, "85354-9") - self.assertEqual(inst.code.coding[0].display, "Bood pressure panel with all children optional") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/observation-category") + self.assertEqual(inst.category[0].text, "Vital Signs") + self.assertEqual(inst.code.coding[0].code, "8478-0") + self.assertEqual(inst.code.coding[0].display, "Mean blood pressure") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "Blood pressure systolic & diastolic") - self.assertEqual(inst.comment, "In this example, the blood pressure measurements are not available due to cancellation of the order. Data absent reason is present for each component") - self.assertEqual(inst.component[0].code.coding[0].code, "8480-6") - self.assertEqual(inst.component[0].code.coding[0].display, "Systolic blood pressure") - self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[0].code.coding[1].code, "271649006") - self.assertEqual(inst.component[0].code.coding[1].display, "Systolic blood pressure") - self.assertEqual(inst.component[0].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.coding[2].code, "bp-s") - self.assertEqual(inst.component[0].code.coding[2].display, "Systolic Blood pressure") - self.assertEqual(inst.component[0].code.coding[2].system, "http://acme.org/devices/clinical-codes") - self.assertEqual(inst.component[0].dataAbsentReason.coding[0].code, "not-asked") - self.assertEqual(inst.component[0].dataAbsentReason.coding[0].display, "Not Asked") - self.assertEqual(inst.component[0].dataAbsentReason.coding[0].system, "http://hl7.org/fhir/data-absent-reason") - self.assertEqual(inst.component[1].code.coding[0].code, "8462-4") - self.assertEqual(inst.component[1].code.coding[0].display, "Diastolic blood pressure") - self.assertEqual(inst.component[1].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[1].dataAbsentReason.coding[0].code, "not-asked") - self.assertEqual(inst.component[1].dataAbsentReason.coding[0].display, "Not Asked") - self.assertEqual(inst.component[1].dataAbsentReason.coding[0].system, "http://hl7.org/fhir/data-absent-reason") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2012-09-17").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2012-09-17") - self.assertEqual(inst.id, "blood-pressure-cancel") - self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier[0].value, "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281") - self.assertEqual(inst.interpretation.coding[0].code, "L") - self.assertEqual(inst.interpretation.coding[0].display, "low") - self.assertEqual(inst.interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") - self.assertEqual(inst.interpretation.text, "Below low normal") - self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/vitalsigns") - self.assertEqual(inst.status, "cancelled") + self.assertEqual(inst.code.text, "Mean blood pressure") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("1999-07-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "1999-07-02") + self.assertEqual(inst.id, "mbp") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "mm[Hg]") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "mm[Hg]") + self.assertEqual(inst.valueQuantity.value, 80) def testObservation7(self): - inst = self.instantiate_from("observation-example-bloodpressure-dar.json") + inst = self.instantiate_from("observation-example-genetics-brcapat.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation7(inst) @@ -584,50 +231,26 @@ def testObservation7(self): self.implObservation7(inst2) def implObservation7(self, inst): - self.assertEqual(inst.bodySite.coding[0].code, "368209003") - self.assertEqual(inst.bodySite.coding[0].display, "Right arm") - self.assertEqual(inst.bodySite.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].coding[0].code, "vital-signs") - self.assertEqual(inst.category[0].coding[0].display, "Vital Signs") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.code.coding[0].code, "85354-9") - self.assertEqual(inst.code.coding[0].display, "Bood pressure panel with all children optional") + self.assertEqual(inst.code.coding[0].code, "59041-4") + self.assertEqual(inst.code.coding[0].display, "BRCA1+BRCA2 gene mutations tested for in Blood or Tissue by Molecular genetics method Nominal") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "Blood pressure systolic & diastolic") - self.assertEqual(inst.component[0].code.coding[0].code, "8480-6") - self.assertEqual(inst.component[0].code.coding[0].display, "Systolic blood pressure") - self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[0].code.coding[1].code, "271649006") - self.assertEqual(inst.component[0].code.coding[1].display, "Systolic blood pressure") - self.assertEqual(inst.component[0].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.coding[2].code, "bp-s") - self.assertEqual(inst.component[0].code.coding[2].display, "Systolic Blood pressure") - self.assertEqual(inst.component[0].code.coding[2].system, "http://acme.org/devices/clinical-codes") - self.assertEqual(inst.component[0].valueQuantity.code, "mm[Hg]") - self.assertEqual(inst.component[0].valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.component[0].valueQuantity.unit, "mmHg") - self.assertEqual(inst.component[0].valueQuantity.value, 107) - self.assertEqual(inst.component[1].code.coding[0].code, "8462-4") - self.assertEqual(inst.component[1].code.coding[0].display, "Diastolic blood pressure") - self.assertEqual(inst.component[1].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[1].dataAbsentReason.coding[0].code, "not-performed") - self.assertEqual(inst.component[1].dataAbsentReason.coding[0].display, "Not Performed") - self.assertEqual(inst.component[1].dataAbsentReason.coding[0].system, "http://hl7.org/fhir/data-absent-reason") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2012-09-17").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2012-09-17") - self.assertEqual(inst.id, "blood-pressure-dar") - self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier[0].value, "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281") - self.assertEqual(inst.interpretation.coding[0].code, "L") - self.assertEqual(inst.interpretation.coding[0].display, "low") - self.assertEqual(inst.interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") - self.assertEqual(inst.interpretation.text, "Below low normal") - self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/vitalsigns") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/observation-geneticsGene") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].code, "KX470182.1") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].display, "BRCA") + self.assertEqual(inst.extension[0].valueCodeableConcept.coding[0].system, "https://www.ncbi.nlm.nih.gov/nuccore") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].code, "413581001") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].display, "Unknown racial group") + self.assertEqual(inst.extension[1].valueCodeableConcept.coding[0].system, "http://browser.ihtsdotools.org/") + self.assertEqual(inst.id, "example-genetics-brcapat") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") def testObservation8(self): - inst = self.instantiate_from("observation-example-bloodpressure.json") + inst = self.instantiate_from("observation-example-bmi.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation8(inst) @@ -637,59 +260,30 @@ def testObservation8(self): self.implObservation8(inst2) def implObservation8(self, inst): - self.assertEqual(inst.bodySite.coding[0].code, "368209003") - self.assertEqual(inst.bodySite.coding[0].display, "Right arm") - self.assertEqual(inst.bodySite.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.category[0].coding[0].code, "vital-signs") self.assertEqual(inst.category[0].coding[0].display, "Vital Signs") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.code.coding[0].code, "85354-9") - self.assertEqual(inst.code.coding[0].display, "Bood pressure panel with all children optional") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/observation-category") + self.assertEqual(inst.category[0].text, "Vital Signs") + self.assertEqual(inst.code.coding[0].code, "39156-5") + self.assertEqual(inst.code.coding[0].display, "Body mass index (BMI) [Ratio]") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "Blood pressure systolic & diastolic") - self.assertEqual(inst.component[0].code.coding[0].code, "8480-6") - self.assertEqual(inst.component[0].code.coding[0].display, "Systolic blood pressure") - self.assertEqual(inst.component[0].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[0].code.coding[1].code, "271649006") - self.assertEqual(inst.component[0].code.coding[1].display, "Systolic blood pressure") - self.assertEqual(inst.component[0].code.coding[1].system, "http://snomed.info/sct") - self.assertEqual(inst.component[0].code.coding[2].code, "bp-s") - self.assertEqual(inst.component[0].code.coding[2].display, "Systolic Blood pressure") - self.assertEqual(inst.component[0].code.coding[2].system, "http://acme.org/devices/clinical-codes") - self.assertEqual(inst.component[0].interpretation.coding[0].code, "N") - self.assertEqual(inst.component[0].interpretation.coding[0].display, "normal") - self.assertEqual(inst.component[0].interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") - self.assertEqual(inst.component[0].interpretation.text, "Normal") - self.assertEqual(inst.component[0].valueQuantity.code, "mm[Hg]") - self.assertEqual(inst.component[0].valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.component[0].valueQuantity.unit, "mmHg") - self.assertEqual(inst.component[0].valueQuantity.value, 107) - self.assertEqual(inst.component[1].code.coding[0].code, "8462-4") - self.assertEqual(inst.component[1].code.coding[0].display, "Diastolic blood pressure") - self.assertEqual(inst.component[1].code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.component[1].interpretation.coding[0].code, "L") - self.assertEqual(inst.component[1].interpretation.coding[0].display, "low") - self.assertEqual(inst.component[1].interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") - self.assertEqual(inst.component[1].interpretation.text, "Below low normal") - self.assertEqual(inst.component[1].valueQuantity.code, "mm[Hg]") - self.assertEqual(inst.component[1].valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.component[1].valueQuantity.unit, "mmHg") - self.assertEqual(inst.component[1].valueQuantity.value, 60) - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2012-09-17").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "2012-09-17") - self.assertEqual(inst.id, "blood-pressure") - self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier[0].value, "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281") - self.assertEqual(inst.interpretation.coding[0].code, "L") - self.assertEqual(inst.interpretation.coding[0].display, "low") - self.assertEqual(inst.interpretation.coding[0].system, "http://hl7.org/fhir/v2/0078") - self.assertEqual(inst.interpretation.text, "Below low normal") + self.assertEqual(inst.code.text, "BMI") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("1999-07-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "1999-07-02") + self.assertEqual(inst.id, "bmi") self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/vitalsigns") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.valueQuantity.code, "kg/m2") + self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.valueQuantity.unit, "kg/m2") + self.assertEqual(inst.valueQuantity.value, 16.2) def testObservation9(self): - inst = self.instantiate_from("observation-example-bmd.json") + inst = self.instantiate_from("observation-example-body-height.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation9(inst) @@ -699,23 +293,30 @@ def testObservation9(self): self.implObservation9(inst2) def implObservation9(self, inst): - self.assertEqual(inst.bodySite.coding[0].code, "71341001:272741003=7771000") - self.assertEqual(inst.bodySite.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.bodySite.text, "Left Femur") - self.assertEqual(inst.code.coding[0].code, "24701-5") - self.assertEqual(inst.code.coding[0].display, "Femur DXA Bone density") + self.assertEqual(inst.category[0].coding[0].code, "vital-signs") + self.assertEqual(inst.category[0].coding[0].display, "Vital Signs") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/observation-category") + self.assertEqual(inst.category[0].text, "Vital Signs") + self.assertEqual(inst.code.coding[0].code, "8302-2") + self.assertEqual(inst.code.coding[0].display, "Body height") self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "BMD - Left Femur") - self.assertEqual(inst.id, "bmd") + self.assertEqual(inst.code.text, "Body height") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("1999-07-02").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "1999-07-02") + self.assertEqual(inst.id, "body-height") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/vitalsigns") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.valueQuantity.code, "g/cm-2") + self.assertEqual(inst.valueQuantity.code, "[in_i]") self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.unit, "g/cm²") - self.assertEqual(inst.valueQuantity.value, 0.887) + self.assertEqual(inst.valueQuantity.unit, "in") + self.assertEqual(inst.valueQuantity.value, 66.89999999999999) def testObservation10(self): - inst = self.instantiate_from("observation-example-bmi.json") + inst = self.instantiate_from("observation-example-eye-color.json") self.assertIsNotNone(inst, "Must have instantiated a Observation instance") self.implObservation10(inst) @@ -725,22 +326,14 @@ def testObservation10(self): self.implObservation10(inst2) def implObservation10(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "vital-signs") - self.assertEqual(inst.category[0].coding[0].display, "Vital Signs") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org/fhir/observation-category") - self.assertEqual(inst.category[0].text, "Vital Signs") - self.assertEqual(inst.code.coding[0].code, "39156-5") - self.assertEqual(inst.code.coding[0].display, "Body mass index (BMI) [Ratio]") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "BMI") - self.assertEqual(inst.effectiveDateTime.date, FHIRDate("1999-07-02").date) - self.assertEqual(inst.effectiveDateTime.as_json(), "1999-07-02") - self.assertEqual(inst.id, "bmi") - self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/vitalsigns") + self.assertEqual(inst.code.text, "eye color") + self.assertEqual(inst.effectiveDateTime.date, FHIRDate("2016-05-18").date) + self.assertEqual(inst.effectiveDateTime.as_json(), "2016-05-18") + self.assertEqual(inst.id, "eye-color") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.valueQuantity.code, "kg/m2") - self.assertEqual(inst.valueQuantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.valueQuantity.unit, "kg/m2") - self.assertEqual(inst.valueQuantity.value, 16.2) + self.assertEqual(inst.valueString, "blue") diff --git a/fhirclient/models/observationdefinition.py b/fhirclient/models/observationdefinition.py new file mode 100644 index 000000000..9f5d381c8 --- /dev/null +++ b/fhirclient/models/observationdefinition.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ObservationDefinition) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class ObservationDefinition(domainresource.DomainResource): + """ Definition of an observation. + + Set of definitional characteristics for a kind of observation or + measurement produced or consumed by an orderable health care service. + """ + + resource_type = "ObservationDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.abnormalCodedValueSet = None + """ Value set of abnormal coded values for the observations conforming + to this ObservationDefinition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.category = None + """ Category of observation. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.code = None + """ Type of observation (code / type). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.criticalCodedValueSet = None + """ Value set of critical coded values for the observations conforming + to this ObservationDefinition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier for this ObservationDefinition instance. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.method = None + """ Method used to produce the observation. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.multipleResultsAllowed = None + """ Multiple results allowed. + Type `bool`. """ + + self.normalCodedValueSet = None + """ Value set of normal coded values for the observations conforming to + this ObservationDefinition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.permittedDataType = None + """ Quantity | CodeableConcept | string | boolean | integer | Range | + Ratio | SampledData | time | dateTime | Period. + List of `str` items. """ + + self.preferredReportName = None + """ Preferred report name. + Type `str`. """ + + self.qualifiedInterval = None + """ Qualified range for continuous and ordinal observation results. + List of `ObservationDefinitionQualifiedInterval` items (represented as `dict` in JSON). """ + + self.quantitativeDetails = None + """ Characteristics of quantitative results. + Type `ObservationDefinitionQuantitativeDetails` (represented as `dict` in JSON). """ + + self.validCodedValueSet = None + """ Value set of valid coded values for the observations conforming to + this ObservationDefinition. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(ObservationDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ObservationDefinition, self).elementProperties() + js.extend([ + ("abnormalCodedValueSet", "abnormalCodedValueSet", fhirreference.FHIRReference, False, None, False), + ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, True), + ("criticalCodedValueSet", "criticalCodedValueSet", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("multipleResultsAllowed", "multipleResultsAllowed", bool, False, None, False), + ("normalCodedValueSet", "normalCodedValueSet", fhirreference.FHIRReference, False, None, False), + ("permittedDataType", "permittedDataType", str, True, None, False), + ("preferredReportName", "preferredReportName", str, False, None, False), + ("qualifiedInterval", "qualifiedInterval", ObservationDefinitionQualifiedInterval, True, None, False), + ("quantitativeDetails", "quantitativeDetails", ObservationDefinitionQuantitativeDetails, False, None, False), + ("validCodedValueSet", "validCodedValueSet", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +from . import backboneelement + +class ObservationDefinitionQualifiedInterval(backboneelement.BackboneElement): + """ Qualified range for continuous and ordinal observation results. + + Multiple ranges of results qualified by different contexts for ordinal or + continuous observations conforming to this ObservationDefinition. + """ + + resource_type = "ObservationDefinitionQualifiedInterval" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.age = None + """ Applicable age range, if relevant. + Type `Range` (represented as `dict` in JSON). """ + + self.appliesTo = None + """ Targetted population of the range. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.category = None + """ reference | critical | absolute. + Type `str`. """ + + self.condition = None + """ Condition associated with the reference range. + Type `str`. """ + + self.context = None + """ Range context qualifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.gender = None + """ male | female | other | unknown. + Type `str`. """ + + self.gestationalAge = None + """ Applicable gestational age range, if relevant. + Type `Range` (represented as `dict` in JSON). """ + + self.range = None + """ The interval itself, for continuous or ordinal observations. + Type `Range` (represented as `dict` in JSON). """ + + super(ObservationDefinitionQualifiedInterval, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ObservationDefinitionQualifiedInterval, self).elementProperties() + js.extend([ + ("age", "age", range.Range, False, None, False), + ("appliesTo", "appliesTo", codeableconcept.CodeableConcept, True, None, False), + ("category", "category", str, False, None, False), + ("condition", "condition", str, False, None, False), + ("context", "context", codeableconcept.CodeableConcept, False, None, False), + ("gender", "gender", str, False, None, False), + ("gestationalAge", "gestationalAge", range.Range, False, None, False), + ("range", "range", range.Range, False, None, False), + ]) + return js + + +class ObservationDefinitionQuantitativeDetails(backboneelement.BackboneElement): + """ Characteristics of quantitative results. + + Characteristics for quantitative results of this observation. + """ + + resource_type = "ObservationDefinitionQuantitativeDetails" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.conversionFactor = None + """ SI to Customary unit conversion factor. + Type `float`. """ + + self.customaryUnit = None + """ Customary unit for quantitative results. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.decimalPrecision = None + """ Decimal precision of observation quantitative results. + Type `int`. """ + + self.unit = None + """ SI unit for quantitative results. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ObservationDefinitionQuantitativeDetails, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ObservationDefinitionQuantitativeDetails, self).elementProperties() + js.extend([ + ("conversionFactor", "conversionFactor", float, False, None, False), + ("customaryUnit", "customaryUnit", codeableconcept.CodeableConcept, False, None, False), + ("decimalPrecision", "decimalPrecision", int, False, None, False), + ("unit", "unit", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/observationdefinition_tests.py b/fhirclient/models/observationdefinition_tests.py new file mode 100644 index 000000000..df5b4f66b --- /dev/null +++ b/fhirclient/models/observationdefinition_tests.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import observationdefinition +from .fhirdate import FHIRDate + + +class ObservationDefinitionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("ObservationDefinition", js["resourceType"]) + return observationdefinition.ObservationDefinition(js) + + def testObservationDefinition1(self): + inst = self.instantiate_from("observationdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ObservationDefinition instance") + self.implObservationDefinition1(inst) + + js = inst.as_json() + self.assertEqual("ObservationDefinition", js["resourceType"]) + inst2 = observationdefinition.ObservationDefinition(js) + self.implObservationDefinition1(inst2) + + def implObservationDefinition1(self, inst): + self.assertEqual(inst.code.coding[0].code, "15074-8") + self.assertEqual(inst.code.coding[0].display, "Glucose [Moles/volume] in Blood") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/operationdefinition.py b/fhirclient/models/operationdefinition.py index 229aa5b24..631c02626 100644 --- a/fhirclient/models/operationdefinition.py +++ b/fhirclient/models/operationdefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -24,9 +24,13 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.affectsState = None + """ Whether content is changed by the operation. + Type `bool`. """ + self.base = None """ Marks this as a profile of the base. - Type `FHIRReference` referencing `OperationDefinition` (represented as `dict` in JSON). """ + Type `str`. """ self.code = None """ Name used to invoke the operation. @@ -41,7 +45,7 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -52,9 +56,9 @@ def __init__(self, jsondict=None, strict=True): """ For testing purposes, not real usage. Type `bool`. """ - self.idempotent = None - """ Whether content is unchanged by the operation. - Type `bool`. """ + self.inputProfile = None + """ Validation information for in parameters. + Type `str`. """ self.instance = None """ Invoke on an instance?. @@ -72,6 +76,10 @@ def __init__(self, jsondict=None, strict=True): """ Name for this operation definition (computer friendly). Type `str`. """ + self.outputProfile = None + """ Validation information for out parameters. + Type `str`. """ + self.overload = None """ Define overloaded variants for when generating code. List of `OperationDefinitionOverload` items (represented as `dict` in JSON). """ @@ -100,17 +108,21 @@ def __init__(self, jsondict=None, strict=True): """ Invoke at the system level?. Type `bool`. """ + self.title = None + """ Name for this operation definition (human friendly). + Type `str`. """ + self.type = None - """ Invole at the type level?. + """ Invoke at the type level?. Type `bool`. """ self.url = None - """ Logical URI to reference this operation definition (globally - unique). + """ Canonical identifier for this operation definition, represented as + a URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -122,18 +134,20 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(OperationDefinition, self).elementProperties() js.extend([ - ("base", "base", fhirreference.FHIRReference, False, None, False), + ("affectsState", "affectsState", bool, False, None, False), + ("base", "base", str, False, None, False), ("code", "code", str, False, None, True), ("comment", "comment", str, False, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), ("experimental", "experimental", bool, False, None, False), - ("idempotent", "idempotent", bool, False, None, False), + ("inputProfile", "inputProfile", str, False, None, False), ("instance", "instance", bool, False, None, True), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("kind", "kind", str, False, None, True), ("name", "name", str, False, None, True), + ("outputProfile", "outputProfile", str, False, None, False), ("overload", "overload", OperationDefinitionOverload, True, None, False), ("parameter", "parameter", OperationDefinitionParameter, True, None, False), ("publisher", "publisher", str, False, None, False), @@ -141,6 +155,7 @@ def elementProperties(self): ("resource", "resource", str, True, None, False), ("status", "status", str, False, None, True), ("system", "system", bool, False, None, True), + ("title", "title", str, False, None, False), ("type", "type", bool, False, None, True), ("url", "url", str, False, None, False), ("useContext", "useContext", usagecontext.UsageContext, True, None, False), @@ -228,15 +243,19 @@ def __init__(self, jsondict=None, strict=True): """ Parts of a nested Parameter. List of `OperationDefinitionParameter` items (represented as `dict` in JSON). """ - self.profile = None - """ Profile on the type. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + self.referencedFrom = None + """ References to this parameter. + List of `OperationDefinitionParameterReferencedFrom` items (represented as `dict` in JSON). """ self.searchType = None """ number | date | string | token | reference | composite | quantity | - uri. + uri | special. Type `str`. """ + self.targetProfile = None + """ If type is Reference | canonical, allowed targets. + List of `str` items. """ + self.type = None """ What type this parameter has. Type `str`. """ @@ -256,8 +275,9 @@ def elementProperties(self): ("min", "min", int, False, None, True), ("name", "name", str, False, None, True), ("part", "part", OperationDefinitionParameter, True, None, False), - ("profile", "profile", fhirreference.FHIRReference, False, None, False), + ("referencedFrom", "referencedFrom", OperationDefinitionParameterReferencedFrom, True, None, False), ("searchType", "searchType", str, False, None, False), + ("targetProfile", "targetProfile", str, True, None, False), ("type", "type", str, False, None, False), ("use", "use", str, False, None, True), ]) @@ -285,11 +305,7 @@ def __init__(self, jsondict=None, strict=True): """ required | extensible | preferred | example. Type `str`. """ - self.valueSetReference = None - """ Source of value set. - Type `FHIRReference` referencing `ValueSet` (represented as `dict` in JSON). """ - - self.valueSetUri = None + self.valueSet = None """ Source of value set. Type `str`. """ @@ -299,8 +315,43 @@ def elementProperties(self): js = super(OperationDefinitionParameterBinding, self).elementProperties() js.extend([ ("strength", "strength", str, False, None, True), - ("valueSetReference", "valueSetReference", fhirreference.FHIRReference, False, "valueSet", True), - ("valueSetUri", "valueSetUri", str, False, "valueSet", True), + ("valueSet", "valueSet", str, False, None, True), + ]) + return js + + +class OperationDefinitionParameterReferencedFrom(backboneelement.BackboneElement): + """ References to this parameter. + + Identifies other resource parameters within the operation invocation that + are expected to resolve to this resource. + """ + + resource_type = "OperationDefinitionParameterReferencedFrom" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.source = None + """ Referencing parameter. + Type `str`. """ + + self.sourceId = None + """ Element id of reference. + Type `str`. """ + + super(OperationDefinitionParameterReferencedFrom, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OperationDefinitionParameterReferencedFrom, self).elementProperties() + js.extend([ + ("source", "source", str, False, None, True), + ("sourceId", "sourceId", str, False, None, False), ]) return js @@ -318,10 +369,6 @@ def elementProperties(self): from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import usagecontext except ImportError: diff --git a/fhirclient/models/operationdefinition_tests.py b/fhirclient/models/operationdefinition_tests.py index aff5ce827..9d4fac102 100644 --- a/fhirclient/models/operationdefinition_tests.py +++ b/fhirclient/models/operationdefinition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,6 +32,7 @@ def testOperationDefinition1(self): self.implOperationDefinition1(inst2) def implOperationDefinition1(self, inst): + self.assertEqual(inst.base, "OperationDefinition/Questionnaire-populate") self.assertEqual(inst.code, "populate") self.assertEqual(inst.comment, "Only implemented for Labs and Medications so far") self.assertEqual(inst.contact[0].name, "System Administrator") @@ -39,7 +40,7 @@ def implOperationDefinition1(self, inst): self.assertEqual(inst.contact[0].telecom[0].value, "beep@coyote.acme.com") self.assertEqual(inst.date.date, FHIRDate("2015-08-04").date) self.assertEqual(inst.date.as_json(), "2015-08-04") - self.assertEqual(inst.description, "Limited implementation of the Populate Questionnaire implemenation") + self.assertEqual(inst.description, "Limited implementation of the Populate Questionnaire implementation") self.assertEqual(inst.id, "example") self.assertTrue(inst.instance) self.assertEqual(inst.jurisdiction[0].coding[0].code, "GB") @@ -80,6 +81,6 @@ def implOperationDefinition1(self, inst): self.assertEqual(inst.useContext[0].code.system, "http://build.fhir.org/codesystem-usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "IMP") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "inpatient encounter") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/v3/ActCode") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActCode") self.assertEqual(inst.version, "B") diff --git a/fhirclient/models/operationoutcome.py b/fhirclient/models/operationoutcome.py index 39c9b157a..eca22f0c8 100644 --- a/fhirclient/models/operationoutcome.py +++ b/fhirclient/models/operationoutcome.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,7 +10,7 @@ class OperationOutcome(domainresource.DomainResource): """ Information about the success/failure of an action. - A collection of error, warning or information messages that result from a + A collection of error, warning, or information messages that result from a system action. """ @@ -43,7 +43,8 @@ def elementProperties(self): class OperationOutcomeIssue(backboneelement.BackboneElement): """ A single issue associated with the action. - An error, warning or information message that results from a system action. + An error, warning, or information message that results from a system + action. """ resource_type = "OperationOutcomeIssue" @@ -73,7 +74,7 @@ def __init__(self, jsondict=None, strict=True): List of `str` items. """ self.location = None - """ Path of element(s) related to issue. + """ Deprecated: Path of element(s) related to issue. List of `str` items. """ self.severity = None diff --git a/fhirclient/models/operationoutcome_tests.py b/fhirclient/models/operationoutcome_tests.py index 16c537ca9..f1e5c7cc6 100644 --- a/fhirclient/models/operationoutcome_tests.py +++ b/fhirclient/models/operationoutcome_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return operationoutcome.OperationOutcome(js) def testOperationOutcome1(self): - inst = self.instantiate_from("operationoutcome-example-allok.json") + inst = self.instantiate_from("operationoutcome-example-validationfail.json") self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") self.implOperationOutcome1(inst) @@ -32,11 +32,16 @@ def testOperationOutcome1(self): self.implOperationOutcome1(inst2) def implOperationOutcome1(self, inst): - self.assertEqual(inst.id, "allok") - self.assertEqual(inst.issue[0].code, "informational") - self.assertEqual(inst.issue[0].details.text, "All OK") - self.assertEqual(inst.issue[0].severity, "information") - self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.id, "validationfail") + self.assertEqual(inst.issue[0].code, "structure") + self.assertEqual(inst.issue[0].details.text, "Error parsing resource XML (Unknown Content \"label\"") + self.assertEqual(inst.issue[0].expression[0], "Patient.identifier") + self.assertEqual(inst.issue[0].location[0], "/f:Patient/f:identifier") + self.assertEqual(inst.issue[0].severity, "error") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") def testOperationOutcome2(self): inst = self.instantiate_from("operationoutcome-example-break-the-glass.json") @@ -53,13 +58,16 @@ def implOperationOutcome2(self, inst): self.assertEqual(inst.issue[0].code, "suppressed") self.assertEqual(inst.issue[0].details.coding[0].code, "ETREAT") self.assertEqual(inst.issue[0].details.coding[0].display, "Emergency Treatment") - self.assertEqual(inst.issue[0].details.coding[0].system, "http://hl7.org/fhir/v3/ActReason") + self.assertEqual(inst.issue[0].details.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.issue[0].details.text, "Additional information may be available using the Break-The-Glass Protocol") self.assertEqual(inst.issue[0].severity, "information") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") def testOperationOutcome3(self): - inst = self.instantiate_from("operationoutcome-example-exception.json") + inst = self.instantiate_from("operationoutcome-example-searchfail.json") self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") self.implOperationOutcome3(inst) @@ -69,14 +77,18 @@ def testOperationOutcome3(self): self.implOperationOutcome3(inst2) def implOperationOutcome3(self, inst): - self.assertEqual(inst.id, "exception") - self.assertEqual(inst.issue[0].code, "exception") - self.assertEqual(inst.issue[0].details.text, "SQL Link Communication Error (dbx = 34234)") - self.assertEqual(inst.issue[0].severity, "error") - self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.id, "searchfail") + self.assertEqual(inst.issue[0].code, "code-invalid") + self.assertEqual(inst.issue[0].details.text, "The \"name\" parameter has the modifier \"exact\" which is not supported by this server") + self.assertEqual(inst.issue[0].location[0], "http.name:exact") + self.assertEqual(inst.issue[0].severity, "fatal") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") def testOperationOutcome4(self): - inst = self.instantiate_from("operationoutcome-example-searchfail.json") + inst = self.instantiate_from("operationoutcome-example-exception.json") self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") self.implOperationOutcome4(inst) @@ -86,15 +98,17 @@ def testOperationOutcome4(self): self.implOperationOutcome4(inst2) def implOperationOutcome4(self, inst): - self.assertEqual(inst.id, "searchfail") - self.assertEqual(inst.issue[0].code, "code-invalid") - self.assertEqual(inst.issue[0].details.text, "The \"name\" parameter has the modifier \"exact\" which is not supported by this server") - self.assertEqual(inst.issue[0].location[0], "http.name:exact") - self.assertEqual(inst.issue[0].severity, "fatal") + self.assertEqual(inst.id, "exception") + self.assertEqual(inst.issue[0].code, "exception") + self.assertEqual(inst.issue[0].details.text, "SQL Link Communication Error (dbx = 34234)") + self.assertEqual(inst.issue[0].severity, "error") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") def testOperationOutcome5(self): - inst = self.instantiate_from("operationoutcome-example-validationfail.json") + inst = self.instantiate_from("operationoutcome-example.json") self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") self.implOperationOutcome5(inst) @@ -104,16 +118,20 @@ def testOperationOutcome5(self): self.implOperationOutcome5(inst2) def implOperationOutcome5(self, inst): - self.assertEqual(inst.id, "validationfail") - self.assertEqual(inst.issue[0].code, "structure") - self.assertEqual(inst.issue[0].details.text, "Error parsing resource XML (Unknown Content \"label\"") - self.assertEqual(inst.issue[0].expression[0], "Patient.identifier") - self.assertEqual(inst.issue[0].location[0], "/f:Patient/f:identifier") + self.assertEqual(inst.id, "101") + self.assertEqual(inst.issue[0].code, "code-invalid") + self.assertEqual(inst.issue[0].details.text, "The code \"W\" is not known and not legal in this context") + self.assertEqual(inst.issue[0].diagnostics, "Acme.Interop.FHIRProcessors.Patient.processGender line 2453") + self.assertEqual(inst.issue[0].expression[0], "Patient.gender") + self.assertEqual(inst.issue[0].location[0], "/f:Patient/f:gender") self.assertEqual(inst.issue[0].severity, "error") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") def testOperationOutcome6(self): - inst = self.instantiate_from("operationoutcome-example.json") + inst = self.instantiate_from("operationoutcome-example-allok.json") self.assertIsNotNone(inst, "Must have instantiated a OperationOutcome instance") self.implOperationOutcome6(inst) @@ -123,12 +141,12 @@ def testOperationOutcome6(self): self.implOperationOutcome6(inst2) def implOperationOutcome6(self, inst): - self.assertEqual(inst.id, "101") - self.assertEqual(inst.issue[0].code, "code-invalid") - self.assertEqual(inst.issue[0].details.text, "The code \"W\" is not known and not legal in this context") - self.assertEqual(inst.issue[0].diagnostics, "Acme.Interop.FHIRProcessors.Patient.processGender line 2453") - self.assertEqual(inst.issue[0].expression[0], "Person.gender") - self.assertEqual(inst.issue[0].location[0], "/f:Person/f:gender") - self.assertEqual(inst.issue[0].severity, "error") - self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.id, "allok") + self.assertEqual(inst.issue[0].code, "informational") + self.assertEqual(inst.issue[0].details.text, "All OK") + self.assertEqual(inst.issue[0].severity, "information") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/organization.py b/fhirclient/models/organization.py index 88065dce9..81f597e7a 100644 --- a/fhirclient/models/organization.py +++ b/fhirclient/models/organization.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Organization) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Organization) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -13,7 +13,7 @@ class Organization(domainresource.DomainResource): A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action. Includes companies, institutions, corporations, departments, community - groups, healthcare practice groups, etc. + groups, healthcare practice groups, payer/insurer, etc. """ resource_type = "Organization" @@ -35,7 +35,7 @@ def __init__(self, jsondict=None, strict=True): List of `Address` items (represented as `dict` in JSON). """ self.alias = None - """ A list of alternate names that the organization is known as, or was + """ A list of alternate names that the organization is known as, or was known as in the past. List of `str` items. """ @@ -46,7 +46,7 @@ def __init__(self, jsondict=None, strict=True): self.endpoint = None """ Technical endpoints providing access to services operated for the organization. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None """ Identifies this organization across multiple systems. @@ -58,7 +58,7 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ The organization of which this organization forms a part. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.telecom = None """ A contact detail for the organization. diff --git a/fhirclient/models/organization_tests.py b/fhirclient/models/organization_tests.py index a5c8601fc..427015693 100644 --- a/fhirclient/models/organization_tests.py +++ b/fhirclient/models/organization_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return organization.Organization(js) def testOrganization1(self): - inst = self.instantiate_from("organization-example-f001-burgers.json") + inst = self.instantiate_from("organization-example.json") self.assertIsNotNone(inst, "Must have instantiated a Organization instance") self.implOrganization1(inst) @@ -32,45 +32,27 @@ def testOrganization1(self): self.implOrganization1(inst2) def implOrganization1(self, inst): - self.assertEqual(inst.address[0].city, "Den Burg") - self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") - self.assertEqual(inst.address[0].postalCode, "9105 PZ") - self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.address[1].city, "Den Burg") - self.assertEqual(inst.address[1].country, "NLD") - self.assertEqual(inst.address[1].line[0], "PO Box 2311") - self.assertEqual(inst.address[1].postalCode, "9100 AA") - self.assertEqual(inst.address[1].use, "work") - self.assertEqual(inst.contact[0].purpose.coding[0].code, "PRESS") - self.assertEqual(inst.contact[0].purpose.coding[0].system, "http://hl7.org/fhir/contactentity-type") - self.assertEqual(inst.contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contact[0].telecom[0].value, "022-655 2334") - self.assertEqual(inst.contact[1].purpose.coding[0].code, "PATINF") - self.assertEqual(inst.contact[1].purpose.coding[0].system, "http://hl7.org/fhir/contactentity-type") - self.assertEqual(inst.contact[1].telecom[0].system, "phone") - self.assertEqual(inst.contact[1].telecom[0].value, "022-655 2335") - self.assertEqual(inst.id, "f001") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "91654") - self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.1") - self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.identifier[1].value, "17-0112278") - self.assertEqual(inst.name, "Burgers University Medical Center") + self.assertEqual(inst.address[0].city, "Ann Arbor") + self.assertEqual(inst.address[0].country, "USA") + self.assertEqual(inst.address[0].line[0], "3300 Washtenaw Avenue, Suite 227") + self.assertEqual(inst.address[0].postalCode, "48104") + self.assertEqual(inst.address[0].state, "MI") + self.assertEqual(inst.alias[0], "HL7 International") + self.assertEqual(inst.id, "hl7") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Health Level Seven International") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "022-655 2300") + self.assertEqual(inst.telecom[0].value, "(+1) 734-677-7777") + self.assertEqual(inst.telecom[1].system, "fax") + self.assertEqual(inst.telecom[1].value, "(+1) 734-677-6622") + self.assertEqual(inst.telecom[2].system, "email") + self.assertEqual(inst.telecom[2].value, "hq@HL7.org") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "V6") - self.assertEqual(inst.type[0].coding[0].display, "University Medical Hospital") - self.assertEqual(inst.type[0].coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.1060") - self.assertEqual(inst.type[0].coding[1].code, "prov") - self.assertEqual(inst.type[0].coding[1].display, "Healthcare Provider") - self.assertEqual(inst.type[0].coding[1].system, "http://hl7.org/fhir/organization-type") def testOrganization2(self): - inst = self.instantiate_from("organization-example-f002-burgers-card.json") + inst = self.instantiate_from("organization-example-mmanu.json") self.assertIsNotNone(inst, "Must have instantiated a Organization instance") self.implOrganization2(inst) @@ -81,28 +63,16 @@ def testOrganization2(self): def implOrganization2(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.address[0].line[0], "South Wing, floor 2") - self.assertEqual(inst.contact[0].address.line[0], "South Wing, floor 2") - self.assertEqual(inst.contact[0].name.text, "mevr. D. de Haan") - self.assertEqual(inst.contact[0].purpose.coding[0].code, "ADMIN") - self.assertEqual(inst.contact[0].purpose.coding[0].system, "http://hl7.org/fhir/contactentity-type") - self.assertEqual(inst.contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contact[0].telecom[0].value, "022-655 2321") - self.assertEqual(inst.contact[0].telecom[1].system, "email") - self.assertEqual(inst.contact[0].telecom[1].value, "cardio@burgersumc.nl") - self.assertEqual(inst.contact[0].telecom[2].system, "fax") - self.assertEqual(inst.contact[0].telecom[2].value, "022-655 2322") - self.assertEqual(inst.id, "f002") - self.assertEqual(inst.name, "Burgers UMC Cardiology unit") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].value, "022-655 2320") + self.assertEqual(inst.address[0].country, "Swizterland") + self.assertEqual(inst.id, "mmanu") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Acme Corporation") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "dept") - self.assertEqual(inst.type[0].coding[0].display, "Hospital Department") - self.assertEqual(inst.type[0].coding[0].system, "http://hl7.org/fhir/organization-type") def testOrganization3(self): - inst = self.instantiate_from("organization-example-f003-burgers-ENT.json") + inst = self.instantiate_from("organization-example-gastro.json") self.assertIsNotNone(inst, "Must have instantiated a Organization instance") self.implOrganization3(inst) @@ -112,38 +82,114 @@ def testOrganization3(self): self.implOrganization3(inst2) def implOrganization3(self, inst): + self.assertEqual(inst.id, "1") + self.assertEqual(inst.identifier[0].system, "http://www.acme.org.au/units") + self.assertEqual(inst.identifier[0].value, "Gastro") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Gastroenterology") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "mobile") + self.assertEqual(inst.telecom[0].value, "+1 555 234 3523") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "gastro@acme.org") + self.assertEqual(inst.text.status, "generated") + + def testOrganization4(self): + inst = self.instantiate_from("organization-example-mihealth.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization4(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization4(inst2) + + def implOrganization4(self, inst): + self.assertEqual(inst.alias[0], "Michigan State Department of Health") + self.assertEqual(inst.id, "3") + self.assertEqual(inst.identifier[0].system, "http://michigan.gov/state-dept-ids") + self.assertEqual(inst.identifier[0].value, "25") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Michigan Health") + self.assertEqual(inst.text.status, "generated") + + def testOrganization5(self): + inst = self.instantiate_from("organization-example-lab.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization5(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization5(inst2) + + def implOrganization5(self, inst): + self.assertEqual(inst.id, "1832473e-2fe0-452d-abe9-3cdb9879522f") + self.assertEqual(inst.identifier[0].system, "http://www.acme.org.au/units") + self.assertEqual(inst.identifier[0].value, "ClinLab") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Clinical Lab") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "+1 555 234 1234") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "work") + self.assertEqual(inst.telecom[1].value, "contact@labs.acme.org") + self.assertEqual(inst.text.status, "generated") + + def testOrganization6(self): + inst = self.instantiate_from("organization-example-f002-burgers-card.json") + self.assertIsNotNone(inst, "Must have instantiated a Organization instance") + self.implOrganization6(inst) + + js = inst.as_json() + self.assertEqual("Organization", js["resourceType"]) + inst2 = organization.Organization(js) + self.implOrganization6(inst2) + + def implOrganization6(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.address[0].line[0], "West Wing, floor 5") - self.assertEqual(inst.contact[0].address.line[0], "West Wing, floor 5") - self.assertEqual(inst.contact[0].name.text, "mr. F. de Hond") + self.assertEqual(inst.address[0].line[0], "South Wing, floor 2") + self.assertEqual(inst.contact[0].address.line[0], "South Wing, floor 2") + self.assertEqual(inst.contact[0].name.text, "mevr. D. de Haan") self.assertEqual(inst.contact[0].purpose.coding[0].code, "ADMIN") - self.assertEqual(inst.contact[0].purpose.coding[0].system, "http://hl7.org/fhir/contactentity-type") + self.assertEqual(inst.contact[0].purpose.coding[0].system, "http://terminology.hl7.org/CodeSystem/contactentity-type") self.assertEqual(inst.contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contact[0].telecom[0].value, "022-655 7654") + self.assertEqual(inst.contact[0].telecom[0].value, "022-655 2321") self.assertEqual(inst.contact[0].telecom[1].system, "email") - self.assertEqual(inst.contact[0].telecom[1].value, "KNO@burgersumc.nl") + self.assertEqual(inst.contact[0].telecom[1].value, "cardio@burgersumc.nl") self.assertEqual(inst.contact[0].telecom[2].system, "fax") - self.assertEqual(inst.contact[0].telecom[2].value, "022-655 0998") - self.assertEqual(inst.id, "f003") - self.assertEqual(inst.name, "Burgers UMC Ear,Nose,Throat unit") + self.assertEqual(inst.contact[0].telecom[2].value, "022-655 2322") + self.assertEqual(inst.id, "f002") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Burgers UMC Cardiology unit") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].value, "022-655 6780") + self.assertEqual(inst.telecom[0].value, "022-655 2320") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type[0].coding[0].code, "dept") self.assertEqual(inst.type[0].coding[0].display, "Hospital Department") - self.assertEqual(inst.type[0].coding[0].system, "http://hl7.org/fhir/organization-type") + self.assertEqual(inst.type[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/organization-type") - def testOrganization4(self): + def testOrganization7(self): inst = self.instantiate_from("organization-example-f201-aumc.json") self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization4(inst) + self.implOrganization7(inst) js = inst.as_json() self.assertEqual("Organization", js["resourceType"]) inst2 = organization.Organization(js) - self.implOrganization4(inst2) + self.implOrganization7(inst2) - def implOrganization4(self, inst): + def implOrganization7(self, inst): self.assertTrue(inst.active) self.assertEqual(inst.address[0].city, "Den Helder") self.assertEqual(inst.address[0].country, "NLD") @@ -167,6 +213,9 @@ def implOrganization4(self, inst): self.assertEqual(inst.identifier[0].system, "http://www.zorgkaartnederland.nl/") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "Artis University Medical Center") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "Artis University Medical Center (AUMC)") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") @@ -180,101 +229,30 @@ def implOrganization4(self, inst): self.assertEqual(inst.type[0].coding[1].system, "urn:oid:2.16.840.1.113883.2.4.15.1060") self.assertEqual(inst.type[0].coding[2].code, "prov") self.assertEqual(inst.type[0].coding[2].display, "Healthcare Provider") - self.assertEqual(inst.type[0].coding[2].system, "http://hl7.org/fhir/organization-type") - - def testOrganization5(self): - inst = self.instantiate_from("organization-example-f203-bumc.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization5(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization5(inst2) - - def implOrganization5(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].city, "Blijdorp") - self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "apenrots 230") - self.assertEqual(inst.address[0].postalCode, "3056BE") - self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.id, "f203") - self.assertEqual(inst.identifier[0].system, "http://www.zorgkaartnederland.nl/") - self.assertEqual(inst.identifier[0].type.text, "Zorginstelling naam") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "Blijdorp MC") - self.assertEqual(inst.name, "Blijdorp Medisch Centrum (BUMC)") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "+31107040704") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type[0].coding[0].code, "405608006") - self.assertEqual(inst.type[0].coding[0].display, "Academic Medical Center") - self.assertEqual(inst.type[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.type[0].coding[1].code, "prov") - self.assertEqual(inst.type[0].coding[1].system, "http://hl7.org/fhir/organization-type") + self.assertEqual(inst.type[0].coding[2].system, "http://terminology.hl7.org/CodeSystem/organization-type") - def testOrganization6(self): - inst = self.instantiate_from("organization-example-gastro.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization6(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization6(inst2) - - def implOrganization6(self, inst): - self.assertEqual(inst.id, "1") - self.assertEqual(inst.identifier[0].system, "http://www.acme.org.au/units") - self.assertEqual(inst.identifier[0].value, "Gastro") - self.assertEqual(inst.name, "Gastroenterology") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "mobile") - self.assertEqual(inst.telecom[0].value, "+1 555 234 3523") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "gastro@acme.org") - self.assertEqual(inst.text.status, "generated") - - def testOrganization7(self): + def testOrganization8(self): inst = self.instantiate_from("organization-example-good-health-care.json") self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization7(inst) + self.implOrganization8(inst) js = inst.as_json() self.assertEqual("Organization", js["resourceType"]) inst2 = organization.Organization(js) - self.implOrganization7(inst2) + self.implOrganization8(inst2) - def implOrganization7(self, inst): + def implOrganization8(self, inst): self.assertEqual(inst.id, "2.16.840.1.113883.19.5") self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") self.assertEqual(inst.identifier[0].value, "2.16.840.1.113883.19.5") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "Good Health Clinic") self.assertEqual(inst.text.status, "generated") - def testOrganization8(self): - inst = self.instantiate_from("organization-example-insurer.json") - self.assertIsNotNone(inst, "Must have instantiated a Organization instance") - self.implOrganization8(inst) - - js = inst.as_json() - self.assertEqual("Organization", js["resourceType"]) - inst2 = organization.Organization(js) - self.implOrganization8(inst2) - - def implOrganization8(self, inst): - self.assertEqual(inst.alias[0], "ABC Insurance") - self.assertEqual(inst.id, "2") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.3.19.2.3") - self.assertEqual(inst.identifier[0].value, "666666") - self.assertEqual(inst.name, "XYZ Insurance") - self.assertEqual(inst.text.status, "generated") - def testOrganization9(self): - inst = self.instantiate_from("organization-example-lab.json") + inst = self.instantiate_from("organization-example-f001-burgers.json") self.assertIsNotNone(inst, "Must have instantiated a Organization instance") self.implOrganization9(inst) @@ -284,20 +262,48 @@ def testOrganization9(self): self.implOrganization9(inst2) def implOrganization9(self, inst): - self.assertEqual(inst.id, "1832473e-2fe0-452d-abe9-3cdb9879522f") - self.assertEqual(inst.identifier[0].system, "http://www.acme.org.au/units") - self.assertEqual(inst.identifier[0].value, "ClinLab") - self.assertEqual(inst.name, "Clinical Lab") + self.assertEqual(inst.address[0].city, "Den Burg") + self.assertEqual(inst.address[0].country, "NLD") + self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") + self.assertEqual(inst.address[0].postalCode, "9105 PZ") + self.assertEqual(inst.address[0].use, "work") + self.assertEqual(inst.address[1].city, "Den Burg") + self.assertEqual(inst.address[1].country, "NLD") + self.assertEqual(inst.address[1].line[0], "PO Box 2311") + self.assertEqual(inst.address[1].postalCode, "9100 AA") + self.assertEqual(inst.address[1].use, "work") + self.assertEqual(inst.contact[0].purpose.coding[0].code, "PRESS") + self.assertEqual(inst.contact[0].purpose.coding[0].system, "http://terminology.hl7.org/CodeSystem/contactentity-type") + self.assertEqual(inst.contact[0].telecom[0].system, "phone") + self.assertEqual(inst.contact[0].telecom[0].value, "022-655 2334") + self.assertEqual(inst.contact[1].purpose.coding[0].code, "PATINF") + self.assertEqual(inst.contact[1].purpose.coding[0].system, "http://terminology.hl7.org/CodeSystem/contactentity-type") + self.assertEqual(inst.contact[1].telecom[0].system, "phone") + self.assertEqual(inst.contact[1].telecom[0].value, "022-655 2335") + self.assertEqual(inst.id, "f001") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "91654") + self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.1") + self.assertEqual(inst.identifier[1].use, "usual") + self.assertEqual(inst.identifier[1].value, "17-0112278") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "Burgers University Medical Center") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "+1 555 234 1234") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "contact@labs.acme.org") + self.assertEqual(inst.telecom[0].value, "022-655 2300") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type[0].coding[0].code, "V6") + self.assertEqual(inst.type[0].coding[0].display, "University Medical Hospital") + self.assertEqual(inst.type[0].coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.1060") + self.assertEqual(inst.type[0].coding[1].code, "prov") + self.assertEqual(inst.type[0].coding[1].display, "Healthcare Provider") + self.assertEqual(inst.type[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/organization-type") def testOrganization10(self): - inst = self.instantiate_from("organization-example-mmanu.json") + inst = self.instantiate_from("organization-example-insurer.json") self.assertIsNotNone(inst, "Must have instantiated a Organization instance") self.implOrganization10(inst) @@ -307,9 +313,13 @@ def testOrganization10(self): self.implOrganization10(inst2) def implOrganization10(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].country, "Swizterland") - self.assertEqual(inst.id, "mmanu") - self.assertEqual(inst.name, "Acme Corporation") + self.assertEqual(inst.alias[0], "ABC Insurance") + self.assertEqual(inst.id, "2") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.3.19.2.3") + self.assertEqual(inst.identifier[0].value, "666666") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name, "XYZ Insurance") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/organizationaffiliation.py b/fhirclient/models/organizationaffiliation.py new file mode 100644 index 000000000..208ee27b2 --- /dev/null +++ b/fhirclient/models/organizationaffiliation.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/OrganizationAffiliation) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class OrganizationAffiliation(domainresource.DomainResource): + """ Defines an affiliation/assotiation/relationship between 2 distinct + oganizations, that is not a part-of relationship/sub-division relationship. + """ + + resource_type = "OrganizationAffiliation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.active = None + """ Whether this organization affiliation record is in active use. + Type `bool`. """ + + self.code = None + """ Definition of the role the participatingOrganization plays. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.endpoint = None + """ Technical endpoints providing access to services operated for this + role. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.healthcareService = None + """ Healthcare services provided through the role. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifiers that are specific to this role. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.location = None + """ The location(s) at which the role occurs. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.network = None + """ Health insurance provider network in which the + participatingOrganization provides the role's services (if defined) + at the indicated locations (if defined). + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.organization = None + """ Organization where the role is available. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.participatingOrganization = None + """ Organization that provides/performs the role (e.g. providing + services or is a member of). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.period = None + """ The period during which the participatingOrganization is affiliated + with the primary organization. + Type `Period` (represented as `dict` in JSON). """ + + self.specialty = None + """ Specific specialty of the participatingOrganization in the context + of the role. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.telecom = None + """ Contact details at the participatingOrganization relevant to this + Affiliation. + List of `ContactPoint` items (represented as `dict` in JSON). """ + + super(OrganizationAffiliation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(OrganizationAffiliation, self).elementProperties() + js.extend([ + ("active", "active", bool, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, True, None, False), + ("endpoint", "endpoint", fhirreference.FHIRReference, True, None, False), + ("healthcareService", "healthcareService", fhirreference.FHIRReference, True, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("location", "location", fhirreference.FHIRReference, True, None, False), + ("network", "network", fhirreference.FHIRReference, True, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("participatingOrganization", "participatingOrganization", fhirreference.FHIRReference, False, None, False), + ("period", "period", period.Period, False, None, False), + ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), + ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactpoint +except ImportError: + contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/organizationaffiliation_tests.py b/fhirclient/models/organizationaffiliation_tests.py new file mode 100644 index 000000000..548c9d7c8 --- /dev/null +++ b/fhirclient/models/organizationaffiliation_tests.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import organizationaffiliation +from .fhirdate import FHIRDate + + +class OrganizationAffiliationTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("OrganizationAffiliation", js["resourceType"]) + return organizationaffiliation.OrganizationAffiliation(js) + + def testOrganizationAffiliation1(self): + inst = self.instantiate_from("organizationaffiliation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a OrganizationAffiliation instance") + self.implOrganizationAffiliation1(inst) + + js = inst.as_json() + self.assertEqual("OrganizationAffiliation", js["resourceType"]) + inst2 = organizationaffiliation.OrganizationAffiliation(js) + self.implOrganizationAffiliation1(inst2) + + def implOrganizationAffiliation1(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.code[0].coding[0].code, "provider") + self.assertEqual(inst.code[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/organization-role") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://www.acme.org/practitioners") + self.assertEqual(inst.identifier[0].value, "23") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.period.end.date, FHIRDate("2012-03-31").date) + self.assertEqual(inst.period.end.as_json(), "2012-03-31") + self.assertEqual(inst.period.start.date, FHIRDate("2012-01-01").date) + self.assertEqual(inst.period.start.as_json(), "2012-01-01") + self.assertEqual(inst.specialty[0].coding[0].code, "408443003") + self.assertEqual(inst.specialty[0].coding[0].display, "General medical practice") + self.assertEqual(inst.specialty[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.telecom[0].system, "email") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "general.practice@example.org") + self.assertEqual(inst.text.status, "generated") + + def testOrganizationAffiliation2(self): + inst = self.instantiate_from("orgrole-example-hie.json") + self.assertIsNotNone(inst, "Must have instantiated a OrganizationAffiliation instance") + self.implOrganizationAffiliation2(inst) + + js = inst.as_json() + self.assertEqual("OrganizationAffiliation", js["resourceType"]) + inst2 = organizationaffiliation.OrganizationAffiliation(js) + self.implOrganizationAffiliation2(inst2) + + def implOrganizationAffiliation2(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.code[0].coding[0].code, "member") + self.assertEqual(inst.code[0].coding[0].display, "Member") + self.assertEqual(inst.code[0].coding[0].system, "http://hl7.org/fhir/organization-role") + self.assertEqual(inst.code[0].text, "Hospital member") + self.assertEqual(inst.id, "orgrole2") + self.assertEqual(inst.identifier[0].system, "http://example.org/www.monumentHIE.com") + self.assertEqual(inst.identifier[0].type.text, "member hospital") + self.assertEqual(inst.identifier[0].use, "secondary") + self.assertEqual(inst.identifier[0].value, "hosp32") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") + + def testOrganizationAffiliation3(self): + inst = self.instantiate_from("orgrole-example-services.json") + self.assertIsNotNone(inst, "Must have instantiated a OrganizationAffiliation instance") + self.implOrganizationAffiliation3(inst) + + js = inst.as_json() + self.assertEqual("OrganizationAffiliation", js["resourceType"]) + inst2 = organizationaffiliation.OrganizationAffiliation(js) + self.implOrganizationAffiliation3(inst2) + + def implOrganizationAffiliation3(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.code[0].coding[0].code, "provider") + self.assertEqual(inst.code[0].coding[0].display, "Provider") + self.assertEqual(inst.code[0].coding[0].system, "http://hl7.org/fhir/organization-role") + self.assertTrue(inst.code[0].coding[0].userSelected) + self.assertEqual(inst.code[0].text, "Provider of rehabilitation services") + self.assertEqual(inst.id, "orgrole1") + self.assertEqual(inst.identifier[0].system, "http://example.org/www.foundingfathersmemorial.com") + self.assertEqual(inst.identifier[0].use, "secondary") + self.assertEqual(inst.identifier[0].value, "service002") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.period.end.date, FHIRDate("2022-02-01").date) + self.assertEqual(inst.period.end.as_json(), "2022-02-01") + self.assertEqual(inst.period.start.date, FHIRDate("2018-02-09").date) + self.assertEqual(inst.period.start.as_json(), "2018-02-09") + self.assertEqual(inst.specialty[0].coding[0].code, "394602003") + self.assertEqual(inst.specialty[0].coding[0].display, "Rehabilitation - specialty") + self.assertEqual(inst.specialty[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.specialty[0].text, "Rehabilitation") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "202-109-8765") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/parameterdefinition.py b/fhirclient/models/parameterdefinition.py index c4138d291..4fee7da5c 100644 --- a/fhirclient/models/parameterdefinition.py +++ b/fhirclient/models/parameterdefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ParameterDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ParameterDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -44,7 +44,7 @@ def __init__(self, jsondict=None, strict=True): self.profile = None """ What profile the value is expected to be. - Type `FHIRReference` referencing `StructureDefinition` (represented as `dict` in JSON). """ + Type `str`. """ self.type = None """ What type of value. @@ -63,15 +63,10 @@ def elementProperties(self): ("max", "max", str, False, None, False), ("min", "min", int, False, None, False), ("name", "name", str, False, None, False), - ("profile", "profile", fhirreference.FHIRReference, False, None, False), + ("profile", "profile", str, False, None, False), ("type", "type", str, False, None, True), ("use", "use", str, False, None, True), ]) return js -import sys -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/parameters.py b/fhirclient/models/parameters.py index 621acdb8c..94c960c03 100644 --- a/fhirclient/models/parameters.py +++ b/fhirclient/models/parameters.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Parameters) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Parameters) on 2019-05-07. +# 2019, SMART Health IT. from . import resource @@ -10,9 +10,9 @@ class Parameters(resource.Resource): """ Operation Request or Response. - This special resource type is used to represent an operation request and - response (operations.html). It has no other use, and there is no RESTful - endpoint associated with it. + This resource is a non-persisted resource used to pass information into and + back from an [operation](operations.html). It has no other use, and there + is no RESTful endpoint associated with it. """ resource_type = "Parameters" @@ -93,6 +93,10 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `bool`. """ + self.valueCanonical = None + """ If parameter is a data type. + Type `str`. """ + self.valueCode = None """ If parameter is a data type. Type `str`. """ @@ -105,14 +109,26 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `Coding` (represented as `dict` in JSON). """ + self.valueContactDetail = None + """ If parameter is a data type. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.valueContactPoint = None """ If parameter is a data type. Type `ContactPoint` (represented as `dict` in JSON). """ + self.valueContributor = None + """ If parameter is a data type. + Type `Contributor` (represented as `dict` in JSON). """ + self.valueCount = None """ If parameter is a data type. Type `Count` (represented as `dict` in JSON). """ + self.valueDataRequirement = None + """ If parameter is a data type. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.valueDate = None """ If parameter is a data type. Type `FHIRDate` (represented as `str` in JSON). """ @@ -129,10 +145,18 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `Distance` (represented as `dict` in JSON). """ + self.valueDosage = None + """ If parameter is a data type. + Type `Dosage` (represented as `dict` in JSON). """ + self.valueDuration = None """ If parameter is a data type. Type `Duration` (represented as `dict` in JSON). """ + self.valueExpression = None + """ If parameter is a data type. + Type `Expression` (represented as `dict` in JSON). """ + self.valueHumanName = None """ If parameter is a data type. Type `HumanName` (represented as `dict` in JSON). """ @@ -157,10 +181,6 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `str`. """ - self.valueMeta = None - """ If parameter is a data type. - Type `Meta` (represented as `dict` in JSON). """ - self.valueMoney = None """ If parameter is a data type. Type `Money` (represented as `dict` in JSON). """ @@ -169,6 +189,10 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `str`. """ + self.valueParameterDefinition = None + """ If parameter is a data type. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.valuePeriod = None """ If parameter is a data type. Type `Period` (represented as `dict` in JSON). """ @@ -193,6 +217,10 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `FHIRReference` (represented as `dict` in JSON). """ + self.valueRelatedArtifact = None + """ If parameter is a data type. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.valueSampledData = None """ If parameter is a data type. Type `SampledData` (represented as `dict` in JSON). """ @@ -213,6 +241,10 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `Timing` (represented as `dict` in JSON). """ + self.valueTriggerDefinition = None + """ If parameter is a data type. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.valueUnsignedInt = None """ If parameter is a data type. Type `int`. """ @@ -221,6 +253,18 @@ def __init__(self, jsondict=None, strict=True): """ If parameter is a data type. Type `str`. """ + self.valueUrl = None + """ If parameter is a data type. + Type `str`. """ + + self.valueUsageContext = None + """ If parameter is a data type. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.valueUuid = None + """ If parameter is a data type. + Type `str`. """ + super(ParametersParameter, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -235,38 +279,49 @@ def elementProperties(self): ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", False), ("valueBase64Binary", "valueBase64Binary", str, False, "value", False), ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCanonical", "valueCanonical", str, False, "value", False), ("valueCode", "valueCode", str, False, "value", False), ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), ("valueCoding", "valueCoding", coding.Coding, False, "value", False), + ("valueContactDetail", "valueContactDetail", contactdetail.ContactDetail, False, "value", False), ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", False), + ("valueContributor", "valueContributor", contributor.Contributor, False, "value", False), ("valueCount", "valueCount", count.Count, False, "value", False), + ("valueDataRequirement", "valueDataRequirement", datarequirement.DataRequirement, False, "value", False), ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", False), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), ("valueDecimal", "valueDecimal", float, False, "value", False), ("valueDistance", "valueDistance", distance.Distance, False, "value", False), + ("valueDosage", "valueDosage", dosage.Dosage, False, "value", False), ("valueDuration", "valueDuration", duration.Duration, False, "value", False), + ("valueExpression", "valueExpression", expression.Expression, False, "value", False), ("valueHumanName", "valueHumanName", humanname.HumanName, False, "value", False), ("valueId", "valueId", str, False, "value", False), ("valueIdentifier", "valueIdentifier", identifier.Identifier, False, "value", False), ("valueInstant", "valueInstant", fhirdate.FHIRDate, False, "value", False), ("valueInteger", "valueInteger", int, False, "value", False), ("valueMarkdown", "valueMarkdown", str, False, "value", False), - ("valueMeta", "valueMeta", meta.Meta, False, "value", False), ("valueMoney", "valueMoney", money.Money, False, "value", False), ("valueOid", "valueOid", str, False, "value", False), + ("valueParameterDefinition", "valueParameterDefinition", parameterdefinition.ParameterDefinition, False, "value", False), ("valuePeriod", "valuePeriod", period.Period, False, "value", False), ("valuePositiveInt", "valuePositiveInt", int, False, "value", False), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), ("valueRange", "valueRange", range.Range, False, "value", False), ("valueRatio", "valueRatio", ratio.Ratio, False, "value", False), ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", False), + ("valueRelatedArtifact", "valueRelatedArtifact", relatedartifact.RelatedArtifact, False, "value", False), ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", False), ("valueSignature", "valueSignature", signature.Signature, False, "value", False), ("valueString", "valueString", str, False, "value", False), ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", False), ("valueTiming", "valueTiming", timing.Timing, False, "value", False), + ("valueTriggerDefinition", "valueTriggerDefinition", triggerdefinition.TriggerDefinition, False, "value", False), ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", False), ("valueUri", "valueUri", str, False, "value", False), + ("valueUrl", "valueUrl", str, False, "value", False), + ("valueUsageContext", "valueUsageContext", usagecontext.UsageContext, False, "value", False), + ("valueUuid", "valueUuid", str, False, "value", False), ]) return js @@ -296,22 +351,42 @@ def elementProperties(self): from . import coding except ImportError: coding = sys.modules[__package__ + '.coding'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] try: from . import contactpoint except ImportError: contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import contributor +except ImportError: + contributor = sys.modules[__package__ + '.contributor'] try: from . import count except ImportError: count = sys.modules[__package__ + '.count'] +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] try: from . import distance except ImportError: distance = sys.modules[__package__ + '.distance'] +try: + from . import dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] try: from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: @@ -328,14 +403,14 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] -try: - from . import meta -except ImportError: - meta = sys.modules[__package__ + '.meta'] try: from . import money except ImportError: money = sys.modules[__package__ + '.money'] +try: + from . import parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] try: from . import period except ImportError: @@ -352,6 +427,10 @@ def elementProperties(self): from . import ratio except ImportError: ratio = sys.modules[__package__ + '.ratio'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] try: from . import sampleddata except ImportError: @@ -364,3 +443,11 @@ def elementProperties(self): from . import timing except ImportError: timing = sys.modules[__package__ + '.timing'] +try: + from . import triggerdefinition +except ImportError: + triggerdefinition = sys.modules[__package__ + '.triggerdefinition'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/parameters_tests.py b/fhirclient/models/parameters_tests.py index 4065a616c..77a208788 100644 --- a/fhirclient/models/parameters_tests.py +++ b/fhirclient/models/parameters_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,9 +32,16 @@ def testParameters1(self): self.implParameters1(inst2) def implParameters1(self, inst): - self.assertEqual(inst.id, "example") - self.assertEqual(inst.parameter[0].name, "start") - self.assertEqual(inst.parameter[0].valueDate.date, FHIRDate("2010-01-01").date) - self.assertEqual(inst.parameter[0].valueDate.as_json(), "2010-01-01") - self.assertEqual(inst.parameter[1].name, "end") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.parameter[0].name, "exact") + self.assertTrue(inst.parameter[0].valueBoolean) + self.assertEqual(inst.parameter[1].name, "property") + self.assertEqual(inst.parameter[1].part[0].name, "code") + self.assertEqual(inst.parameter[1].part[0].valueCode, "focus") + self.assertEqual(inst.parameter[1].part[1].name, "value") + self.assertEqual(inst.parameter[1].part[1].valueCode, "top") + self.assertEqual(inst.parameter[2].name, "patient") + self.assertEqual(inst.parameter[2].resource.id, "example") diff --git a/fhirclient/models/patient.py b/fhirclient/models/patient.py index db45fec2e..325db4a26 100644 --- a/fhirclient/models/patient.py +++ b/fhirclient/models/patient.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Patient) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Patient) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -29,20 +29,16 @@ def __init__(self, jsondict=None, strict=True): Type `bool`. """ self.address = None - """ Addresses for the individual. + """ An address for the individual. List of `Address` items (represented as `dict` in JSON). """ - self.animal = None - """ This patient is known to be an animal (non-human). - Type `PatientAnimal` (represented as `dict` in JSON). """ - self.birthDate = None """ The date of birth for the individual. Type `FHIRDate` (represented as `str` in JSON). """ self.communication = None - """ A list of Languages which may be used to communicate with the - patient about his or her health. + """ A language which may be used to communicate with the patient about + his or her health. List of `PatientCommunication` items (represented as `dict` in JSON). """ self.contact = None @@ -63,7 +59,7 @@ def __init__(self, jsondict=None, strict=True): self.generalPractitioner = None """ Patient's nominated primary care provider. - List of `FHIRReference` items referencing `Organization, Practitioner` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None """ An identifier for this patient. @@ -76,7 +72,7 @@ def __init__(self, jsondict=None, strict=True): self.managingOrganization = None """ Organization that is the custodian of the patient record. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.maritalStatus = None """ Marital (civil) status of a patient. @@ -109,7 +105,6 @@ def elementProperties(self): js.extend([ ("active", "active", bool, False, None, False), ("address", "address", address.Address, True, None, False), - ("animal", "animal", PatientAnimal, False, None, False), ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), ("communication", "communication", PatientCommunication, True, None, False), ("contact", "contact", PatientContact, True, None, False), @@ -132,51 +127,8 @@ def elementProperties(self): from . import backboneelement -class PatientAnimal(backboneelement.BackboneElement): - """ This patient is known to be an animal (non-human). - - This patient is known to be an animal. - """ - - resource_type = "PatientAnimal" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.breed = None - """ E.g. Poodle, Angus. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.genderStatus = None - """ E.g. Neutered, Intact. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.species = None - """ E.g. Dog, Cow. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(PatientAnimal, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(PatientAnimal, self).elementProperties() - js.extend([ - ("breed", "breed", codeableconcept.CodeableConcept, False, None, False), - ("genderStatus", "genderStatus", codeableconcept.CodeableConcept, False, None, False), - ("species", "species", codeableconcept.CodeableConcept, False, None, True), - ]) - return js - - class PatientCommunication(backboneelement.BackboneElement): - """ A list of Languages which may be used to communicate with the patient about - his or her health. - - Languages which may be used to communicate with the patient about his or + """ A language which may be used to communicate with the patient about his or her health. """ @@ -238,7 +190,7 @@ def __init__(self, jsondict=None, strict=True): self.organization = None """ Organization that is associated with the contact. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ The period during which this contact person or organization is @@ -288,10 +240,10 @@ def __init__(self, jsondict=None, strict=True): self.other = None """ The other patient or related person resource that the link refers to. - Type `FHIRReference` referencing `Patient, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None - """ replaced-by | replaces | refer | seealso - type of link. + """ replaced-by | replaces | refer | seealso. Type `str`. """ super(PatientLink, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/patient_tests.py b/fhirclient/models/patient_tests.py index 40185418a..d7c07ae5d 100644 --- a/fhirclient/models/patient_tests.py +++ b/fhirclient/models/patient_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return patient.Patient(js) def testPatient1(self): - inst = self.instantiate_from("patient-example-a.json") + inst = self.instantiate_from("patient-example-xds.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient1(inst) @@ -33,24 +33,29 @@ def testPatient1(self): def implPatient1(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "E") - self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://hl7.org/fhir/v2/0131") + self.assertEqual(inst.address[0].city, "Metropolis") + self.assertEqual(inst.address[0].country, "USA") + self.assertEqual(inst.address[0].line[0], "100 Main St") + self.assertEqual(inst.address[0].postalCode, "44130") + self.assertEqual(inst.address[0].state, "Il") + self.assertEqual(inst.birthDate.date, FHIRDate("1956-05-27").date) + self.assertEqual(inst.birthDate.as_json(), "1956-05-27") self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "pat1") - self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") + self.assertEqual(inst.id, "xds") + self.assertEqual(inst.identifier[0].system, "urn:oid:1.2.3.4.5") self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/v2/0203") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "654321") - self.assertEqual(inst.link[0].type, "seealso") - self.assertEqual(inst.name[0].family, "Donald") - self.assertEqual(inst.name[0].given[0], "Duck") - self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.photo[0].contentType, "image/gif") + self.assertEqual(inst.identifier[0].value, "89765a87b") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Doe") + self.assertEqual(inst.name[0].given[0], "John") self.assertEqual(inst.text.status, "generated") def testPatient2(self): - inst = self.instantiate_from("patient-example-animal.json") + inst = self.instantiate_from("patient-example-f001-pieter.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient2(inst) @@ -61,40 +66,56 @@ def testPatient2(self): def implPatient2(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.animal.breed.coding[0].code, "58108001") - self.assertEqual(inst.animal.breed.coding[0].display, "Golden retriever") - self.assertEqual(inst.animal.breed.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.animal.breed.coding[1].code, "gret") - self.assertEqual(inst.animal.breed.coding[1].display, "Golden Retriever") - self.assertEqual(inst.animal.breed.coding[1].system, "http://hl7.org/fhir/animal-breed") - self.assertEqual(inst.animal.genderStatus.coding[0].code, "neutered") - self.assertEqual(inst.animal.genderStatus.coding[0].system, "http://hl7.org/fhir/animal-genderstatus") - self.assertEqual(inst.animal.species.coding[0].code, "canislf") - self.assertEqual(inst.animal.species.coding[0].display, "Dog") - self.assertEqual(inst.animal.species.coding[0].system, "http://hl7.org/fhir/animal-species") - self.assertEqual(inst.birthDate.date, FHIRDate("2010-03-23").date) - self.assertEqual(inst.birthDate.as_json(), "2010-03-23") - self.assertEqual(inst.contact[0].name.family, "Chalmers") - self.assertEqual(inst.contact[0].name.given[0], "Peter") - self.assertEqual(inst.contact[0].name.given[1], "James") + self.assertEqual(inst.address[0].city, "Amsterdam") + self.assertEqual(inst.address[0].country, "NLD") + self.assertEqual(inst.address[0].line[0], "Van Egmondkade 23") + self.assertEqual(inst.address[0].postalCode, "1024 RJ") + self.assertEqual(inst.address[0].use, "home") + self.assertEqual(inst.birthDate.date, FHIRDate("1944-11-17").date) + self.assertEqual(inst.birthDate.as_json(), "1944-11-17") + self.assertEqual(inst.communication[0].language.coding[0].code, "nl") + self.assertEqual(inst.communication[0].language.coding[0].display, "Dutch") + self.assertEqual(inst.communication[0].language.coding[0].system, "urn:ietf:bcp:47") + self.assertEqual(inst.communication[0].language.text, "Nederlands") + self.assertTrue(inst.communication[0].preferred) + self.assertEqual(inst.contact[0].name.family, "Abels") + self.assertEqual(inst.contact[0].name.given[0], "Sarah") + self.assertEqual(inst.contact[0].name.use, "usual") self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "C") - self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://hl7.org/fhir/v2/0131") + self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0131") self.assertEqual(inst.contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contact[0].telecom[0].use, "work") - self.assertEqual(inst.contact[0].telecom[0].value, "(03) 5555 6473") - self.assertEqual(inst.gender, "female") - self.assertEqual(inst.id, "animal") - self.assertEqual(inst.identifier[0].period.start.date, FHIRDate("2010-05-31").date) - self.assertEqual(inst.identifier[0].period.start.as_json(), "2010-05-31") - self.assertEqual(inst.identifier[0].system, "http://www.maroondah.vic.gov.au/AnimalRegFees.aspx") - self.assertEqual(inst.identifier[0].type.text, "Dog Tag") - self.assertEqual(inst.identifier[0].value, "1234123") - self.assertEqual(inst.name[0].given[0], "Kenzi") + self.assertEqual(inst.contact[0].telecom[0].use, "mobile") + self.assertEqual(inst.contact[0].telecom[0].value, "0690383372") + self.assertFalse(inst.deceasedBoolean) + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "f001") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.2.4.6.3") + self.assertEqual(inst.identifier[0].use, "usual") + self.assertEqual(inst.identifier[0].value, "738472983") + self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") + self.assertEqual(inst.identifier[1].use, "usual") + self.assertEqual(inst.maritalStatus.coding[0].code, "M") + self.assertEqual(inst.maritalStatus.coding[0].display, "Married") + self.assertEqual(inst.maritalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus") + self.assertEqual(inst.maritalStatus.text, "Getrouwd") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertTrue(inst.multipleBirthBoolean) + self.assertEqual(inst.name[0].family, "van de Heuvel") + self.assertEqual(inst.name[0].given[0], "Pieter") + self.assertEqual(inst.name[0].suffix[0], "MSc") self.assertEqual(inst.name[0].use, "usual") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "mobile") + self.assertEqual(inst.telecom[0].value, "0648352638") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "home") + self.assertEqual(inst.telecom[1].value, "p.heuvel@gmail.com") self.assertEqual(inst.text.status, "generated") def testPatient3(self): - inst = self.instantiate_from("patient-example-b.json") + inst = self.instantiate_from("patient-example-d.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient3(inst) @@ -105,23 +126,26 @@ def testPatient3(self): def implPatient3(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.gender, "other") - self.assertEqual(inst.id, "pat2") + self.assertEqual(inst.birthDate.date, FHIRDate("1982-08-02").date) + self.assertEqual(inst.birthDate.as_json(), "1982-08-02") + self.assertTrue(inst.deceasedBoolean) + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "pat4") self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/v2/0203") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "123456") - self.assertEqual(inst.link[0].type, "seealso") - self.assertEqual(inst.name[0].family, "Donald") - self.assertEqual(inst.name[0].given[0], "Duck") - self.assertEqual(inst.name[0].given[1], "D") + self.assertEqual(inst.identifier[0].value, "123458") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Notsowell") + self.assertEqual(inst.name[0].given[0], "Sandy") self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.photo[0].contentType, "image/gif") self.assertEqual(inst.text.status, "generated") def testPatient4(self): - inst = self.instantiate_from("patient-example-c.json") + inst = self.instantiate_from("patient-example-infant-twin-1.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient4(inst) @@ -131,25 +155,42 @@ def testPatient4(self): self.implPatient4(inst2) def implPatient4(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.birthDate.date, FHIRDate("1982-01-23").date) - self.assertEqual(inst.birthDate.as_json(), "1982-01-23") - self.assertEqual(inst.deceasedDateTime.date, FHIRDate("2015-02-14T13:42:00+10:00").date) - self.assertEqual(inst.deceasedDateTime.as_json(), "2015-02-14T13:42:00+10:00") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "pat3") - self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") + self.assertEqual(inst.birthDate.date, FHIRDate("2017-05-15").date) + self.assertEqual(inst.birthDate.as_json(), "2017-05-15") + self.assertEqual(inst.contact[0].name.family, "Organa") + self.assertEqual(inst.contact[0].name.given[0], "Leia") + self.assertEqual(inst.contact[0].name.use, "maiden") + self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "72705000") + self.assertEqual(inst.contact[0].relationship[0].coding[0].display, "Mother") + self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.contact[0].relationship[0].coding[1].code, "N") + self.assertEqual(inst.contact[0].relationship[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/v2-0131") + self.assertEqual(inst.contact[0].relationship[0].coding[2].code, "MTH") + self.assertEqual(inst.contact[0].relationship[0].coding[2].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") + self.assertEqual(inst.contact[0].telecom[0].system, "phone") + self.assertEqual(inst.contact[0].telecom[0].use, "mobile") + self.assertEqual(inst.contact[0].telecom[0].value, "+31201234567") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName") + self.assertEqual(inst.extension[0].valueString, "Organa") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "infant-twin-1") + self.assertEqual(inst.identifier[0].system, "http://coruscanthealth.org/main-hospital/patient-identifier") self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/v2/0203") - self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "123457") - self.assertEqual(inst.name[0].family, "Notsowell") - self.assertEqual(inst.name[0].given[0], "Simon") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].value, "MRN7465737865") + self.assertEqual(inst.identifier[1].system, "http://new-republic.gov/galactic-citizen-identifier") + self.assertEqual(inst.identifier[1].value, "7465737865") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.multipleBirthInteger, 1) + self.assertEqual(inst.name[0].family, "Solo") + self.assertEqual(inst.name[0].given[0], "Jaina") self.assertEqual(inst.name[0].use, "official") self.assertEqual(inst.text.status, "generated") def testPatient5(self): - inst = self.instantiate_from("patient-example-chinese.json") + inst = self.instantiate_from("patient-example-infant-mom.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient5(inst) @@ -159,40 +200,26 @@ def testPatient5(self): self.implPatient5(inst2) def implPatient5(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].city, "上海市") - self.assertEqual(inst.address[0].district, "黄埔区") - self.assertEqual(inst.address[0].line[0], "马当路190号") - self.assertEqual(inst.address[0].period.start.date, FHIRDate("1974-12-25").date) - self.assertEqual(inst.address[0].period.start.as_json(), "1974-12-25") - self.assertEqual(inst.address[0].postalCode, "200000") - self.assertEqual(inst.address[0].type, "both") - self.assertEqual(inst.address[0].use, "home") - self.assertEqual(inst.birthDate.date, FHIRDate("1974-12-25").date) - self.assertEqual(inst.birthDate.as_json(), "1974-12-25") - self.assertFalse(inst.deceasedBoolean) - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "ch-example") - self.assertEqual(inst.identifier[0].period.start.date, FHIRDate("2001-05-06").date) - self.assertEqual(inst.identifier[0].period.start.as_json(), "2001-05-06") - self.assertEqual(inst.identifier[0].system, "urn:oid:1.2.36.146.595.217.0.1") - self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/v2/0203") - self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "3112219680806371X") - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2016-05-16T00:55:52Z").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2016-05-16T00:55:52Z") - self.assertEqual(inst.meta.versionId, "1") - self.assertEqual(inst.name[0].text, "张无忌") + self.assertEqual(inst.birthDate.date, FHIRDate("1995-10-12").date) + self.assertEqual(inst.birthDate.as_json(), "1995-10-12") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "infant-mom") + self.assertEqual(inst.maritalStatus.coding[0].code, "M") + self.assertEqual(inst.maritalStatus.coding[0].display, "Married") + self.assertEqual(inst.maritalStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Solo") + self.assertEqual(inst.name[0].given[0], "Leia") self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.telecom[0].use, "home") - self.assertEqual(inst.telecom[1].system, "phone") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "18337177888") + self.assertEqual(inst.name[1].family, "Organa") + self.assertEqual(inst.name[1].given[0], "Leia") + self.assertEqual(inst.name[1].use, "maiden") self.assertEqual(inst.text.status, "generated") def testPatient6(self): - inst = self.instantiate_from("patient-example-d.json") + inst = self.instantiate_from("patient-example-newborn.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient6(inst) @@ -202,24 +229,20 @@ def testPatient6(self): self.implPatient6(inst2) def implPatient6(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.birthDate.date, FHIRDate("1982-08-02").date) - self.assertEqual(inst.birthDate.as_json(), "1982-08-02") - self.assertTrue(inst.deceasedBoolean) - self.assertEqual(inst.gender, "female") - self.assertEqual(inst.id, "pat4") - self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") - self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/v2/0203") - self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "123458") - self.assertEqual(inst.name[0].family, "Notsowell") - self.assertEqual(inst.name[0].given[0], "Sandy") - self.assertEqual(inst.name[0].use, "official") + self.assertEqual(inst.birthDate.date, FHIRDate("2017-09-05").date) + self.assertEqual(inst.birthDate.as_json(), "2017-09-05") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName") + self.assertEqual(inst.extension[0].valueString, "Everywoman") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "newborn") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.multipleBirthInteger, 2) self.assertEqual(inst.text.status, "generated") def testPatient7(self): - inst = self.instantiate_from("patient-example-dicom.json") + inst = self.instantiate_from("patient-example-infant-fetal.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient7(inst) @@ -229,25 +252,34 @@ def testPatient7(self): self.implPatient7(inst2) def implPatient7(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.extension[0].url, "http://nema.org/fhir/extensions#0010:1010") - self.assertEqual(inst.extension[0].valueQuantity.unit, "Y") - self.assertEqual(inst.extension[0].valueQuantity.value, 56) - self.assertEqual(inst.extension[1].url, "http://nema.org/fhir/extensions#0010:1020") - self.assertEqual(inst.extension[1].valueQuantity.unit, "m") - self.assertEqual(inst.extension[1].valueQuantity.value, 1.83) - self.assertEqual(inst.extension[2].url, "http://nema.org/fhir/extensions#0010:1030") - self.assertEqual(inst.extension[2].valueQuantity.unit, "kg") - self.assertEqual(inst.extension[2].valueQuantity.value, 72.58) + self.assertEqual(inst.contact[0].name.family, "Organa") + self.assertEqual(inst.contact[0].name.given[0], "Leia") + self.assertEqual(inst.contact[0].name.use, "maiden") + self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "72705000") + self.assertEqual(inst.contact[0].relationship[0].coding[0].display, "Mother") + self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.contact[0].relationship[0].coding[1].code, "N") + self.assertEqual(inst.contact[0].relationship[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/v2-0131") + self.assertEqual(inst.contact[0].relationship[0].coding[2].code, "MTH") + self.assertEqual(inst.contact[0].relationship[0].coding[2].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") + self.assertEqual(inst.contact[0].telecom[0].system, "phone") + self.assertEqual(inst.contact[0].telecom[0].use, "mobile") + self.assertEqual(inst.contact[0].telecom[0].value, "+31201234567") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName") + self.assertEqual(inst.extension[0].valueString, "Organa") self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "dicom") - self.assertEqual(inst.identifier[0].system, "http://nema.org/examples/patients") - self.assertEqual(inst.identifier[0].value, "MINT1234") - self.assertEqual(inst.name[0].family, "MINT_TEST") + self.assertEqual(inst.id, "infant-fetal") + self.assertEqual(inst.identifier[0].system, "http://coruscanthealth.org/main-hospital/patient-identifier") + self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].value, "MRN657865757378") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") def testPatient8(self): - inst = self.instantiate_from("patient-example-f001-pieter.json") + inst = self.instantiate_from("patient-genetics-example1.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient8(inst) @@ -258,53 +290,31 @@ def testPatient8(self): def implPatient8(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.address[0].city, "Amsterdam") - self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Van Egmondkade 23") - self.assertEqual(inst.address[0].postalCode, "1024 RJ") + self.assertEqual(inst.address[0].line[0], "2222 Home Street") self.assertEqual(inst.address[0].use, "home") - self.assertEqual(inst.birthDate.date, FHIRDate("1944-11-17").date) - self.assertEqual(inst.birthDate.as_json(), "1944-11-17") - self.assertEqual(inst.communication[0].language.coding[0].code, "nl") - self.assertEqual(inst.communication[0].language.coding[0].display, "Dutch") - self.assertEqual(inst.communication[0].language.coding[0].system, "urn:ietf:bcp:47") - self.assertEqual(inst.communication[0].language.text, "Nederlands") - self.assertTrue(inst.communication[0].preferred) - self.assertEqual(inst.contact[0].name.family, "Abels") - self.assertEqual(inst.contact[0].name.given[0], "Sarah") - self.assertEqual(inst.contact[0].name.use, "usual") - self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "C") - self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://hl7.org/fhir/v2/0131") - self.assertEqual(inst.contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contact[0].telecom[0].use, "mobile") - self.assertEqual(inst.contact[0].telecom[0].value, "0690383372") - self.assertFalse(inst.deceasedBoolean) - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f001") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "738472983") - self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.maritalStatus.coding[0].code, "M") - self.assertEqual(inst.maritalStatus.coding[0].display, "Married") - self.assertEqual(inst.maritalStatus.coding[0].system, "http://hl7.org/fhir/v3/MaritalStatus") - self.assertEqual(inst.maritalStatus.text, "Getrouwd") - self.assertTrue(inst.multipleBirthBoolean) - self.assertEqual(inst.name[0].family, "van de Heuvel") - self.assertEqual(inst.name[0].given[0], "Pieter") - self.assertEqual(inst.name[0].suffix[0], "MSc") - self.assertEqual(inst.name[0].use, "usual") + self.assertEqual(inst.birthDate.date, FHIRDate("1973-05-31").date) + self.assertEqual(inst.birthDate.as_json(), "1973-05-31") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "genetics-example1") + self.assertEqual(inst.identifier[0].system, "http://hl7.org/fhir/sid/us-ssn") + self.assertEqual(inst.identifier[0].type.coding[0].code, "SS") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].value, "444222222") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2012-05-29T23:45:32Z").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2012-05-29T23:45:32Z") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Everywoman") + self.assertEqual(inst.name[0].given[0], "Eve") + self.assertEqual(inst.name[0].use, "official") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "mobile") - self.assertEqual(inst.telecom[0].value, "0648352638") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "home") - self.assertEqual(inst.telecom[1].value, "p.heuvel@gmail.com") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "555-555-2003") self.assertEqual(inst.text.status, "generated") def testPatient9(self): - inst = self.instantiate_from("patient-example-f201-roel.json") + inst = self.instantiate_from("patient-example-b.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient9(inst) @@ -315,64 +325,26 @@ def testPatient9(self): def implPatient9(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.address[0].city, "Amsterdam") - self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Bos en Lommerplein 280") - self.assertEqual(inst.address[0].postalCode, "1055RW") - self.assertEqual(inst.address[0].use, "home") - self.assertEqual(inst.birthDate.date, FHIRDate("1960-03-13").date) - self.assertEqual(inst.birthDate.as_json(), "1960-03-13") - self.assertEqual(inst.communication[0].language.coding[0].code, "nl-NL") - self.assertEqual(inst.communication[0].language.coding[0].display, "Dutch") - self.assertEqual(inst.communication[0].language.coding[0].system, "urn:ietf:bcp:47") - self.assertTrue(inst.communication[0].preferred) - self.assertEqual(inst.contact[0].name.text, "Ariadne Bor-Jansma") - self.assertEqual(inst.contact[0].name.use, "usual") - self.assertEqual(inst.contact[0].relationship[0].coding[0].code, "127850001") - self.assertEqual(inst.contact[0].relationship[0].coding[0].display, "Wife") - self.assertEqual(inst.contact[0].relationship[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.contact[0].relationship[0].coding[1].code, "N") - self.assertEqual(inst.contact[0].relationship[0].coding[1].system, "http://hl7.org/fhir/v2/0131") - self.assertEqual(inst.contact[0].relationship[0].coding[2].code, "WIFE") - self.assertEqual(inst.contact[0].relationship[0].coding[2].system, "http://hl7.org/fhir/v3/RoleCode") - self.assertEqual(inst.contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contact[0].telecom[0].use, "home") - self.assertEqual(inst.contact[0].telecom[0].value, "+31201234567") - self.assertFalse(inst.deceasedBoolean) - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f201") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[0].type.text, "BSN") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "123456789") - self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[1].type.text, "BSN") - self.assertEqual(inst.identifier[1].use, "official") - self.assertEqual(inst.identifier[1].value, "123456789") - self.assertEqual(inst.maritalStatus.coding[0].code, "36629006") - self.assertEqual(inst.maritalStatus.coding[0].display, "Legally married") - self.assertEqual(inst.maritalStatus.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.maritalStatus.coding[1].code, "M") - self.assertEqual(inst.maritalStatus.coding[1].system, "http://hl7.org/fhir/v3/MaritalStatus") - self.assertFalse(inst.multipleBirthBoolean) - self.assertEqual(inst.name[0].family, "Bor") - self.assertEqual(inst.name[0].given[0], "Roelof Olaf") - self.assertEqual(inst.name[0].prefix[0], "Drs.") - self.assertEqual(inst.name[0].suffix[0], "PDEng.") - self.assertEqual(inst.name[0].text, "Roel") + self.assertEqual(inst.gender, "other") + self.assertEqual(inst.id, "pat2") + self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") + self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].use, "usual") + self.assertEqual(inst.identifier[0].value, "123456") + self.assertEqual(inst.link[0].type, "seealso") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Donald") + self.assertEqual(inst.name[0].given[0], "Duck") + self.assertEqual(inst.name[0].given[1], "D") self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.photo[0].contentType, "image/jpeg") - self.assertEqual(inst.photo[0].url, "Binary/f006") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "mobile") - self.assertEqual(inst.telecom[0].value, "+31612345678") - self.assertEqual(inst.telecom[1].system, "phone") - self.assertEqual(inst.telecom[1].use, "home") - self.assertEqual(inst.telecom[1].value, "+31201234567") + self.assertEqual(inst.photo[0].contentType, "image/gif") self.assertEqual(inst.text.status, "generated") def testPatient10(self): - inst = self.instantiate_from("patient-example-ihe-pcd.json") + inst = self.instantiate_from("patient-example-c.json") self.assertIsNotNone(inst, "Must have instantiated a Patient instance") self.implPatient10(inst) @@ -383,11 +355,22 @@ def testPatient10(self): def implPatient10(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.id, "ihe-pcd") - self.assertEqual(inst.identifier[0].type.text, "Internal Identifier") - self.assertEqual(inst.identifier[0].value, "AB60001") - self.assertEqual(inst.name[0].family, "BROOKS") - self.assertEqual(inst.name[0].given[0], "ALBERT") - self.assertEqual(inst.text.div, "
Albert Brooks, Id: AB60001
") + self.assertEqual(inst.birthDate.date, FHIRDate("1982-01-23").date) + self.assertEqual(inst.birthDate.as_json(), "1982-01-23") + self.assertEqual(inst.deceasedDateTime.date, FHIRDate("2015-02-14T13:42:00+10:00").date) + self.assertEqual(inst.deceasedDateTime.as_json(), "2015-02-14T13:42:00+10:00") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "pat3") + self.assertEqual(inst.identifier[0].system, "urn:oid:0.1.2.3.4.5.6.7") + self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].use, "usual") + self.assertEqual(inst.identifier[0].value, "123457") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Notsowell") + self.assertEqual(inst.name[0].given[0], "Simon") + self.assertEqual(inst.name[0].use, "official") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/paymentnotice.py b/fhirclient/models/paymentnotice.py index ba687a821..4d2615007 100644 --- a/fhirclient/models/paymentnotice.py +++ b/fhirclient/models/paymentnotice.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -24,61 +24,71 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.amount = None + """ Monetary amount of the payment. + Type `Money` (represented as `dict` in JSON). """ + self.created = None """ Creation date. Type `FHIRDate` (represented as `str` in JSON). """ self.identifier = None - """ Business Identifier. + """ Business Identifier for the payment noctice. List of `Identifier` items (represented as `dict` in JSON). """ - self.organization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + self.payee = None + """ Party being paid. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.payment = None + """ Payment reference. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.paymentDate = None + """ Payment or clearing date. + Type `FHIRDate` (represented as `str` in JSON). """ self.paymentStatus = None - """ Whether payment has been sent or cleared. + """ Issued or cleared Status of the payment. Type `CodeableConcept` (represented as `dict` in JSON). """ self.provider = None """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.recipient = None + """ Party being notified. + Type `FHIRReference` (represented as `dict` in JSON). """ self.request = None """ Request reference. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.response = None """ Response reference. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | cancelled | draft | entered-in-error. Type `str`. """ - self.statusDate = None - """ Payment or clearing date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.target = None - """ Insurer or Regulatory body. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - super(PaymentNotice, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(PaymentNotice, self).elementProperties() js.extend([ - ("created", "created", fhirdate.FHIRDate, False, None, False), + ("amount", "amount", money.Money, False, None, True), + ("created", "created", fhirdate.FHIRDate, False, None, True), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), + ("payee", "payee", fhirreference.FHIRReference, False, None, False), + ("payment", "payment", fhirreference.FHIRReference, False, None, True), + ("paymentDate", "paymentDate", fhirdate.FHIRDate, False, None, False), ("paymentStatus", "paymentStatus", codeableconcept.CodeableConcept, False, None, False), ("provider", "provider", fhirreference.FHIRReference, False, None, False), + ("recipient", "recipient", fhirreference.FHIRReference, False, None, True), ("request", "request", fhirreference.FHIRReference, False, None, False), ("response", "response", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), - ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), - ("target", "target", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), ]) return js @@ -100,3 +110,7 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] +try: + from . import money +except ImportError: + money = sys.modules[__package__ + '.money'] diff --git a/fhirclient/models/paymentnotice_tests.py b/fhirclient/models/paymentnotice_tests.py index 62f4f92fb..7f85c44a6 100644 --- a/fhirclient/models/paymentnotice_tests.py +++ b/fhirclient/models/paymentnotice_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,16 +32,21 @@ def testPaymentNotice1(self): self.implPaymentNotice1(inst2) def implPaymentNotice1(self, inst): + self.assertEqual(inst.amount.currency, "USD") + self.assertEqual(inst.amount.value, 12500.0) self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") self.assertEqual(inst.id, "77654") self.assertEqual(inst.identifier[0].system, "http://benefitsinc.com/paymentnotice") self.assertEqual(inst.identifier[0].value, "776543") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.paymentDate.date, FHIRDate("2014-08-15").date) + self.assertEqual(inst.paymentDate.as_json(), "2014-08-15") self.assertEqual(inst.paymentStatus.coding[0].code, "paid") - self.assertEqual(inst.paymentStatus.coding[0].system, "http://hl7.org/fhir/paymentstatus") + self.assertEqual(inst.paymentStatus.coding[0].system, "http://terminology.hl7.org/CodeSystem/paymentstatus") self.assertEqual(inst.status, "active") - self.assertEqual(inst.statusDate.date, FHIRDate("2014-08-15").date) - self.assertEqual(inst.statusDate.as_json(), "2014-08-15") self.assertEqual(inst.text.div, "
A human-readable rendering of the PaymentNotice
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/paymentreconciliation.py b/fhirclient/models/paymentreconciliation.py index 26bcba1a6..958c21348 100644 --- a/fhirclient/models/paymentreconciliation.py +++ b/fhirclient/models/paymentreconciliation.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,8 +10,8 @@ class PaymentReconciliation(domainresource.DomainResource): """ PaymentReconciliation resource. - This resource provides payment details and claim references supporting a - bulk payment. + This resource provides the details including amount of a payment and + allocates the payment items being paid. """ resource_type = "PaymentReconciliation" @@ -29,76 +29,81 @@ def __init__(self, jsondict=None, strict=True): Type `FHIRDate` (represented as `str` in JSON). """ self.detail = None - """ List of settlements. + """ Settlement particulars. List of `PaymentReconciliationDetail` items (represented as `dict` in JSON). """ self.disposition = None - """ Disposition Message. + """ Disposition message. Type `str`. """ - self.form = None - """ Printed Form Identifier. + self.formCode = None + """ Printed form identifier. Type `CodeableConcept` (represented as `dict` in JSON). """ self.identifier = None - """ Business Identifier. + """ Business Identifier for a payment reconciliation. List of `Identifier` items (represented as `dict` in JSON). """ - self.organization = None - """ Insurer. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - self.outcome = None - """ complete | error | partial. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ queued | complete | error | partial. + Type `str`. """ + + self.paymentAmount = None + """ Total amount of Payment. + Type `Money` (represented as `dict` in JSON). """ + + self.paymentDate = None + """ When payment issued. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.paymentIdentifier = None + """ Business identifier for the payment. + Type `Identifier` (represented as `dict` in JSON). """ + + self.paymentIssuer = None + """ Party generating payment. + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Period covered. Type `Period` (represented as `dict` in JSON). """ self.processNote = None - """ Processing comments. + """ Note concerning processing. List of `PaymentReconciliationProcessNote` items (represented as `dict` in JSON). """ self.request = None - """ Claim reference. - Type `FHIRReference` referencing `ProcessRequest` (represented as `dict` in JSON). """ + """ Reference to requesting resource. + Type `FHIRReference` (represented as `dict` in JSON). """ - self.requestOrganization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.requestProvider = None + self.requestor = None """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | cancelled | draft | entered-in-error. Type `str`. """ - self.total = None - """ Total amount of Payment. - Type `Money` (represented as `dict` in JSON). """ - super(PaymentReconciliation, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(PaymentReconciliation, self).elementProperties() js.extend([ - ("created", "created", fhirdate.FHIRDate, False, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, True), ("detail", "detail", PaymentReconciliationDetail, True, None, False), ("disposition", "disposition", str, False, None, False), - ("form", "form", codeableconcept.CodeableConcept, False, None, False), + ("formCode", "formCode", codeableconcept.CodeableConcept, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), + ("outcome", "outcome", str, False, None, False), + ("paymentAmount", "paymentAmount", money.Money, False, None, True), + ("paymentDate", "paymentDate", fhirdate.FHIRDate, False, None, True), + ("paymentIdentifier", "paymentIdentifier", identifier.Identifier, False, None, False), + ("paymentIssuer", "paymentIssuer", fhirreference.FHIRReference, False, None, False), ("period", "period", period.Period, False, None, False), ("processNote", "processNote", PaymentReconciliationProcessNote, True, None, False), ("request", "request", fhirreference.FHIRReference, False, None, False), - ("requestOrganization", "requestOrganization", fhirreference.FHIRReference, False, None, False), - ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), - ("total", "total", money.Money, False, None, False), + ("requestor", "requestor", fhirreference.FHIRReference, False, None, False), + ("status", "status", str, False, None, True), ]) return js @@ -106,9 +111,9 @@ def elementProperties(self): from . import backboneelement class PaymentReconciliationDetail(backboneelement.BackboneElement): - """ List of settlements. + """ Settlement particulars. - List of individual settlement amounts and the corresponding transaction. + Distribution of the payment amount for a previously acknowledged payable. """ resource_type = "PaymentReconciliationDetail" @@ -122,31 +127,43 @@ def __init__(self, jsondict=None, strict=True): """ self.amount = None - """ Amount being paid. + """ Amount allocated to this payable. Type `Money` (represented as `dict` in JSON). """ self.date = None - """ Invoice date. + """ Date of commitment to pay. Type `FHIRDate` (represented as `str` in JSON). """ + self.identifier = None + """ Business identifier of the payment detail. + Type `Identifier` (represented as `dict` in JSON). """ + self.payee = None - """ Organization which is receiving the payment. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Recipient of the payment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.predecessor = None + """ Business identifier of the prior payment detail. + Type `Identifier` (represented as `dict` in JSON). """ self.request = None - """ Claim. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + """ Request giving rise to the payment. + Type `FHIRReference` (represented as `dict` in JSON). """ self.response = None - """ Claim Response. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + """ Response committing to a payment. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.responsible = None + """ Contact for the response. + Type `FHIRReference` (represented as `dict` in JSON). """ self.submitter = None - """ Organization which submitted the claim. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Submitter of the request. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None - """ Type code. + """ Category of payment. Type `CodeableConcept` (represented as `dict` in JSON). """ super(PaymentReconciliationDetail, self).__init__(jsondict=jsondict, strict=strict) @@ -156,9 +173,12 @@ def elementProperties(self): js.extend([ ("amount", "amount", money.Money, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), ("payee", "payee", fhirreference.FHIRReference, False, None, False), + ("predecessor", "predecessor", identifier.Identifier, False, None, False), ("request", "request", fhirreference.FHIRReference, False, None, False), ("response", "response", fhirreference.FHIRReference, False, None, False), + ("responsible", "responsible", fhirreference.FHIRReference, False, None, False), ("submitter", "submitter", fhirreference.FHIRReference, False, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, True), ]) @@ -166,9 +186,9 @@ def elementProperties(self): class PaymentReconciliationProcessNote(backboneelement.BackboneElement): - """ Processing comments. + """ Note concerning processing. - Suite of notes. + A note that describes or explains the processing in a human readable form. """ resource_type = "PaymentReconciliationProcessNote" @@ -182,12 +202,12 @@ def __init__(self, jsondict=None, strict=True): """ self.text = None - """ Comment on the processing. + """ Note explanatory text. Type `str`. """ self.type = None """ display | print | printoper. - Type `CodeableConcept` (represented as `dict` in JSON). """ + Type `str`. """ super(PaymentReconciliationProcessNote, self).__init__(jsondict=jsondict, strict=strict) @@ -195,7 +215,7 @@ def elementProperties(self): js = super(PaymentReconciliationProcessNote, self).elementProperties() js.extend([ ("text", "text", str, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", str, False, None, False), ]) return js diff --git a/fhirclient/models/paymentreconciliation_tests.py b/fhirclient/models/paymentreconciliation_tests.py index 57a2269c0..edc7aa4af 100644 --- a/fhirclient/models/paymentreconciliation_tests.py +++ b/fhirclient/models/paymentreconciliation_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -34,46 +34,53 @@ def testPaymentReconciliation1(self): def implPaymentReconciliation1(self, inst): self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.detail[0].amount.code, "USD") - self.assertEqual(inst.detail[0].amount.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.detail[0].amount.value, 1000.0) + self.assertEqual(inst.detail[0].amount.currency, "USD") + self.assertEqual(inst.detail[0].amount.value, 3500.0) self.assertEqual(inst.detail[0].date.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.detail[0].date.as_json(), "2014-08-16") + self.assertEqual(inst.detail[0].identifier.system, "http://www.BenefitsInc.com/payment/2018/detail") + self.assertEqual(inst.detail[0].identifier.value, "10-12345-001") self.assertEqual(inst.detail[0].type.coding[0].code, "payment") - self.assertEqual(inst.detail[0].type.coding[0].system, "http://hl7.org/fhir/payment-type") - self.assertEqual(inst.detail[1].amount.code, "USD") - self.assertEqual(inst.detail[1].amount.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.detail[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/payment-type") + self.assertEqual(inst.detail[1].amount.currency, "USD") self.assertEqual(inst.detail[1].amount.value, 4000.0) self.assertEqual(inst.detail[1].date.date, FHIRDate("2014-08-12").date) self.assertEqual(inst.detail[1].date.as_json(), "2014-08-12") + self.assertEqual(inst.detail[1].identifier.system, "http://www.BenefitsInc.com/payment/2018/detail") + self.assertEqual(inst.detail[1].identifier.value, "10-12345-002") self.assertEqual(inst.detail[1].type.coding[0].code, "payment") - self.assertEqual(inst.detail[1].type.coding[0].system, "http://hl7.org/fhir/payment-type") - self.assertEqual(inst.detail[2].amount.code, "USD") - self.assertEqual(inst.detail[2].amount.system, "urn:iso:std:iso:4217") + self.assertEqual(inst.detail[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/payment-type") + self.assertEqual(inst.detail[2].amount.currency, "USD") self.assertEqual(inst.detail[2].amount.value, -1500.0) self.assertEqual(inst.detail[2].date.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.detail[2].date.as_json(), "2014-08-16") + self.assertEqual(inst.detail[2].identifier.system, "http://www.BenefitsInc.com/payment/2018/detail") + self.assertEqual(inst.detail[2].identifier.value, "10-12345-003") self.assertEqual(inst.detail[2].type.coding[0].code, "advance") - self.assertEqual(inst.detail[2].type.coding[0].system, "http://hl7.org/fhir/payment-type") + self.assertEqual(inst.detail[2].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/payment-type") self.assertEqual(inst.disposition, "2014 August mid-month settlement.") - self.assertEqual(inst.form.coding[0].code, "PAYREC/2016/01B") - self.assertEqual(inst.form.coding[0].system, "http://ncforms.org/formid") + self.assertEqual(inst.formCode.coding[0].code, "PAYREC/2016/01B") + self.assertEqual(inst.formCode.coding[0].system, "http://ncforms.org/formid") self.assertEqual(inst.id, "ER2500") self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/enrollmentresponse") self.assertEqual(inst.identifier[0].value, "781234") - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/remittance-outcome") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome, "complete") + self.assertEqual(inst.paymentAmount.currency, "USD") + self.assertEqual(inst.paymentAmount.value, 7000.0) + self.assertEqual(inst.paymentDate.date, FHIRDate("2014-08-01").date) + self.assertEqual(inst.paymentDate.as_json(), "2014-08-01") + self.assertEqual(inst.paymentIdentifier.system, "http://www.BenefitsInc.com/payment/2018") + self.assertEqual(inst.paymentIdentifier.value, "10-12345") self.assertEqual(inst.period.end.date, FHIRDate("2014-08-31").date) self.assertEqual(inst.period.end.as_json(), "2014-08-31") self.assertEqual(inst.period.start.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.period.start.as_json(), "2014-08-16") self.assertEqual(inst.processNote[0].text, "Due to the year end holiday the cutoff for submissions for December will be the 28th.") - self.assertEqual(inst.processNote[0].type.coding[0].code, "display") - self.assertEqual(inst.processNote[0].type.coding[0].system, "http://hl7.org/fhir/note-type") + self.assertEqual(inst.processNote[0].type, "display") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
A human-readable rendering of the PaymentReconciliation
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.total.code, "USD") - self.assertEqual(inst.total.system, "urn:iso:std:iso:4217") - self.assertEqual(inst.total.value, 3500.0) diff --git a/fhirclient/models/period.py b/fhirclient/models/period.py index e643a4089..4cdb26f7b 100644 --- a/fhirclient/models/period.py +++ b/fhirclient/models/period.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Period) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Period) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/person.py b/fhirclient/models/person.py index d31b555b9..7c68f213a 100644 --- a/fhirclient/models/person.py +++ b/fhirclient/models/person.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Person) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Person) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -50,7 +50,7 @@ def __init__(self, jsondict=None, strict=True): self.managingOrganization = None """ The organization that is the custodian of the person record. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.name = None """ A name associated with the person. @@ -105,7 +105,7 @@ def __init__(self, jsondict=None, strict=True): self.target = None """ The resource to which this actual person is associated. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson, Person` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(PersonLink, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/person_tests.py b/fhirclient/models/person_tests.py index b0b59360b..4cfdc247c 100644 --- a/fhirclient/models/person_tests.py +++ b/fhirclient/models/person_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,6 +37,9 @@ def implPerson1(self, inst): self.assertEqual(inst.birthDate.as_json(), "1963") self.assertEqual(inst.gender, "female") self.assertEqual(inst.id, "f002") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name[0].text, "Ariadne Bor-Jansma") self.assertEqual(inst.name[0].use, "usual") self.assertEqual(inst.photo.contentType, "image/jpeg") @@ -70,9 +73,12 @@ def implPerson2(self, inst): self.assertEqual(inst.identifier[0].period.start.as_json(), "2001-05-06") self.assertEqual(inst.identifier[0].system, "urn:oid:1.2.36.146.595.217.0.1") self.assertEqual(inst.identifier[0].type.coding[0].code, "MR") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/v2/0203") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") self.assertEqual(inst.identifier[0].use, "usual") self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name[0].family, "Chalmers") self.assertEqual(inst.name[0].given[0], "Peter") self.assertEqual(inst.name[0].given[1], "James") diff --git a/fhirclient/models/plandefinition.py b/fhirclient/models/plandefinition.py index c0e209499..458c37c02 100644 --- a/fhirclient/models/plandefinition.py +++ b/fhirclient/models/plandefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/PlanDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PlanDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -35,30 +35,38 @@ def __init__(self, jsondict=None, strict=True): """ When the plan definition was approved by publisher. Type `FHIRDate` (represented as `str` in JSON). """ + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.contact = None """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ - self.contributor = None - """ A content contributor. - List of `Contributor` items (represented as `dict` in JSON). """ - self.copyright = None """ Use and/or publishing restrictions. Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None """ Natural language description of the plan definition. Type `str`. """ + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.effectivePeriod = None """ When the plan definition is expected to be used. Type `Period` (represented as `dict` in JSON). """ + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.experimental = None """ For testing purposes, not real usage. Type `bool`. """ @@ -81,7 +89,7 @@ def __init__(self, jsondict=None, strict=True): self.library = None """ Logic used by the plan definition. - List of `FHIRReference` items referencing `Library` (represented as `dict` in JSON). """ + List of `str` items. """ self.name = None """ Name for this plan definition (computer friendly). @@ -96,35 +104,52 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.relatedArtifact = None - """ Related artifacts for the asset. + """ Additional documentation, citations. List of `RelatedArtifact` items (represented as `dict` in JSON). """ + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + self.status = None """ draft | active | retired | unknown. Type `str`. """ + self.subjectCodeableConcept = None + """ Type of individual the plan definition is focused on. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ Type of individual the plan definition is focused on. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate title of the plan definition. + Type `str`. """ + self.title = None """ Name for this plan definition (human friendly). Type `str`. """ self.topic = None - """ E.g. Education, Treatment, Assessment, etc. + """ E.g. Education, Treatment, Assessment. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.type = None - """ order-set | protocol | eca-rule. + """ order-set | clinical-protocol | eca-rule | workflow-definition. Type `CodeableConcept` (represented as `dict` in JSON). """ self.url = None - """ Logical URI to reference this plan definition (globally unique). + """ Canonical identifier for this plan definition, represented as a URI + (globally unique). Type `str`. """ self.usage = None - """ Describes the clinical usage of the asset. + """ Describes the clinical usage of the plan. Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -138,23 +163,29 @@ def elementProperties(self): js.extend([ ("action", "action", PlanDefinitionAction, True, None, False), ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("contributor", "contributor", contributor.Contributor, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), ("experimental", "experimental", bool, False, None, False), ("goal", "goal", PlanDefinitionGoal, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), - ("library", "library", fhirreference.FHIRReference, True, None, False), + ("library", "library", str, True, None, False), ("name", "name", str, False, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), ("status", "status", str, False, None, True), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), + ("subtitle", "subtitle", str, False, None, False), ("title", "title", str, False, None, False), ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), @@ -171,7 +202,7 @@ def elementProperties(self): class PlanDefinitionAction(backboneelement.BackboneElement): """ Action defined by the plan. - An action to be taken as part of the plan. + An action or group of actions to be taken as part of the plan. """ resource_type = "PlanDefinitionAction" @@ -200,12 +231,16 @@ def __init__(self, jsondict=None, strict=True): """ Whether or not the action is applicable. List of `PlanDefinitionActionCondition` items (represented as `dict` in JSON). """ - self.definition = None + self.definitionCanonical = None """ Description of the activity to be performed. - Type `FHIRReference` referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ + Type `str`. """ + + self.definitionUri = None + """ Description of the activity to be performed. + Type `str`. """ self.description = None - """ Short description of the action. + """ Brief description of the action. Type `str`. """ self.documentation = None @@ -228,10 +263,6 @@ def __init__(self, jsondict=None, strict=True): """ Input data requirements. List of `DataRequirement` items (represented as `dict` in JSON). """ - self.label = None - """ User-visible label for the action (e.g. 1. or A.). - Type `str`. """ - self.output = None """ Output data definition. List of `DataRequirement` items (represented as `dict` in JSON). """ @@ -244,6 +275,14 @@ def __init__(self, jsondict=None, strict=True): """ yes | no. Type `str`. """ + self.prefix = None + """ User-visible prefix for the action (e.g. 1. or A.). + Type `str`. """ + + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + self.reason = None """ Why the action should be performed. List of `CodeableConcept` items (represented as `dict` in JSON). """ @@ -260,11 +299,23 @@ def __init__(self, jsondict=None, strict=True): """ any | all | all-or-none | exactly-one | at-most-one | one-or-more. Type `str`. """ + self.subjectCodeableConcept = None + """ Type of individual the action is focused on. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ Type of individual the action is focused on. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.textEquivalent = None """ Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system. Type `str`. """ + self.timingAge = None + """ When the action should take place. + Type `Age` (represented as `dict` in JSON). """ + self.timingDateTime = None """ When the action should take place. Type `FHIRDate` (represented as `str` in JSON). """ @@ -291,15 +342,15 @@ def __init__(self, jsondict=None, strict=True): self.transform = None """ Transform to apply the template. - Type `FHIRReference` referencing `StructureMap` (represented as `dict` in JSON). """ + Type `str`. """ - self.triggerDefinition = None + self.trigger = None """ When the action should be triggered. List of `TriggerDefinition` items (represented as `dict` in JSON). """ self.type = None """ create | update | remove | fire-event. - Type `Coding` (represented as `dict` in JSON). """ + Type `CodeableConcept` (represented as `dict` in JSON). """ super(PlanDefinitionAction, self).__init__(jsondict=jsondict, strict=strict) @@ -310,31 +361,36 @@ def elementProperties(self): ("cardinalityBehavior", "cardinalityBehavior", str, False, None, False), ("code", "code", codeableconcept.CodeableConcept, True, None, False), ("condition", "condition", PlanDefinitionActionCondition, True, None, False), - ("definition", "definition", fhirreference.FHIRReference, False, None, False), + ("definitionCanonical", "definitionCanonical", str, False, "definition", False), + ("definitionUri", "definitionUri", str, False, "definition", False), ("description", "description", str, False, None, False), ("documentation", "documentation", relatedartifact.RelatedArtifact, True, None, False), ("dynamicValue", "dynamicValue", PlanDefinitionActionDynamicValue, True, None, False), ("goalId", "goalId", str, True, None, False), ("groupingBehavior", "groupingBehavior", str, False, None, False), ("input", "input", datarequirement.DataRequirement, True, None, False), - ("label", "label", str, False, None, False), ("output", "output", datarequirement.DataRequirement, True, None, False), ("participant", "participant", PlanDefinitionActionParticipant, True, None, False), ("precheckBehavior", "precheckBehavior", str, False, None, False), + ("prefix", "prefix", str, False, None, False), + ("priority", "priority", str, False, None, False), ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), ("relatedAction", "relatedAction", PlanDefinitionActionRelatedAction, True, None, False), ("requiredBehavior", "requiredBehavior", str, False, None, False), ("selectionBehavior", "selectionBehavior", str, False, None, False), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), ("textEquivalent", "textEquivalent", str, False, None, False), + ("timingAge", "timingAge", age.Age, False, "timing", False), ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), ("timingDuration", "timingDuration", duration.Duration, False, "timing", False), ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), ("timingRange", "timingRange", range.Range, False, "timing", False), ("timingTiming", "timingTiming", timing.Timing, False, "timing", False), ("title", "title", str, False, None, False), - ("transform", "transform", fhirreference.FHIRReference, False, None, False), - ("triggerDefinition", "triggerDefinition", triggerdefinition.TriggerDefinition, True, None, False), - ("type", "type", coding.Coding, False, None, False), + ("transform", "transform", str, False, None, False), + ("trigger", "trigger", triggerdefinition.TriggerDefinition, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -342,7 +398,7 @@ def elementProperties(self): class PlanDefinitionActionCondition(backboneelement.BackboneElement): """ Whether or not the action is applicable. - An expression that describes applicability criteria, or start/stop + An expression that describes applicability criteria or start/stop conditions for the action. """ @@ -356,31 +412,21 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.description = None - """ Natural language description of the condition. - Type `str`. """ - self.expression = None """ Boolean-valued expression. - Type `str`. """ + Type `Expression` (represented as `dict` in JSON). """ self.kind = None """ applicability | start | stop. Type `str`. """ - self.language = None - """ Language of the expression. - Type `str`. """ - super(PlanDefinitionActionCondition, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(PlanDefinitionActionCondition, self).elementProperties() js.extend([ - ("description", "description", str, False, None, False), - ("expression", "expression", str, False, None, False), + ("expression", "expression", expression.Expression, False, None, False), ("kind", "kind", str, False, None, True), - ("language", "language", str, False, None, False), ]) return js @@ -405,17 +451,9 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.description = None - """ Natural language description of the dynamic value. - Type `str`. """ - self.expression = None """ An expression that provides the dynamic value for the customization. - Type `str`. """ - - self.language = None - """ Language of the expression. - Type `str`. """ + Type `Expression` (represented as `dict` in JSON). """ self.path = None """ The path to the element to be set dynamically. @@ -426,9 +464,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(PlanDefinitionActionDynamicValue, self).elementProperties() js.extend([ - ("description", "description", str, False, None, False), - ("expression", "expression", str, False, None, False), - ("language", "language", str, False, None, False), + ("expression", "expression", expression.Expression, False, None, False), ("path", "path", str, False, None, False), ]) return js @@ -451,11 +487,11 @@ def __init__(self, jsondict=None, strict=True): """ self.role = None - """ E.g. Nurse, Surgeon, Parent, etc. + """ E.g. Nurse, Surgeon, Parent. Type `CodeableConcept` (represented as `dict` in JSON). """ self.type = None - """ patient | practitioner | related-person. + """ patient | practitioner | related-person | device. Type `str`. """ super(PlanDefinitionActionParticipant, self).__init__(jsondict=jsondict, strict=strict) @@ -540,7 +576,7 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.category = None - """ E.g. Treatment, dietary, behavioral, etc. + """ E.g. Treatment, dietary, behavioral. Type `CodeableConcept` (represented as `dict` in JSON). """ self.description = None @@ -631,21 +667,17 @@ def elementProperties(self): import sys try: - from . import codeableconcept + from . import age except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] + age = sys.modules[__package__ + '.age'] try: - from . import coding + from . import codeableconcept except ImportError: - coding = sys.modules[__package__ + '.coding'] + codeableconcept = sys.modules[__package__ + '.codeableconcept'] try: from . import contactdetail except ImportError: contactdetail = sys.modules[__package__ + '.contactdetail'] -try: - from . import contributor -except ImportError: - contributor = sys.modules[__package__ + '.contributor'] try: from . import datarequirement except ImportError: @@ -654,6 +686,10 @@ def elementProperties(self): from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/plandefinition_tests.py b/fhirclient/models/plandefinition_tests.py index b140dc6ea..5fe6208c3 100644 --- a/fhirclient/models/plandefinition_tests.py +++ b/fhirclient/models/plandefinition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,6 +32,7 @@ def testPlanDefinition1(self): self.implPlanDefinition1(inst2) def implPlanDefinition1(self, inst): + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].definitionCanonical, "#1111") self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[0].url, "day") self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[0].valueInteger, 1) self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].url, "day") @@ -39,6 +40,7 @@ def implPlanDefinition1(self, inst): self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/timing-daysOfCycle") self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].id, "action-1") self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].textEquivalent, "Gemcitabine 1250 mg/m² IV over 30 minutes on days 1 and 8") + self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].definitionCanonical, "#2222") self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].extension[0].extension[0].url, "day") self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].extension[0].extension[0].valueInteger, 1) self.assertEqual(inst.action[0].action[0].action[0].action[0].action[1].extension[0].url, "http://hl7.org/fhir/StructureDefinition/timing-daysOfCycle") @@ -57,10 +59,9 @@ def implPlanDefinition1(self, inst): self.assertEqual(inst.action[0].selectionBehavior, "exactly-one") self.assertEqual(inst.approvalDate.date, FHIRDate("2016-07-27").date) self.assertEqual(inst.approvalDate.as_json(), "2016-07-27") + self.assertEqual(inst.author[0].name, "Lee Surprenant") self.assertEqual(inst.contained[0].id, "1111") self.assertEqual(inst.contained[1].id, "2222") - self.assertEqual(inst.contributor[0].name, "Lee Surprenant") - self.assertEqual(inst.contributor[0].type, "author") self.assertEqual(inst.copyright, "All rights reserved.") self.assertTrue(inst.experimental) self.assertEqual(inst.id, "KDN5") @@ -68,6 +69,9 @@ def implPlanDefinition1(self, inst): self.assertEqual(inst.identifier[0].value, "KDN5") self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-07-27").date) self.assertEqual(inst.lastReviewDate.as_json(), "2016-07-27") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.publisher, "National Comprehensive Cancer Network, Inc.") self.assertEqual(inst.relatedArtifact[0].display, "NCCN Guidelines for Kidney Cancer. V.2.2016") self.assertEqual(inst.relatedArtifact[0].type, "derived-from") @@ -90,7 +94,7 @@ def implPlanDefinition1(self, inst): self.assertEqual(inst.useContext[1].extension[0].valueString, "A") self.assertEqual(inst.useContext[1].valueCodeableConcept.text, "Collecting Duct/Medullary Subtypes") self.assertEqual(inst.useContext[2].code.code, "focus") - self.assertEqual(inst.useContext[2].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[2].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[2].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") self.assertEqual(inst.useContext[2].extension[0].valueString, "A") self.assertEqual(inst.useContext[2].valueCodeableConcept.text, "Kidney Cancer") @@ -105,14 +109,14 @@ def implPlanDefinition1(self, inst): self.assertEqual(inst.useContext[4].extension[0].valueString, "B") self.assertEqual(inst.useContext[4].valueCodeableConcept.text, "Collecting Duct/Medullary Subtypes") self.assertEqual(inst.useContext[5].code.code, "focus") - self.assertEqual(inst.useContext[5].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[5].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[5].extension[0].url, "http://hl7.org/fhir/StructureDefinition/usagecontext-group") self.assertEqual(inst.useContext[5].extension[0].valueString, "B") self.assertEqual(inst.useContext[5].valueCodeableConcept.text, "Kidney Cancer – Collecting Duct/Medullary Subtypes - Metastatic") self.assertEqual(inst.version, "1") def testPlanDefinition2(self): - inst = self.instantiate_from("plandefinition-example.json") + inst = self.instantiate_from("plandefinition-options-example.json") self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") self.implPlanDefinition2(inst) @@ -122,33 +126,306 @@ def testPlanDefinition2(self): self.implPlanDefinition2(inst2) def implPlanDefinition2(self, inst): - self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[0].expression, "Now()") + self.assertEqual(inst.action[0].action[0].definitionCanonical, "#activitydefinition-medicationrequest-1") + self.assertEqual(inst.action[0].action[0].id, "medication-action-1") + self.assertEqual(inst.action[0].action[0].title, "Administer Medication 1") + self.assertEqual(inst.action[0].action[1].definitionCanonical, "#activitydefinition-medicationrequest-2") + self.assertEqual(inst.action[0].action[1].id, "medication-action-2") + self.assertEqual(inst.action[0].action[1].relatedAction[0].actionId, "medication-action-1") + self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.unit, "h") + self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.value, 1) + self.assertEqual(inst.action[0].action[1].relatedAction[0].relationship, "after-end") + self.assertEqual(inst.action[0].action[1].title, "Administer Medication 2") + self.assertEqual(inst.action[0].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].selectionBehavior, "all") + self.assertEqual(inst.contained[0].id, "activitydefinition-medicationrequest-1") + self.assertEqual(inst.contained[1].id, "activitydefinition-medicationrequest-2") + self.assertEqual(inst.id, "options-example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "This example illustrates relationships between actions.") + + def testPlanDefinition3(self): + inst = self.instantiate_from("plandefinition-example-cardiology-os.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition3(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + self.implPlanDefinition3(inst2) + + def implPlanDefinition3(self, inst): + self.assertEqual(inst.action[0].action[0].action[0].definitionCanonical, "#referralToCardiologyConsult") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[0].expression.expression, "Now()") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[0].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[0].path, "timing.event") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[1].expression.expression, "Code '261QM0850X' from CardiologyChestPainLogic.\"NUCC Provider Taxonomy\" display 'Adult Mental Health'") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[1].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[1].path, "specialty") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[2].expression.expression, "CardiologyChestPainLogic.ServiceRequestFulfillmentTime") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[2].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[2].path, "occurrenceDateTime") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[3].expression.expression, "CardiologyChestPainLogic.Patient") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[3].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[3].path, "subject") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[4].expression.expression, "CardiologyChestPainLogic.Practitioner") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[4].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[4].path, "requester.agent") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[5].expression.expression, "CardiologyChestPainLogic.CardiologyReferralReason") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[5].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[5].path, "reasonCode") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[6].expression.expression, "CardiologyChestPainLogic.RiskAssessment") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[6].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[6].path, "reasonReference") + self.assertEqual(inst.action[0].action[0].action[0].textEquivalent, "Referral to cardiology to evaluate chest pain (routine)") + self.assertEqual(inst.action[0].action[0].action[1].definitionCanonical, "#CollectReferralReason") + self.assertEqual(inst.action[0].action[0].action[1].title, "Reason for cardiology consultation") + self.assertEqual(inst.action[0].action[0].action[2].definitionCanonical, "#CardiologyConsultationGoal") + self.assertEqual(inst.action[0].action[0].action[2].title, "Goal of cardiology consultation") + self.assertEqual(inst.action[0].action[0].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[0].selectionBehavior, "any") + self.assertEqual(inst.action[0].action[0].title, "Consults and Referrals") + self.assertEqual(inst.action[0].action[1].action[0].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[1].action[0].selectionBehavior, "at-most-one") + self.assertEqual(inst.action[0].action[1].action[1].action[0].definitionCanonical, "#metoprololTartrate25Prescription") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[0].expression.expression, "'draft'") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[0].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[0].path, "status") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[1].expression.expression, "CardiologyChestPainLogic.Patient") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[1].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[1].path, "patient") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[2].expression.expression, "CardiologyChestPainLogic.Practitioner") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[2].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[0].dynamicValue[2].path, "prescriber") + self.assertEqual(inst.action[0].action[1].action[1].action[0].textEquivalent, "metoprolol tartrate 25 mg tablet 1 tablet oral 2 time daily") + self.assertEqual(inst.action[0].action[1].action[1].action[1].definitionCanonical, "#metoprololTartrate50Prescription") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[0].expression.expression, "'draft'") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[0].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[0].path, "status") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[1].expression.expression, "CardiologyChestPainLogic.Patient") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[1].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[1].path, "patient") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[2].expression.expression, "CardiologyChestPainLogic.Practitioner") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[2].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[1].dynamicValue[2].path, "prescriber") + self.assertEqual(inst.action[0].action[1].action[1].action[1].textEquivalent, "metoprolol tartrate 50 mg tablet 1 tablet oral 2 time daily") + self.assertEqual(inst.action[0].action[1].action[1].action[2].definitionCanonical, "#amlodipinePrescription") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[0].expression.expression, "'draft'") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[0].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[0].path, "status") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[1].expression.expression, "CardiologyChestPainLogic.Patient") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[1].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[1].path, "patient") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[2].expression.expression, "CardiologyChestPainLogic.Practitioner") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[2].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[1].action[2].dynamicValue[2].path, "prescriber") + self.assertEqual(inst.action[0].action[1].action[1].action[2].textEquivalent, "amlodipine 5 tablet 1 tablet oral daily") + self.assertEqual(inst.action[0].action[1].action[1].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[1].action[1].selectionBehavior, "at-most-one") + self.assertEqual(inst.action[0].action[1].action[1].title, "Antianginal Therapy") + self.assertEqual(inst.action[0].action[1].action[2].action[0].definitionCanonical, "#nitroglycerinPrescription") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[0].expression.expression, "'draft'") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[0].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[0].path, "status") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[1].expression.expression, "CardiologyChestPainLogic.Patient") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[1].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[1].path, "patient") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[2].expression.expression, "CardiologyChestPainLogic.Practitioner") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[2].expression.language, "text/cql") + self.assertEqual(inst.action[0].action[1].action[2].action[0].dynamicValue[2].path, "prescriber") + self.assertEqual(inst.action[0].action[1].action[2].action[0].textEquivalent, "nitroglycerin 0.4 mg tablet sub-lingual every 5 minutes as needed for chest pain; maximum 3 tablets") + self.assertEqual(inst.action[0].action[1].action[2].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].action[1].action[2].selectionBehavior, "at-most-one") + self.assertEqual(inst.action[0].action[1].action[2].title, "Nitroglycerin") + self.assertEqual(inst.action[0].action[1].description, "Consider the following medications for stable patients to be initiated prior to the cardiology consultation.") + self.assertEqual(inst.action[0].action[1].title, "Medications") + self.assertEqual(inst.author[0].name, "Bruce Bray MD") + self.assertEqual(inst.author[1].name, "Scott Wall MD") + self.assertEqual(inst.author[2].name, "Aiden Abidov MD, PhD") + self.assertEqual(inst.contained[0].id, "cardiology-chestPain-logic") + self.assertEqual(inst.contained[1].id, "referralToCardiologyConsult") + self.assertEqual(inst.contained[2].id, "metoprololTartrate25Prescription") + self.assertEqual(inst.contained[3].id, "metoprololTartrate25Medication") + self.assertEqual(inst.contained[4].id, "metoprololTartrate25Substance") + self.assertEqual(inst.contained[5].id, "metoprololTartrate50Prescription") + self.assertEqual(inst.contained[6].id, "metoprololTartrate50Medication") + self.assertEqual(inst.contained[7].id, "metoprololTartrate50Substance") + self.assertEqual(inst.contained[8].id, "nitroglycerinPrescription") + self.assertEqual(inst.contained[9].id, "nitroglycerinMedication") + self.assertEqual(inst.copyright, "© Copyright Cognitive Medical Systems, Inc. 9444 Waples Street Suite 300 San Diego, CA 92121") + self.assertEqual(inst.date.date, FHIRDate("2017-08-29").date) + self.assertEqual(inst.date.as_json(), "2017-08-29") + self.assertEqual(inst.id, "example-cardiology-os") + self.assertEqual(inst.identifier[0].system, "urn:va.gov:kbs:knart:artifact:r1") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "bb7ccea6-9744-4743-854a-bcffd87191f6") + self.assertEqual(inst.identifier[1].system, "urn:va.gov:kbs:contract:VA118-16-D-1008:to:VA-118-16-F-1008-0007") + self.assertEqual(inst.identifier[1].value, "CLIN0004AG") + self.assertEqual(inst.identifier[2].system, "urn:cognitivemedicine.com:lab:jira") + self.assertEqual(inst.identifier[2].value, "KP-914") + self.assertEqual(inst.library[0], "#cardiology-chestPain-logic") + self.assertEqual(inst.name, "ChestPainCoronaryArteryDiseaseOrderSetKNART") + self.assertEqual(inst.publisher, "Department of Veterans Affairs") + self.assertEqual(inst.relatedArtifact[0].display, "Cardiology: Chest Pain (CP) / Coronary Artery Disease (CAD) Clinical Content White Paper") + self.assertEqual(inst.relatedArtifact[0].type, "derived-from") + self.assertEqual(inst.relatedArtifact[0].url, "NEED-A-URL-HERE") + self.assertEqual(inst.relatedArtifact[1].display, "Outcome CVD (coronary death, myocardial infarction, coronary insufficiency, angina, ischemic stroke, hemorrhagic stroke, transient ischemic attack, peripheral artery disease, heart failure)") + self.assertEqual(inst.relatedArtifact[1].type, "justification") + self.assertEqual(inst.relatedArtifact[1].url, "https://www.framinghamheartstudy.org/risk-functions/cardiovascular-disease/10-year-risk.php") + self.assertEqual(inst.relatedArtifact[2].display, "General cardiovascular risk profile for use in primary care: the Framingham Heart Study") + self.assertEqual(inst.relatedArtifact[2].type, "justification") + self.assertEqual(inst.relatedArtifact[2].url, "https://www.framinghamheartstudy.org/risk-functions/cardiovascular-disease/10-year-risk.php") + self.assertEqual(inst.relatedArtifact[3].type, "justification") + self.assertEqual(inst.relatedArtifact[3].url, "NEED-A-URL-HERE") + self.assertEqual(inst.relatedArtifact[4].type, "justification") + self.assertEqual(inst.relatedArtifact[4].url, "NEED-A-URL-HERE") + self.assertEqual(inst.relatedArtifact[5].display, "LABEL: ASPIRIN 81 MG- aspirin tablet, coated") + self.assertEqual(inst.relatedArtifact[5].type, "justification") + self.assertEqual(inst.relatedArtifact[5].url, "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=b4064039-2345-4227-b83d-54dc13a838d3") + self.assertEqual(inst.relatedArtifact[6].display, "LABEL: CLOPIDOGREL- clopidogrel bisulfate tablet, film coated") + self.assertEqual(inst.relatedArtifact[6].type, "justification") + self.assertEqual(inst.relatedArtifact[6].url, "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=7fe85155-bc00-406b-b097-e8aece187a8a") + self.assertEqual(inst.relatedArtifact[7].display, "LABEL: LIPITOR- atorvastatin calcium tablet, film coated") + self.assertEqual(inst.relatedArtifact[7].type, "justification") + self.assertEqual(inst.relatedArtifact[7].url, "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=7fe85155-bc00-406b-b097-e8aece187a8a") + self.assertEqual(inst.relatedArtifact[8].display, "LABEL: METOPROLOL SUCCINATE EXTENDED-RELEASE - metoprolol succinate tablet, film coated, extended release") + self.assertEqual(inst.relatedArtifact[8].type, "justification") + self.assertEqual(inst.relatedArtifact[8].url, "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=2d948600-35d8-4490-983b-918bdce488c8") + self.assertEqual(inst.relatedArtifact[9].display, "LABEL: NITROGLYCERIN- nitroglycerin tablet") + self.assertEqual(inst.relatedArtifact[9].type, "justification") + self.assertEqual(inst.relatedArtifact[9].url, "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=67bf2a15-b115-47ac-ae28-ce2dafd6b5c9") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Chest Pain (CP) - Coronary Artery Disease (CAD) Order Set KNART") + self.assertEqual(inst.type.coding[0].code, "order-set") + self.assertEqual(inst.type.coding[0].display, "Order Set") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/plan-definition-type") + self.assertEqual(inst.url, "http://va.gov/kas/orderset/B5-Cardiology-ChestPainCAD-OS") + self.assertEqual(inst.useContext[0].code.code, "focus") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "look up value") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "appropriate snomed condition") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.version, "0.1") + + def testPlanDefinition4(self): + inst = self.instantiate_from("plandefinition-protocol-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition4(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + self.implPlanDefinition4(inst2) + + def implPlanDefinition4(self, inst): + self.assertEqual(inst.action[0].cardinalityBehavior, "single") + self.assertEqual(inst.action[0].condition[0].expression.expression, "exists ([Condition: Obesity]) or not exists ([Observation: BMI] O where O.effectiveDateTime 2 years or less before Today())") + self.assertEqual(inst.action[0].condition[0].expression.language, "text/cql") + self.assertEqual(inst.action[0].condition[0].kind, "applicability") + self.assertEqual(inst.action[0].definitionCanonical, "#procedure") + self.assertEqual(inst.action[0].description, "Measure, Weight, Height, Waist, Circumference; Calculate BMI") + self.assertEqual(inst.action[0].goalId[0], "reduce-bmi-ratio") + self.assertEqual(inst.action[0].requiredBehavior, "must-unless-documented") + self.assertEqual(inst.action[0].title, "Measure BMI") + self.assertEqual(inst.author[0].name, "National Heart, Lung, and Blood Institute") + self.assertEqual(inst.author[0].telecom[0].system, "url") + self.assertEqual(inst.author[0].telecom[0].value, "https://www.nhlbi.nih.gov/health-pro/guidelines") + self.assertEqual(inst.contained[0].id, "procedure") + self.assertEqual(inst.goal[0].addresses[0].coding[0].code, "414916001") + self.assertEqual(inst.goal[0].addresses[0].coding[0].display, "Obesity (disorder)") + self.assertEqual(inst.goal[0].addresses[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.goal[0].category.text, "Treatment") + self.assertEqual(inst.goal[0].description.text, "Reduce BMI to below 25") + self.assertEqual(inst.goal[0].documentation[0].display, "Evaluation and Treatment Strategy") + self.assertEqual(inst.goal[0].documentation[0].type, "justification") + self.assertEqual(inst.goal[0].documentation[0].url, "https://www.nhlbi.nih.gov/health-pro/guidelines/current/obesity-guidelines/e_textbook/txgd/42.htm") + self.assertEqual(inst.goal[0].id, "reduce-bmi-ratio") + self.assertEqual(inst.goal[0].priority.text, "medium-priority") + self.assertEqual(inst.goal[0].start.text, "When the patient's BMI Ratio is at or above 25") + self.assertEqual(inst.goal[0].target[0].detailRange.high.unit, "kg/m2") + self.assertEqual(inst.goal[0].target[0].detailRange.high.value, 24.9) + self.assertEqual(inst.goal[0].target[0].due.unit, "a") + self.assertEqual(inst.goal[0].target[0].due.value, 1) + self.assertEqual(inst.goal[0].target[0].measure.coding[0].code, "39156-5") + self.assertEqual(inst.goal[0].target[0].measure.coding[0].display, "Body mass index (BMI) [Ratio]") + self.assertEqual(inst.goal[0].target[0].measure.coding[0].system, "http://loinc.org") + self.assertEqual(inst.id, "protocol-example") + self.assertEqual(inst.identifier[0].system, "http://acme.org") + self.assertEqual(inst.identifier[0].value, "example-1") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.purpose, "Example of A medical algorithm for assessment and treatment of overweight and obesity") + self.assertEqual(inst.relatedArtifact[0].display, "Overweight and Obesity Treatment Guidelines") + self.assertEqual(inst.relatedArtifact[0].type, "derived-from") + self.assertEqual(inst.relatedArtifact[0].url, "http://www.nhlbi.nih.gov/health-pro/guidelines/current/obesity-guidelines/e_textbook/txgd/algorthm/algorthm.htm") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Obesity Assessment Protocol") + self.assertEqual(inst.type.coding[0].code, "clinical-protocol") + self.assertEqual(inst.useContext[0].code.code, "focus") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "414916001") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Obesity (disorder)") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") + + def testPlanDefinition5(self): + inst = self.instantiate_from("plandefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") + self.implPlanDefinition5(inst) + + js = inst.as_json() + self.assertEqual("PlanDefinition", js["resourceType"]) + inst2 = plandefinition.PlanDefinition(js) + self.implPlanDefinition5(inst2) + + def implPlanDefinition5(self, inst): + self.assertEqual(inst.action[0].action[0].action[0].definitionCanonical, "#referralToMentalHealthCare") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[0].expression.expression, "Now()") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[0].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[0].path, "timing.event") - self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[1].expression, "Code '261QM0850X' from SuicideRiskLogic.\"NUCC Provider Taxonomy\" display 'Adult Mental Health'") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[1].expression.expression, "Code '261QM0850X' from SuicideRiskLogic.\"NUCC Provider Taxonomy\" display 'Adult Mental Health'") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[1].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[1].path, "specialty") - self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[2].expression, "SuicideRiskLogic.ReferralRequestFulfillmentTime") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[2].expression.expression, "SuicideRiskLogic.ServiceRequestFulfillmentTime") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[2].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[2].path, "occurrenceDateTime") - self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[3].expression, "SuicideRiskLogic.Patient") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[3].expression.expression, "SuicideRiskLogic.Patient") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[3].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[3].path, "subject") - self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[4].expression, "SuicideRiskLogic.Practitioner") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[4].expression.expression, "SuicideRiskLogic.Practitioner") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[4].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[4].path, "requester.agent") - self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[5].expression, "SuicideRiskLogic.RiskAssessmentScore") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[5].expression.expression, "SuicideRiskLogic.RiskAssessmentScore") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[5].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[5].path, "reasonCode") - self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[6].expression, "SuicideRiskLogic.RiskAssessment") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[6].expression.expression, "SuicideRiskLogic.RiskAssessment") + self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[6].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].action[0].dynamicValue[6].path, "reasonReference") self.assertEqual(inst.action[0].action[0].action[0].textEquivalent, "Refer to outpatient mental health program for evaluation and treatment of mental health conditions now") self.assertEqual(inst.action[0].action[0].groupingBehavior, "logical-group") self.assertEqual(inst.action[0].action[0].selectionBehavior, "any") self.assertEqual(inst.action[0].action[0].title, "Consults and Referrals") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[0].expression, "'draft'") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].definitionCanonical, "#citalopramPrescription") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[0].expression.expression, "'draft'") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[0].expression.language, "text/cql") self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[0].path, "status") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[1].expression, "SuicideRiskLogic.Patient") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[1].expression.expression, "SuicideRiskLogic.Patient") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[1].expression.language, "text/cql") self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[1].path, "patient") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[2].expression, "SuicideRiskLogic.Practitioner") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[2].expression.expression, "SuicideRiskLogic.Practitioner") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[2].expression.language, "text/cql") self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[2].path, "prescriber") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[3].expression, "SuicideRiskLogic.RiskAssessmentScore") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[3].expression.expression, "SuicideRiskLogic.RiskAssessmentScore") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[3].expression.language, "text/cql") self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[3].path, "reasonCode") - self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[4].expression, "SuicideRiskLogic.RiskAssessment") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[4].expression.expression, "SuicideRiskLogic.RiskAssessment") + self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[4].expression.language, "text/cql") self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].dynamicValue[4].path, "reasonReference") self.assertEqual(inst.action[0].action[1].action[0].action[0].action[0].textEquivalent, "citalopram 20 mg tablet 1 tablet oral 1 time daily now (30 table; 3 refills)") self.assertEqual(inst.action[0].action[1].action[0].action[0].action[1].textEquivalent, "escitalopram 10 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") @@ -166,9 +443,9 @@ def implPlanDefinition2(self, inst): self.assertEqual(inst.action[0].action[1].action[0].action[2].textEquivalent, "Serotonin Norepinephrine Reuptake Inhibitors (Choose a maximum of one or doument reasons for exception)") self.assertEqual(inst.action[0].action[1].action[0].action[3].textEquivalent, "Norepinephrine-Serotonin Modulators (Choose a maximum of one or document reasons for exception)") self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.contentType, "text/html") - self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.extension[0].url, "http://hl7.org/fhir/StructureDefinition/cqif-qualityOfEvidence") + self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.extension[0].url, "http://hl7.org/fhir/StructureDefinition/cqf-qualityOfEvidence") self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.extension[0].valueCodeableConcept.coding[0].code, "high") - self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.extension[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/evidence-quality") + self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.extension[0].valueCodeableConcept.coding[0].system, "http://terminology.hl7.org/CodeSystem/evidence-quality") self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.extension[0].valueCodeableConcept.text, "High Quality") self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.title, "Practice Guideline for the Treatment of Patients with Major Depressive Disorder") self.assertEqual(inst.action[0].action[1].action[0].documentation[0].document.url, "http://psychiatryonline.org/pb/assets/raw/sitewide/practice_guidelines/guidelines/mdd.pdf") @@ -182,6 +459,13 @@ def implPlanDefinition2(self, inst): self.assertEqual(inst.action[0].title, "Suicide Risk Assessment and Outpatient Management") self.assertEqual(inst.approvalDate.date, FHIRDate("2016-03-12").date) self.assertEqual(inst.approvalDate.as_json(), "2016-03-12") + self.assertEqual(inst.author[0].name, "Motive Medical Intelligence") + self.assertEqual(inst.author[0].telecom[0].system, "phone") + self.assertEqual(inst.author[0].telecom[0].use, "work") + self.assertEqual(inst.author[0].telecom[0].value, "415-362-4007") + self.assertEqual(inst.author[0].telecom[1].system, "email") + self.assertEqual(inst.author[0].telecom[1].use, "work") + self.assertEqual(inst.author[0].telecom[1].value, "info@motivemi.com") self.assertEqual(inst.contact[0].telecom[0].system, "phone") self.assertEqual(inst.contact[0].telecom[0].use, "work") self.assertEqual(inst.contact[0].telecom[0].value, "415-362-4007") @@ -192,14 +476,6 @@ def implPlanDefinition2(self, inst): self.assertEqual(inst.contained[1].id, "citalopramPrescription") self.assertEqual(inst.contained[2].id, "citalopramMedication") self.assertEqual(inst.contained[3].id, "citalopramSubstance") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].system, "phone") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].value, "415-362-4007") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].system, "email") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].use, "work") - self.assertEqual(inst.contributor[0].contact[0].telecom[1].value, "info@motivemi.com") - self.assertEqual(inst.contributor[0].name, "Motive Medical Intelligence") - self.assertEqual(inst.contributor[0].type, "author") self.assertEqual(inst.copyright, "© Copyright 2016 Motive Medical Intelligence. All rights reserved.") self.assertEqual(inst.date.date, FHIRDate("2015-08-15").date) self.assertEqual(inst.date.as_json(), "2015-08-15") @@ -217,13 +493,16 @@ def implPlanDefinition2(self, inst): self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") self.assertEqual(inst.lastReviewDate.date, FHIRDate("2016-08-15").date) self.assertEqual(inst.lastReviewDate.as_json(), "2016-08-15") + self.assertEqual(inst.library[0], "Library/suiciderisk-orderset-logic") self.assertEqual(inst.name, "LowSuicideRiskOrderSet") self.assertEqual(inst.publisher, "Motive Medical Intelligence") self.assertEqual(inst.purpose, "This order set helps ensure consistent application of appropriate orders for the care of low suicide risk patients.") self.assertEqual(inst.relatedArtifact[0].display, "Practice Guideline for the Treatment of Patients with Major Depressive Disorder") self.assertEqual(inst.relatedArtifact[0].type, "derived-from") self.assertEqual(inst.relatedArtifact[0].url, "http://psychiatryonline.org/pb/assets/raw/sitewide/practice_guidelines/guidelines/mdd.pdf") + self.assertEqual(inst.relatedArtifact[1].resource, "ActivityDefinition/referralPrimaryCareMentalHealth") self.assertEqual(inst.relatedArtifact[1].type, "composed-of") + self.assertEqual(inst.relatedArtifact[2].resource, "ActivityDefinition/citalopramPrescription") self.assertEqual(inst.relatedArtifact[2].type, "composed-of") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") @@ -232,105 +511,90 @@ def implPlanDefinition2(self, inst): self.assertEqual(inst.url, "http://motivemi.com/artifacts/PlanDefinition/low-suicide-risk-order-set") self.assertEqual(inst.usage, "This order set should be applied after assessing a patient for suicide risk, when the findings of that assessment indicate the patient has low suicide risk.") self.assertEqual(inst.useContext[0].code.code, "age") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "D000328") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Adult") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "https://meshb.nlm.nih.gov") self.assertEqual(inst.useContext[1].code.code, "focus") - self.assertEqual(inst.useContext[1].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[1].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].code, "87512008") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].display, "Mild major depression") self.assertEqual(inst.useContext[1].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[2].code.code, "focus") - self.assertEqual(inst.useContext[2].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[2].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].code, "40379007") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].display, "Major depression, recurrent, mild") self.assertEqual(inst.useContext[2].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[3].code.code, "focus") - self.assertEqual(inst.useContext[3].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[3].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].code, "394687007") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].display, "Low suicide risk") self.assertEqual(inst.useContext[3].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[4].code.code, "focus") - self.assertEqual(inst.useContext[4].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[4].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].code, "225337009") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].display, "Suicide risk assessment") self.assertEqual(inst.useContext[4].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[5].code.code, "user") - self.assertEqual(inst.useContext[5].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[5].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].code, "309343006") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].display, "Physician") self.assertEqual(inst.useContext[5].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.useContext[6].code.code, "venue") - self.assertEqual(inst.useContext[6].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[6].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].code, "440655000") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].display, "Outpatient environment") self.assertEqual(inst.useContext[6].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.version, "1.0.0") - def testPlanDefinition3(self): - inst = self.instantiate_from("plandefinition-options-example.json") - self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") - self.implPlanDefinition3(inst) - - js = inst.as_json() - self.assertEqual("PlanDefinition", js["resourceType"]) - inst2 = plandefinition.PlanDefinition(js) - self.implPlanDefinition3(inst2) - - def implPlanDefinition3(self, inst): - self.assertEqual(inst.action[0].action[0].id, "medication-action-1") - self.assertEqual(inst.action[0].action[0].title, "Administer Medication 1") - self.assertEqual(inst.action[0].action[1].id, "medication-action-2") - self.assertEqual(inst.action[0].action[1].relatedAction[0].actionId, "medication-action-1") - self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.unit, "h") - self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.value, 1) - self.assertEqual(inst.action[0].action[1].relatedAction[0].relationship, "after-end") - self.assertEqual(inst.action[0].action[1].title, "Administer Medication 2") - self.assertEqual(inst.action[0].groupingBehavior, "logical-group") - self.assertEqual(inst.action[0].selectionBehavior, "all") - self.assertEqual(inst.contained[0].id, "activitydefinition-medicationrequest-1") - self.assertEqual(inst.contained[1].id, "activitydefinition-medicationrequest-2") - self.assertEqual(inst.id, "options-example") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.div, "
[Put rendering here]
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "This example illustrates relationships between actions.") - - def testPlanDefinition4(self): + def testPlanDefinition6(self): inst = self.instantiate_from("plandefinition-predecessor-example.json") self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") - self.implPlanDefinition4(inst) + self.implPlanDefinition6(inst) js = inst.as_json() self.assertEqual("PlanDefinition", js["resourceType"]) inst2 = plandefinition.PlanDefinition(js) - self.implPlanDefinition4(inst2) + self.implPlanDefinition6(inst2) - def implPlanDefinition4(self, inst): - self.assertEqual(inst.action[0].action[0].condition[0].expression, "Should Administer Zika Virus Exposure Assessment") + def implPlanDefinition6(self, inst): + self.assertEqual(inst.action[0].action[0].condition[0].expression.expression, "Should Administer Zika Virus Exposure Assessment") + self.assertEqual(inst.action[0].action[0].condition[0].expression.language, "text/cql") self.assertEqual(inst.action[0].action[0].condition[0].kind, "applicability") - self.assertEqual(inst.action[0].action[1].condition[0].expression, "Should Order Serum + Urine rRT-PCR Test") + self.assertEqual(inst.action[0].action[0].definitionCanonical, "ActivityDefinition/administer-zika-virus-exposure-assessment") + self.assertEqual(inst.action[0].action[1].condition[0].expression.expression, "Should Order Serum + Urine rRT-PCR Test") + self.assertEqual(inst.action[0].action[1].condition[0].expression.language, "text/cql") self.assertEqual(inst.action[0].action[1].condition[0].kind, "applicability") - self.assertEqual(inst.action[0].action[2].condition[0].expression, "Should Order Serum Zika Virus IgM + Dengue Virus IgM") + self.assertEqual(inst.action[0].action[1].definitionCanonical, "ActivityDefinition/order-serum-urine-rrt-pcr-test") + self.assertEqual(inst.action[0].action[2].condition[0].expression.expression, "Should Order Serum Zika Virus IgM + Dengue Virus IgM") + self.assertEqual(inst.action[0].action[2].condition[0].expression.language, "text/cql") self.assertEqual(inst.action[0].action[2].condition[0].kind, "applicability") - self.assertEqual(inst.action[0].action[3].condition[0].expression, "Should Consider IgM Antibody Testing") + self.assertEqual(inst.action[0].action[2].definitionCanonical, "ActivityDefinition/order-serum-zika-dengue-virus-igm") + self.assertEqual(inst.action[0].action[3].condition[0].expression.expression, "Should Consider IgM Antibody Testing") + self.assertEqual(inst.action[0].action[3].condition[0].expression.language, "text/cql") self.assertEqual(inst.action[0].action[3].condition[0].kind, "applicability") - self.assertEqual(inst.action[0].action[4].condition[0].expression, "Should Provide Mosquito Prevention and Contraception Advice") + self.assertEqual(inst.action[0].action[3].definitionCanonical, "ActivityDefinition/consider-igm-antibody-testing") + self.assertEqual(inst.action[0].action[4].action[0].definitionCanonical, "ActivityDefinition/provide-mosquito-prevention-advice") + self.assertEqual(inst.action[0].action[4].action[1].definitionCanonical, "ActivityDefinition/provide-contraception-advice") + self.assertEqual(inst.action[0].action[4].condition[0].expression.expression, "Should Provide Mosquito Prevention and Contraception Advice") + self.assertEqual(inst.action[0].action[4].condition[0].expression.language, "text/cql") self.assertEqual(inst.action[0].action[4].condition[0].kind, "applicability") - self.assertEqual(inst.action[0].condition[0].expression, "Is Patient Pregnant") + self.assertEqual(inst.action[0].condition[0].expression.expression, "Is Patient Pregnant") + self.assertEqual(inst.action[0].condition[0].expression.language, "text/cql") self.assertEqual(inst.action[0].condition[0].kind, "applicability") self.assertEqual(inst.action[0].title, "Zika Virus Assessment") - self.assertEqual(inst.action[0].triggerDefinition[0].eventName, "patient-view") - self.assertEqual(inst.action[0].triggerDefinition[0].type, "named-event") + self.assertEqual(inst.action[0].trigger[0].name, "patient-view") + self.assertEqual(inst.action[0].trigger[0].type, "named-event") self.assertEqual(inst.date.date, FHIRDate("2016-11-14").date) self.assertEqual(inst.date.as_json(), "2016-11-14") self.assertEqual(inst.description, "Zika Virus Management intervention describing the CDC Guidelines for Zika Virus Reporting and Management.") self.assertEqual(inst.id, "zika-virus-intervention-initial") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "zika-virus-intervention") + self.assertEqual(inst.library[0], "Library/zika-virus-intervention-logic") self.assertEqual(inst.relatedArtifact[0].type, "derived-from") self.assertEqual(inst.relatedArtifact[0].url, "https://www.cdc.gov/mmwr/volumes/65/wr/mm6539e1.htm?s_cid=mm6539e1_w") + self.assertEqual(inst.relatedArtifact[1].resource, "PlanDefinition/zika-virus-intervention") self.assertEqual(inst.relatedArtifact[1].type, "successor") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") @@ -338,62 +602,4 @@ def implPlanDefinition4(self, inst): self.assertEqual(inst.topic[0].text, "Zika Virus Management") self.assertEqual(inst.url, "http://example.org/PlanDefinition/zika-virus-intervention") self.assertEqual(inst.version, "1.0.0") - - def testPlanDefinition5(self): - inst = self.instantiate_from("plandefinition-protocol-example.json") - self.assertIsNotNone(inst, "Must have instantiated a PlanDefinition instance") - self.implPlanDefinition5(inst) - - js = inst.as_json() - self.assertEqual("PlanDefinition", js["resourceType"]) - inst2 = plandefinition.PlanDefinition(js) - self.implPlanDefinition5(inst2) - - def implPlanDefinition5(self, inst): - self.assertEqual(inst.action[0].cardinalityBehavior, "single") - self.assertEqual(inst.action[0].condition[0].expression, "exists ([Condition: Obesity]) or not exists ([Observation: BMI] O where O.effectiveDateTime 2 years or less before Today())") - self.assertEqual(inst.action[0].condition[0].kind, "applicability") - self.assertEqual(inst.action[0].condition[0].language, "text/cql") - self.assertEqual(inst.action[0].goalId[0], "reduce-bmi-ratio") - self.assertEqual(inst.action[0].label, "Measure BMI") - self.assertEqual(inst.action[0].requiredBehavior, "must-unless-documented") - self.assertEqual(inst.action[0].title, "Measure, Weight, Height, Waist, Circumference; Calculate BMI") - self.assertEqual(inst.contained[0].id, "procedure") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].system, "url") - self.assertEqual(inst.contributor[0].contact[0].telecom[0].value, "https://www.nhlbi.nih.gov/health-pro/guidelines") - self.assertEqual(inst.contributor[0].name, "National Heart, Lung, and Blood Institute") - self.assertEqual(inst.contributor[0].type, "author") - self.assertEqual(inst.goal[0].addresses[0].coding[0].code, "414916001") - self.assertEqual(inst.goal[0].addresses[0].coding[0].display, "Obesity (disorder)") - self.assertEqual(inst.goal[0].addresses[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.goal[0].category.text, "Treatment") - self.assertEqual(inst.goal[0].description.text, "Reduce BMI to below 25") - self.assertEqual(inst.goal[0].documentation[0].display, "Evaluation and Treatment Strategy") - self.assertEqual(inst.goal[0].documentation[0].type, "justification") - self.assertEqual(inst.goal[0].documentation[0].url, "https://www.nhlbi.nih.gov/health-pro/guidelines/current/obesity-guidelines/e_textbook/txgd/42.htm") - self.assertEqual(inst.goal[0].id, "reduce-bmi-ratio") - self.assertEqual(inst.goal[0].priority.text, "medium-priority") - self.assertEqual(inst.goal[0].start.text, "When the patient's BMI Ratio is at or above 25") - self.assertEqual(inst.goal[0].target[0].detailRange.high.unit, "kg/m2") - self.assertEqual(inst.goal[0].target[0].detailRange.high.value, 24.9) - self.assertEqual(inst.goal[0].target[0].due.unit, "a") - self.assertEqual(inst.goal[0].target[0].due.value, 1) - self.assertEqual(inst.goal[0].target[0].measure.coding[0].code, "39156-5") - self.assertEqual(inst.goal[0].target[0].measure.coding[0].display, "Body mass index (BMI) [Ratio]") - self.assertEqual(inst.goal[0].target[0].measure.coding[0].system, "http://loinc.org") - self.assertEqual(inst.id, "protocol-example") - self.assertEqual(inst.identifier[0].system, "http://acme.org") - self.assertEqual(inst.identifier[0].value, "example-1") - self.assertEqual(inst.purpose, "Example of A medical algorithm for assessment and treatment of overweight and obesity") - self.assertEqual(inst.relatedArtifact[0].display, "Overweight and Obesity Treatment Guidelines") - self.assertEqual(inst.relatedArtifact[0].type, "derived-from") - self.assertEqual(inst.relatedArtifact[0].url, "http://www.nhlbi.nih.gov/health-pro/guidelines/current/obesity-guidelines/e_textbook/txgd/algorthm/algorthm.htm") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Obesity Assessment Protocol") - self.assertEqual(inst.type.coding[0].code, "protocol") - self.assertEqual(inst.useContext[0].code.code, "focus") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "414916001") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Obesity (disorder)") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") diff --git a/fhirclient/models/population.py b/fhirclient/models/population.py new file mode 100644 index 000000000..ea22d8067 --- /dev/null +++ b/fhirclient/models/population.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Population) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import backboneelement + +class Population(backboneelement.BackboneElement): + """ A definition of a set of people that apply to some clinically related + context, for example people contraindicated for a certain medication. + + A populatioof people with some set of grouping criteria. + """ + + resource_type = "Population" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.ageCodeableConcept = None + """ The age of the specific population. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.ageRange = None + """ The age of the specific population. + Type `Range` (represented as `dict` in JSON). """ + + self.gender = None + """ The gender of the specific population. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.physiologicalCondition = None + """ The existing physiological conditions of the specific population to + which this applies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.race = None + """ Race of the specific population. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(Population, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(Population, self).elementProperties() + js.extend([ + ("ageCodeableConcept", "ageCodeableConcept", codeableconcept.CodeableConcept, False, "age", False), + ("ageRange", "ageRange", range.Range, False, "age", False), + ("gender", "gender", codeableconcept.CodeableConcept, False, None, False), + ("physiologicalCondition", "physiologicalCondition", codeableconcept.CodeableConcept, False, None, False), + ("race", "race", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/practitioner.py b/fhirclient/models/practitioner.py index aeb3e2732..fc41aba3f 100644 --- a/fhirclient/models/practitioner.py +++ b/fhirclient/models/practitioner.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -39,7 +39,7 @@ def __init__(self, jsondict=None, strict=True): Type `FHIRDate` (represented as `str` in JSON). """ self.communication = None - """ A language the practitioner is able to use in patient communication. + """ A language the practitioner can use in patient communication. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.gender = None @@ -47,7 +47,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.identifier = None - """ A identifier for the person as this agent. + """ An identifier for the person as this agent. List of `Identifier` items (represented as `dict` in JSON). """ self.name = None @@ -59,7 +59,8 @@ def __init__(self, jsondict=None, strict=True): List of `Attachment` items (represented as `dict` in JSON). """ self.qualification = None - """ Qualifications obtained by training and certification. + """ Certification, licenses, or training pertaining to the provision of + care. List of `PractitionerQualification` items (represented as `dict` in JSON). """ self.telecom = None @@ -88,7 +89,12 @@ def elementProperties(self): from . import backboneelement class PractitionerQualification(backboneelement.BackboneElement): - """ Qualifications obtained by training and certification. + """ Certification, licenses, or training pertaining to the provision of care. + + The official certifications, training, and licenses that authorize or + otherwise pertain to the provision of care by the practitioner. For + example, a medical license issued by a medical board authorizing the + practitioner to practice medicine within a certian locality. """ resource_type = "PractitionerQualification" @@ -111,7 +117,7 @@ def __init__(self, jsondict=None, strict=True): self.issuer = None """ Organization that regulates and issues the qualification. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Period during which the qualification is valid. diff --git a/fhirclient/models/practitioner_tests.py b/fhirclient/models/practitioner_tests.py index 12aafd585..29b1c06f8 100644 --- a/fhirclient/models/practitioner_tests.py +++ b/fhirclient/models/practitioner_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return practitioner.Practitioner(js) def testPractitioner1(self): - inst = self.instantiate_from("practitioner-example-f001-evdb.json") + inst = self.instantiate_from("practitioner-example-f203-jvg.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner1(inst) @@ -32,38 +32,36 @@ def testPractitioner1(self): self.implPractitioner1(inst2) def implPractitioner1(self, inst): - self.assertEqual(inst.address[0].city, "Den Burg") + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "Den helder") self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") - self.assertEqual(inst.address[0].postalCode, "9105 PZ") + self.assertEqual(inst.address[0].line[0], "Walvisbaai 3") + self.assertEqual(inst.address[0].postalCode, "2333ZA") self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1975-12-07").date) - self.assertEqual(inst.birthDate.as_json(), "1975-12-07") + self.assertEqual(inst.birthDate.date, FHIRDate("1983-04-20").date) + self.assertEqual(inst.birthDate.as_json(), "1983-04-20") self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f001") + self.assertEqual(inst.id, "f203") self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") + self.assertEqual(inst.identifier[0].type.text, "UZI-nummer") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "938273695") - self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.identifier[1].value, "129IDH4OP733") - self.assertEqual(inst.name[0].family, "van den broek") - self.assertEqual(inst.name[0].given[0], "Eric") - self.assertEqual(inst.name[0].suffix[0], "MD") + self.assertEqual(inst.identifier[0].value, "12345678903") + self.assertEqual(inst.identifier[1].system, "https://www.bigregister.nl/") + self.assertEqual(inst.identifier[1].type.text, "BIG-nummer") + self.assertEqual(inst.identifier[1].use, "official") + self.assertEqual(inst.identifier[1].value, "12345678903") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].text, "Juri van Gelder") self.assertEqual(inst.name[0].use, "official") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "0205568263") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "E.M.vandenbroek@bmc.nl") - self.assertEqual(inst.telecom[2].system, "fax") - self.assertEqual(inst.telecom[2].use, "work") - self.assertEqual(inst.telecom[2].value, "0205664440") + self.assertEqual(inst.telecom[0].value, "+31715269111") self.assertEqual(inst.text.status, "generated") def testPractitioner2(self): - inst = self.instantiate_from("practitioner-example-f002-pv.json") + inst = self.instantiate_from("practitioner-example-f201-ab.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner2(inst) @@ -73,38 +71,39 @@ def testPractitioner2(self): self.implPractitioner2(inst2) def implPractitioner2(self, inst): - self.assertEqual(inst.address[0].city, "Den Burg") + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "Den helder") self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") - self.assertEqual(inst.address[0].postalCode, "9105 PZ") + self.assertEqual(inst.address[0].line[0], "Walvisbaai 3") + self.assertEqual(inst.address[0].line[1], "C4 - Automatisering") + self.assertEqual(inst.address[0].postalCode, "2333ZA") self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1979-04-29").date) - self.assertEqual(inst.birthDate.as_json(), "1979-04-29") + self.assertEqual(inst.birthDate.date, FHIRDate("1956-12-24").date) + self.assertEqual(inst.birthDate.as_json(), "1956-12-24") self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f002") + self.assertEqual(inst.id, "f201") self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") + self.assertEqual(inst.identifier[0].type.text, "UZI-nummer") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "730291637") - self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.identifier[1].value, "174BIP3JH438") - self.assertEqual(inst.name[0].family, "Voigt") - self.assertEqual(inst.name[0].given[0], "Pieter") - self.assertEqual(inst.name[0].suffix[0], "MD") + self.assertEqual(inst.identifier[0].value, "12345678901") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Bronsig") + self.assertEqual(inst.name[0].given[0], "Arend") + self.assertEqual(inst.name[0].prefix[0], "Dr.") + self.assertEqual(inst.name[0].text, "Dokter Bronsig") self.assertEqual(inst.name[0].use, "official") + self.assertEqual(inst.qualification[0].code.coding[0].code, "41672002") + self.assertEqual(inst.qualification[0].code.coding[0].display, "Pulmonologist") + self.assertEqual(inst.qualification[0].code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "0205569336") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "p.voigt@bmc.nl") - self.assertEqual(inst.telecom[2].system, "fax") - self.assertEqual(inst.telecom[2].use, "work") - self.assertEqual(inst.telecom[2].value, "0205669382") + self.assertEqual(inst.telecom[0].value, "+31715269111") self.assertEqual(inst.text.status, "generated") def testPractitioner3(self): - inst = self.instantiate_from("practitioner-example-f003-mv.json") + inst = self.instantiate_from("practitioner-example-f202-lm.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner3(inst) @@ -114,41 +113,40 @@ def testPractitioner3(self): self.implPractitioner3(inst2) def implPractitioner3(self, inst): - self.assertEqual(inst.address[0].city, "Amsterdam") + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "Den helder") self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") - self.assertEqual(inst.address[0].postalCode, "1105 AZ") + self.assertEqual(inst.address[0].line[0], "Walvisbaai 3") + self.assertEqual(inst.address[0].line[1], "C4 - Automatisering") + self.assertEqual(inst.address[0].postalCode, "2333ZA") self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1963-07-01").date) - self.assertEqual(inst.birthDate.as_json(), "1963-07-01") - self.assertEqual(inst.communication[0].coding[0].code, "nl") - self.assertEqual(inst.communication[0].coding[0].display, "Dutch") - self.assertEqual(inst.communication[0].coding[0].system, "urn:oid:2.16.840.1.113883.6.121") + self.assertEqual(inst.birthDate.date, FHIRDate("1960-06-12").date) + self.assertEqual(inst.birthDate.as_json(), "1960-06-12") self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f003") + self.assertEqual(inst.id, "f202") self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") + self.assertEqual(inst.identifier[0].type.text, "UZI-nummer") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "846100293") - self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.identifier[1].value, "243HID3RT938") - self.assertEqual(inst.name[0].family, "Versteegh") - self.assertEqual(inst.name[0].given[0], "Marc") - self.assertEqual(inst.name[0].suffix[0], "MD") + self.assertEqual(inst.identifier[0].value, "12345678902") + self.assertEqual(inst.identifier[1].system, "https://www.bigregister.nl/") + self.assertEqual(inst.identifier[1].type.text, "BIG-nummer") + self.assertEqual(inst.identifier[1].use, "official") + self.assertEqual(inst.identifier[1].value, "12345678902") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Maas") + self.assertEqual(inst.name[0].given[0], "Luigi") + self.assertEqual(inst.name[0].prefix[0], "Dr.") + self.assertEqual(inst.name[0].text, "Luigi Maas") self.assertEqual(inst.name[0].use, "official") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "0205562431") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "m.versteegh@bmc.nl") - self.assertEqual(inst.telecom[2].system, "fax") - self.assertEqual(inst.telecom[2].use, "work") - self.assertEqual(inst.telecom[2].value, "0205662948") + self.assertEqual(inst.telecom[0].value, "+31715269111") self.assertEqual(inst.text.status, "generated") def testPractitioner4(self): - inst = self.instantiate_from("practitioner-example-f004-rb.json") + inst = self.instantiate_from("practitioner-example-xcda-author.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner4(inst) @@ -158,42 +156,17 @@ def testPractitioner4(self): self.implPractitioner4(inst2) def implPractitioner4(self, inst): - self.assertEqual(inst.address[0].city, "Amsterdam") - self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") - self.assertEqual(inst.address[0].postalCode, "1105 AZ") - self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1980-02-04").date) - self.assertEqual(inst.birthDate.as_json(), "1980-02-04") - self.assertEqual(inst.communication[0].coding[0].code, "nl") - self.assertEqual(inst.communication[0].coding[0].display, "Netherlands") - self.assertEqual(inst.communication[0].coding[0].system, "urn:oid:2.16.840.1.113883.6.121") - self.assertEqual(inst.communication[0].text, "Language") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f004") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "118265112") - self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.identifier[1].value, "523ASA1LK927") - self.assertEqual(inst.name[0].family, "Briet") - self.assertEqual(inst.name[0].given[0], "Ronald") + self.assertEqual(inst.id, "xcda-author") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Hippocrates") + self.assertEqual(inst.name[0].given[0], "Harold") self.assertEqual(inst.name[0].suffix[0], "MD") - self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "0205569273") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "r.briet@bmc.nl") - self.assertEqual(inst.telecom[2].system, "fax") - self.assertEqual(inst.telecom[2].use, "work") - self.assertEqual(inst.telecom[2].value, "0205664440") self.assertEqual(inst.text.status, "generated") def testPractitioner5(self): - inst = self.instantiate_from("practitioner-example-f005-al.json") + inst = self.instantiate_from("practitioner-example-f003-mv.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner5(inst) @@ -205,40 +178,42 @@ def testPractitioner5(self): def implPractitioner5(self, inst): self.assertEqual(inst.address[0].city, "Amsterdam") self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Galapagosweg 9") + self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") self.assertEqual(inst.address[0].postalCode, "1105 AZ") self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1959-03-11").date) - self.assertEqual(inst.birthDate.as_json(), "1959-03-11") - self.assertEqual(inst.communication[0].coding[0].code, "fr") - self.assertEqual(inst.communication[0].coding[0].display, "France") - self.assertEqual(inst.communication[0].coding[0].system, "urn:oid:2.16.840.1.113883.6.121") - self.assertEqual(inst.gender, "female") - self.assertEqual(inst.id, "f005") + self.assertEqual(inst.birthDate.date, FHIRDate("1963-07-01").date) + self.assertEqual(inst.birthDate.as_json(), "1963-07-01") + self.assertEqual(inst.communication[0].coding[0].code, "nl") + self.assertEqual(inst.communication[0].coding[0].display, "Dutch") + self.assertEqual(inst.communication[0].coding[0].system, "urn:ietf:bcp:47") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "f003") self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "118265112") + self.assertEqual(inst.identifier[0].value, "846100293") self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.identifier[1].value, "191REW8WE916") - self.assertEqual(inst.name[0].family, "Anne") - self.assertEqual(inst.name[0].given[0], "Langeveld") + self.assertEqual(inst.identifier[1].value, "243HID3RT938") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Versteegh") + self.assertEqual(inst.name[0].given[0], "Marc") self.assertEqual(inst.name[0].suffix[0], "MD") self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.photo[0].contentType, "image/jpeg") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "0205563847") + self.assertEqual(inst.telecom[0].value, "0205562431") self.assertEqual(inst.telecom[1].system, "email") self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "a.langeveld@bmc.nl") + self.assertEqual(inst.telecom[1].value, "m.versteegh@bmc.nl") self.assertEqual(inst.telecom[2].system, "fax") self.assertEqual(inst.telecom[2].use, "work") - self.assertEqual(inst.telecom[2].value, "0205668916") + self.assertEqual(inst.telecom[2].value, "0205662948") self.assertEqual(inst.text.status, "generated") def testPractitioner6(self): - inst = self.instantiate_from("practitioner-example-f006-rvdb.json") + inst = self.instantiate_from("practitioner-example-f002-pv.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner6(inst) @@ -253,33 +228,36 @@ def implPractitioner6(self, inst): self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") self.assertEqual(inst.address[0].postalCode, "9105 PZ") self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1975-12-07").date) - self.assertEqual(inst.birthDate.as_json(), "1975-12-07") + self.assertEqual(inst.birthDate.date, FHIRDate("1979-04-29").date) + self.assertEqual(inst.birthDate.as_json(), "1979-04-29") self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f006") + self.assertEqual(inst.id, "f002") self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "937223645") + self.assertEqual(inst.identifier[0].value, "730291637") self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") self.assertEqual(inst.identifier[1].use, "usual") - self.assertEqual(inst.identifier[1].value, "134IDY41W988") - self.assertEqual(inst.name[0].family, "van den Berk") - self.assertEqual(inst.name[0].given[0], "Rob") + self.assertEqual(inst.identifier[1].value, "174BIP3JH438") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Voigt") + self.assertEqual(inst.name[0].given[0], "Pieter") self.assertEqual(inst.name[0].suffix[0], "MD") self.assertEqual(inst.name[0].use, "official") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "0205569288") + self.assertEqual(inst.telecom[0].value, "0205569336") self.assertEqual(inst.telecom[1].system, "email") self.assertEqual(inst.telecom[1].use, "work") - self.assertEqual(inst.telecom[1].value, "R.A.vandenberk@bmc.nl") + self.assertEqual(inst.telecom[1].value, "p.voigt@bmc.nl") self.assertEqual(inst.telecom[2].system, "fax") self.assertEqual(inst.telecom[2].use, "work") - self.assertEqual(inst.telecom[2].value, "0205664987") + self.assertEqual(inst.telecom[2].value, "0205669382") self.assertEqual(inst.text.status, "generated") def testPractitioner7(self): - inst = self.instantiate_from("practitioner-example-f007-sh.json") + inst = self.instantiate_from("practitioner-example.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner7(inst) @@ -289,6 +267,42 @@ def testPractitioner7(self): self.implPractitioner7(inst2) def implPractitioner7(self, inst): + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].city, "PleasantVille") + self.assertEqual(inst.address[0].line[0], "534 Erewhon St") + self.assertEqual(inst.address[0].postalCode, "3999") + self.assertEqual(inst.address[0].state, "Vic") + self.assertEqual(inst.address[0].use, "home") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].system, "http://www.acme.org/practitioners") + self.assertEqual(inst.identifier[0].value, "23") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Careful") + self.assertEqual(inst.name[0].given[0], "Adam") + self.assertEqual(inst.name[0].prefix[0], "Dr") + self.assertEqual(inst.qualification[0].code.coding[0].code, "BS") + self.assertEqual(inst.qualification[0].code.coding[0].display, "Bachelor of Science") + self.assertEqual(inst.qualification[0].code.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0360/2.7") + self.assertEqual(inst.qualification[0].code.text, "Bachelor of Science") + self.assertEqual(inst.qualification[0].identifier[0].system, "http://example.org/UniversityIdentifier") + self.assertEqual(inst.qualification[0].identifier[0].value, "12345") + self.assertEqual(inst.qualification[0].period.start.date, FHIRDate("1995").date) + self.assertEqual(inst.qualification[0].period.start.as_json(), "1995") + self.assertEqual(inst.text.status, "generated") + + def testPractitioner8(self): + inst = self.instantiate_from("practitioner-example-f007-sh.json") + self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") + self.implPractitioner8(inst) + + js = inst.as_json() + self.assertEqual("Practitioner", js["resourceType"]) + inst2 = practitioner.Practitioner(js) + self.implPractitioner8(inst2) + + def implPractitioner8(self, inst): self.assertEqual(inst.address[0].city, "Den Burg") self.assertEqual(inst.address[0].country, "NLD") self.assertEqual(inst.address[0].line[0], "Galapagosweg 91") @@ -304,6 +318,9 @@ def implPractitioner7(self, inst): self.assertEqual(inst.identifier[1].system, "urn:oid:2.16.840.1.113883.2.4.6.3") self.assertEqual(inst.identifier[1].use, "usual") self.assertEqual(inst.identifier[1].value, "567IUI51C154") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name[0].family, "Heps") self.assertEqual(inst.name[0].given[0], "Simone") self.assertEqual(inst.name[0].suffix[0], "MD") @@ -319,47 +336,8 @@ def implPractitioner7(self, inst): self.assertEqual(inst.telecom[2].value, "0205669283") self.assertEqual(inst.text.status, "generated") - def testPractitioner8(self): - inst = self.instantiate_from("practitioner-example-f201-ab.json") - self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") - self.implPractitioner8(inst) - - js = inst.as_json() - self.assertEqual("Practitioner", js["resourceType"]) - inst2 = practitioner.Practitioner(js) - self.implPractitioner8(inst2) - - def implPractitioner8(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].city, "Den helder") - self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Walvisbaai 3") - self.assertEqual(inst.address[0].line[1], "C4 - Automatisering") - self.assertEqual(inst.address[0].postalCode, "2333ZA") - self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1956-12-24").date) - self.assertEqual(inst.birthDate.as_json(), "1956-12-24") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f201") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") - self.assertEqual(inst.identifier[0].type.text, "UZI-nummer") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "12345678901") - self.assertEqual(inst.name[0].family, "Bronsig") - self.assertEqual(inst.name[0].given[0], "Arend") - self.assertEqual(inst.name[0].prefix[0], "Dr.") - self.assertEqual(inst.name[0].text, "Dokter Bronsig") - self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.qualification[0].code.coding[0].code, "41672002") - self.assertEqual(inst.qualification[0].code.coding[0].display, "Pulmonologist") - self.assertEqual(inst.qualification[0].code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "+31715269111") - self.assertEqual(inst.text.status, "generated") - def testPractitioner9(self): - inst = self.instantiate_from("practitioner-example-f202-lm.json") + inst = self.instantiate_from("practitioner-example-f204-ce.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner9(inst) @@ -369,37 +347,31 @@ def testPractitioner9(self): self.implPractitioner9(inst2) def implPractitioner9(self, inst): - self.assertTrue(inst.active) self.assertEqual(inst.address[0].city, "Den helder") self.assertEqual(inst.address[0].country, "NLD") self.assertEqual(inst.address[0].line[0], "Walvisbaai 3") - self.assertEqual(inst.address[0].line[1], "C4 - Automatisering") self.assertEqual(inst.address[0].postalCode, "2333ZA") self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1960-06-12").date) - self.assertEqual(inst.birthDate.as_json(), "1960-06-12") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f202") + self.assertEqual(inst.birthDate.date, FHIRDate("1967-11-05").date) + self.assertEqual(inst.birthDate.as_json(), "1967-11-05") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "f204") self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") self.assertEqual(inst.identifier[0].type.text, "UZI-nummer") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "12345678902") - self.assertEqual(inst.identifier[1].system, "https://www.bigregister.nl/") - self.assertEqual(inst.identifier[1].type.text, "BIG-nummer") - self.assertEqual(inst.identifier[1].use, "official") - self.assertEqual(inst.identifier[1].value, "12345678902") - self.assertEqual(inst.name[0].family, "Maas") - self.assertEqual(inst.name[0].given[0], "Luigi") - self.assertEqual(inst.name[0].prefix[0], "Dr.") - self.assertEqual(inst.name[0].text, "Luigi Maas") - self.assertEqual(inst.name[0].use, "official") + self.assertEqual(inst.identifier[0].value, "12345678904") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].text, "Carla Espinosa") + self.assertEqual(inst.name[0].use, "usual") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "+31715269111") + self.assertEqual(inst.telecom[0].value, "+31715262169") self.assertEqual(inst.text.status, "generated") def testPractitioner10(self): - inst = self.instantiate_from("practitioner-example-f203-jvg.json") + inst = self.instantiate_from("practitioner-example-xcda1.json") self.assertIsNotNone(inst, "Must have instantiated a Practitioner instance") self.implPractitioner10(inst) @@ -409,28 +381,16 @@ def testPractitioner10(self): self.implPractitioner10(inst2) def implPractitioner10(self, inst): - self.assertTrue(inst.active) - self.assertEqual(inst.address[0].city, "Den helder") - self.assertEqual(inst.address[0].country, "NLD") - self.assertEqual(inst.address[0].line[0], "Walvisbaai 3") - self.assertEqual(inst.address[0].postalCode, "2333ZA") - self.assertEqual(inst.address[0].use, "work") - self.assertEqual(inst.birthDate.date, FHIRDate("1983-04-20").date) - self.assertEqual(inst.birthDate.as_json(), "1983-04-20") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "f203") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.528.1.1007.3.1") - self.assertEqual(inst.identifier[0].type.text, "UZI-nummer") + self.assertEqual(inst.id, "xcda1") + self.assertEqual(inst.identifier[0].system, "http://healthcare.example.org/identifiers/staff") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "12345678903") - self.assertEqual(inst.identifier[1].system, "https://www.bigregister.nl/") - self.assertEqual(inst.identifier[1].type.text, "BIG-nummer") - self.assertEqual(inst.identifier[1].use, "official") - self.assertEqual(inst.identifier[1].value, "12345678903") - self.assertEqual(inst.name[0].text, "Juri van Gelder") - self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "+31715269111") + self.assertEqual(inst.identifier[0].value, "D234123") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Dopplemeyer") + self.assertEqual(inst.name[0].given[0], "Sherry") + self.assertEqual(inst.telecom[0].system, "email") + self.assertEqual(inst.telecom[0].value, "john.doe@healthcare.example.org") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/practitionerrole.py b/fhirclient/models/practitionerrole.py index c8102d890..1ecca2e3a 100644 --- a/fhirclient/models/practitionerrole.py +++ b/fhirclient/models/practitionerrole.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/PractitionerRole) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/PractitionerRole) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -25,7 +25,7 @@ def __init__(self, jsondict=None, strict=True): """ self.active = None - """ Whether this practitioner's record is in active use. + """ Whether this practitioner role record is in active use. Type `bool`. """ self.availabilityExceptions = None @@ -43,12 +43,12 @@ def __init__(self, jsondict=None, strict=True): self.endpoint = None """ Technical endpoints providing access to services operated for the practitioner with this role. - List of `FHIRReference` items referencing `Endpoint` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.healthcareService = None """ The list of healthcare services that this worker provides for this role's Organization/Location(s). - List of `FHIRReference` items referencing `HealthcareService` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.identifier = None """ Business Identifiers that are specific to a role/location. @@ -56,7 +56,7 @@ def __init__(self, jsondict=None, strict=True): self.location = None """ The location(s) at which this practitioner provides care. - List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.notAvailable = None """ Not available during this time due to provided reason. @@ -64,7 +64,7 @@ def __init__(self, jsondict=None, strict=True): self.organization = None """ Organization where the roles are available. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ The period during which the practitioner is authorized to perform @@ -73,8 +73,8 @@ def __init__(self, jsondict=None, strict=True): self.practitioner = None """ Practitioner that is able to provide the defined services for the - organation. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + organization. + Type `FHIRReference` (represented as `dict` in JSON). """ self.specialty = None """ Specific specialty of the practitioner. @@ -112,7 +112,8 @@ def elementProperties(self): class PractitionerRoleAvailableTime(backboneelement.BackboneElement): """ Times the Service Site is available. - A collection of times that 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 = "PractitionerRoleAvailableTime" @@ -157,8 +158,8 @@ def elementProperties(self): class PractitionerRoleNotAvailable(backboneelement.BackboneElement): """ Not available during this time due to provided reason. - The HealthcareService is not available during this period of time due to - the provided reason. + The practitioner is not available or performing this role during this + period of time due to the provided reason. """ resource_type = "PractitionerRoleNotAvailable" @@ -176,7 +177,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.during = None - """ Service not availablefrom this date. + """ Service not available from this date. Type `Period` (represented as `dict` in JSON). """ super(PractitionerRoleNotAvailable, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/practitionerrole_tests.py b/fhirclient/models/practitionerrole_tests.py index 00acd9843..5a8d81427 100644 --- a/fhirclient/models/practitionerrole_tests.py +++ b/fhirclient/models/practitionerrole_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -48,10 +48,13 @@ def implPractitionerRole1(self, inst): self.assertEqual(inst.availableTime[1].daysOfWeek[0], "thu") self.assertEqual(inst.availableTime[1].daysOfWeek[1], "fri") self.assertEqual(inst.code[0].coding[0].code, "RP") - self.assertEqual(inst.code[0].coding[0].system, "http://hl7.org/fhir/v2/0286") + self.assertEqual(inst.code[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0286") self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http://www.acme.org/practitioners") self.assertEqual(inst.identifier[0].value, "23") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.notAvailable[0].description, "Adam will be on extended leave during May 2017") self.assertEqual(inst.notAvailable[0].during.end.date, FHIRDate("2017-05-20").date) self.assertEqual(inst.notAvailable[0].during.end.as_json(), "2017-05-20") diff --git a/fhirclient/models/procedure.py b/fhirclient/models/procedure.py index d6be5c673..2a865916c 100644 --- a/fhirclient/models/procedure.py +++ b/fhirclient/models/procedure.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Procedure) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,9 +10,9 @@ class Procedure(domainresource.DomainResource): """ An action that is being or was performed on a patient. - An action that is or was performed on a patient. This can be a physical - intervention like an operation, or less invasive like counseling or - hypnotherapy. + An action that is or was performed on or for a patient. This can be a + physical intervention like an operation, or less invasive like long term + services, counseling, or hypnotherapy. """ resource_type = "Procedure" @@ -25,9 +25,13 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.asserter = None + """ Person who asserts this procedure. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.basedOn = None """ A request for this procedure. - List of `FHIRReference` items referencing `CarePlan, ProcedureRequest, ReferralRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.bodySite = None """ Target body sites. @@ -46,19 +50,15 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.complicationDetail = None - """ A condition that is a result of the procedure. - List of `FHIRReference` items referencing `Condition` (represented as `dict` in JSON). """ - - self.context = None - """ Encounter or episode associated with the procedure. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + """ A condition that is a result of the procedure. + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.definition = None - """ Instantiates protocol or definition. - List of `FHIRReference` items referencing `PlanDefinition, ActivityDefinition, HealthcareService` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.focalDevice = None - """ Device changed in procedure. + """ Manipulated, implanted, or removed device. List of `ProcedureFocalDevice` items (represented as `dict` in JSON). """ self.followUp = None @@ -69,17 +69,17 @@ def __init__(self, jsondict=None, strict=True): """ External Identifiers for this procedure. List of `Identifier` items (represented as `dict` in JSON). """ - self.location = None - """ Where the procedure happened. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ - self.notDone = None - """ True if procedure was not performed as scheduled. - Type `bool`. """ + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ - self.notDoneReason = None - """ Reason procedure was not performed. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.location = None + """ Where the procedure happened. + Type `FHIRReference` (represented as `dict` in JSON). """ self.note = None """ Additional information about the procedure. @@ -91,16 +91,28 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Part of referenced event. - List of `FHIRReference` items referencing `Procedure, Observation, MedicationAdministration` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.performedAge = None + """ When the procedure was performed. + Type `Age` (represented as `dict` in JSON). """ self.performedDateTime = None - """ Date/Period the procedure was performed. + """ When the procedure was performed. Type `FHIRDate` (represented as `str` in JSON). """ self.performedPeriod = None - """ Date/Period the procedure was performed. + """ When the procedure was performed. Type `Period` (represented as `dict` in JSON). """ + self.performedRange = None + """ When the procedure was performed. + Type `Range` (represented as `dict` in JSON). """ + + self.performedString = None + """ When the procedure was performed. + Type `str`. """ + self.performer = None """ The people who performed the procedure. List of `ProcedurePerformer` items (represented as `dict` in JSON). """ @@ -110,21 +122,29 @@ def __init__(self, jsondict=None, strict=True): List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None - """ Condition that is the reason the procedure performed. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + """ The justification that the procedure was performed. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.recorder = None + """ Who recorded the procedure. + Type `FHIRReference` (represented as `dict` in JSON). """ self.report = None """ Any report resulting from the procedure. - List of `FHIRReference` items referencing `DiagnosticReport` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None - """ preparation | in-progress | suspended | aborted | completed | - entered-in-error | unknown. + """ preparation | in-progress | not-done | suspended | aborted | + completed | entered-in-error | unknown. Type `str`. """ + self.statusReason = None + """ Reason for current status. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.subject = None """ Who the procedure was performed on. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.usedCode = None """ Coded items used during the procedure. @@ -132,37 +152,42 @@ def __init__(self, jsondict=None, strict=True): self.usedReference = None """ Items used during procedure. - List of `FHIRReference` items referencing `Device, Medication, Substance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(Procedure, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Procedure, self).elementProperties() js.extend([ + ("asserter", "asserter", fhirreference.FHIRReference, False, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), ("category", "category", codeableconcept.CodeableConcept, False, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("complication", "complication", codeableconcept.CodeableConcept, True, None, False), ("complicationDetail", "complicationDetail", fhirreference.FHIRReference, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("focalDevice", "focalDevice", ProcedureFocalDevice, True, None, False), ("followUp", "followUp", codeableconcept.CodeableConcept, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), ("location", "location", fhirreference.FHIRReference, False, None, False), - ("notDone", "notDone", bool, False, None, False), - ("notDoneReason", "notDoneReason", codeableconcept.CodeableConcept, False, None, False), ("note", "note", annotation.Annotation, True, None, False), ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("performedAge", "performedAge", age.Age, False, "performed", False), ("performedDateTime", "performedDateTime", fhirdate.FHIRDate, False, "performed", False), ("performedPeriod", "performedPeriod", period.Period, False, "performed", False), + ("performedRange", "performedRange", range.Range, False, "performed", False), + ("performedString", "performedString", str, False, "performed", False), ("performer", "performer", ProcedurePerformer, True, None, False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("recorder", "recorder", fhirreference.FHIRReference, False, None, False), ("report", "report", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, True), + ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), ("subject", "subject", fhirreference.FHIRReference, False, None, True), ("usedCode", "usedCode", codeableconcept.CodeableConcept, True, None, False), ("usedReference", "usedReference", fhirreference.FHIRReference, True, None, False), @@ -173,7 +198,7 @@ def elementProperties(self): from . import backboneelement class ProcedureFocalDevice(backboneelement.BackboneElement): - """ Device changed in procedure. + """ Manipulated, implanted, or removed device. A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as @@ -196,7 +221,7 @@ def __init__(self, jsondict=None, strict=True): self.manipulated = None """ Device that was changed. - Type `FHIRReference` referencing `Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ProcedureFocalDevice, self).__init__(jsondict=jsondict, strict=strict) @@ -212,7 +237,7 @@ def elementProperties(self): class ProcedurePerformer(backboneelement.BackboneElement): """ The people who performed the procedure. - Limited to 'real' people rather than equipment. + Limited to "real" people rather than equipment. """ resource_type = "ProcedurePerformer" @@ -227,15 +252,15 @@ def __init__(self, jsondict=None, strict=True): self.actor = None """ The reference to the practitioner. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.function = None + """ Type of performance. + Type `CodeableConcept` (represented as `dict` in JSON). """ self.onBehalfOf = None """ Organization the device or practitioner was acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.role = None - """ The role the actor was in. - Type `CodeableConcept` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ProcedurePerformer, self).__init__(jsondict=jsondict, strict=strict) @@ -243,13 +268,17 @@ def elementProperties(self): js = super(ProcedurePerformer, self).elementProperties() js.extend([ ("actor", "actor", fhirreference.FHIRReference, False, None, True), + ("function", "function", codeableconcept.CodeableConcept, False, None, False), ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), - ("role", "role", codeableconcept.CodeableConcept, False, None, False), ]) return js import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] try: from . import annotation except ImportError: @@ -274,3 +303,7 @@ def elementProperties(self): from . import period except ImportError: period = sys.modules[__package__ + '.period'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/procedure_tests.py b/fhirclient/models/procedure_tests.py index 93e1ed5e4..ce9b927f4 100644 --- a/fhirclient/models/procedure_tests.py +++ b/fhirclient/models/procedure_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return procedure.Procedure(js) def testProcedure1(self): - inst = self.instantiate_from("procedure-example-ambulation.json") + inst = self.instantiate_from("procedure-example-f201-tpf.json") self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") self.implProcedure1(inst) @@ -32,23 +32,31 @@ def testProcedure1(self): self.implProcedure1(inst2) def implProcedure1(self, inst): - self.assertEqual(inst.code.coding[0].code, "62013009") - self.assertEqual(inst.code.coding[0].display, "Ambulating patient (procedure)") + self.assertEqual(inst.bodySite[0].coding[0].code, "272676008") + self.assertEqual(inst.bodySite[0].coding[0].display, "Sphenoid bone") + self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.coding[0].code, "367336001") + self.assertEqual(inst.code.coding[0].display, "Chemotherapy") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Ambulation") - self.assertEqual(inst.id, "ambulation") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertTrue(inst.notDone) - self.assertEqual(inst.notDoneReason.coding[0].code, "398254007") - self.assertEqual(inst.notDoneReason.coding[0].display, " Pre-eclampsia (disorder)") - self.assertEqual(inst.notDoneReason.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.notDoneReason.text, "Pre-eclampsia") - self.assertEqual(inst.status, "suspended") - self.assertEqual(inst.text.div, "
Ambulation procedure was not done
") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.instantiatesCanonical[0], "PlanDefinition/KDN5") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "Eerste neo-adjuvante TPF-kuur bij groot proces in sphenoid met intracraniale uitbreiding.") + self.assertEqual(inst.performedPeriod.end.date, FHIRDate("2013-01-28T14:27:00+01:00").date) + self.assertEqual(inst.performedPeriod.end.as_json(), "2013-01-28T14:27:00+01:00") + self.assertEqual(inst.performedPeriod.start.date, FHIRDate("2013-01-28T13:31:00+01:00").date) + self.assertEqual(inst.performedPeriod.start.as_json(), "2013-01-28T13:31:00+01:00") + self.assertEqual(inst.performer[0].function.coding[0].code, "310512001") + self.assertEqual(inst.performer[0].function.coding[0].display, "Medical oncologist") + self.assertEqual(inst.performer[0].function.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reasonCode[0].text, "DiagnosticReport/f201") + self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") def testProcedure2(self): - inst = self.instantiate_from("procedure-example-appendectomy-narrative.json") + inst = self.instantiate_from("procedure-example-ambulation.json") self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") self.implProcedure2(inst) @@ -58,13 +66,26 @@ def testProcedure2(self): self.implProcedure2(inst2) def implProcedure2(self, inst): - self.assertEqual(inst.id, "appendectomy-narrative") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.div, "
Routine Appendectomy in April 2013 performed by Dr Cecil Surgeon
") - self.assertEqual(inst.text.status, "additional") + self.assertEqual(inst.code.coding[0].code, "62013009") + self.assertEqual(inst.code.coding[0].display, "Ambulating patient (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Ambulation") + self.assertEqual(inst.id, "ambulation") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.instantiatesUri[0], "http://example.org/protocol-for-hypertension-during-pregnancy") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "not-done") + self.assertEqual(inst.statusReason.coding[0].code, "398254007") + self.assertEqual(inst.statusReason.coding[0].display, " Pre-eclampsia (disorder)") + self.assertEqual(inst.statusReason.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.statusReason.text, "Pre-eclampsia") + self.assertEqual(inst.text.div, "
Ambulation procedure was not done
") + self.assertEqual(inst.text.status, "generated") def testProcedure3(self): - inst = self.instantiate_from("procedure-example-biopsy.json") + inst = self.instantiate_from("procedure-example-implant.json") self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") self.implProcedure3(inst) @@ -74,35 +95,23 @@ def testProcedure3(self): self.implProcedure3(inst2) def implProcedure3(self, inst): - self.assertEqual(inst.bodySite[0].coding[0].code, "368225008") - self.assertEqual(inst.bodySite[0].coding[0].display, "Entire Left Forearm") - self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.bodySite[0].text, "Left forearm") - self.assertEqual(inst.category.coding[0].code, "103693007") - self.assertEqual(inst.category.coding[0].display, "Diagnostic procedure (procedure)") - self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category.text, "Diagnostic procedure") - self.assertEqual(inst.code.coding[0].code, "90105005") - self.assertEqual(inst.code.coding[0].display, "Biopsy of soft tissue of forearm (Procedure)") + self.assertEqual(inst.code.coding[0].code, "25267002") + self.assertEqual(inst.code.coding[0].display, "Insertion of intracardiac pacemaker (procedure)") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Biopsy of suspected melanoma L) arm") - self.assertEqual(inst.complication[0].coding[0].code, "67750007") - self.assertEqual(inst.complication[0].coding[0].display, "Ineffective airway clearance (finding)") - self.assertEqual(inst.complication[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.complication[0].text, "Ineffective airway clearance") - self.assertEqual(inst.followUp[0].text, "Review in clinic") - self.assertEqual(inst.id, "biopsy") - self.assertEqual(inst.note[0].text, "Standard Biopsy") - self.assertEqual(inst.performedDateTime.date, FHIRDate("2014-02-03").date) - self.assertEqual(inst.performedDateTime.as_json(), "2014-02-03") - self.assertEqual(inst.reasonCode[0].text, "Dark lesion l) forearm. getting darker last 3 months.") + self.assertEqual(inst.code.text, "Implant Pacemaker") + self.assertEqual(inst.focalDevice[0].action.coding[0].code, "implanted") + self.assertEqual(inst.focalDevice[0].action.coding[0].system, "http://hl7.org/fhir/device-action") + self.assertEqual(inst.followUp[0].text, "ROS 5 days - 2013-04-10") + self.assertEqual(inst.id, "example-implant") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "Routine Appendectomy. Appendix was inflamed and in retro-caecal position") + self.assertEqual(inst.performedDateTime.date, FHIRDate("2015-04-05").date) + self.assertEqual(inst.performedDateTime.as_json(), "2015-04-05") + self.assertEqual(inst.reasonCode[0].text, "Bradycardia") self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.div, "
Biopsy of suspected melanoma L) arm
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.usedCode[0].coding[0].code, "79068005") - self.assertEqual(inst.usedCode[0].coding[0].display, "Needle, device (physical object)") - self.assertEqual(inst.usedCode[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.usedCode[0].text, "30-guage needle") def testProcedure4(self): inst = self.instantiate_from("procedure-example-colon-biopsy.json") @@ -121,13 +130,15 @@ def implProcedure4(self, inst): self.assertEqual(inst.code.text, "Biopsy of colon") self.assertEqual(inst.id, "colon-biopsy") self.assertEqual(inst.identifier[0].value, "12345") - self.assertFalse(inst.notDone) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.div, "
Biopsy of colon, which was part of colonoscopy
") self.assertEqual(inst.text.status, "generated") def testProcedure5(self): - inst = self.instantiate_from("procedure-example-colonoscopy.json") + inst = self.instantiate_from("procedure-example-f004-tracheotomy.json") self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") self.implProcedure5(inst) @@ -137,15 +148,28 @@ def testProcedure5(self): self.implProcedure5(inst2) def implProcedure5(self, inst): - self.assertEqual(inst.code.coding[0].code, "73761001") - self.assertEqual(inst.code.coding[0].display, "Colonoscopy (procedure)") + self.assertEqual(inst.bodySite[0].coding[0].code, "83030008") + self.assertEqual(inst.bodySite[0].coding[0].display, "Retropharyngeal area") + self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.coding[0].code, "48387007") + self.assertEqual(inst.code.coding[0].display, "Tracheotomy") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Colonoscopy") - self.assertEqual(inst.id, "colonoscopy") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertFalse(inst.notDone) + self.assertEqual(inst.followUp[0].text, "described in care plan") + self.assertEqual(inst.id, "f004") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.outcome.text, "removal of the retropharyngeal abscess") + self.assertEqual(inst.performedPeriod.end.date, FHIRDate("2013-03-22T10:30:10+01:00").date) + self.assertEqual(inst.performedPeriod.end.as_json(), "2013-03-22T10:30:10+01:00") + self.assertEqual(inst.performedPeriod.start.date, FHIRDate("2013-03-22T09:30:10+01:00").date) + self.assertEqual(inst.performedPeriod.start.as_json(), "2013-03-22T09:30:10+01:00") + self.assertEqual(inst.performer[0].function.coding[0].code, "01.000") + self.assertEqual(inst.performer[0].function.coding[0].display, "Arts") + self.assertEqual(inst.performer[0].function.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.performer[0].function.text, "Care role") + self.assertEqual(inst.reasonCode[0].text, "ensure breathing during surgery") self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.div, "
Colonoscopy with complication
") self.assertEqual(inst.text.status, "generated") def testProcedure6(self): @@ -168,6 +192,9 @@ def implProcedure6(self, inst): self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.code.text, "Health education - breast examination") self.assertEqual(inst.id, "education") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.performedDateTime.date, FHIRDate("2014-08-16").date) self.assertEqual(inst.performedDateTime.as_json(), "2014-08-16") self.assertEqual(inst.reasonCode[0].text, "early detection of breast mass") @@ -176,7 +203,7 @@ def implProcedure6(self, inst): self.assertEqual(inst.text.status, "generated") def testProcedure7(self): - inst = self.instantiate_from("procedure-example-f001-heart.json") + inst = self.instantiate_from("procedure-example-colonoscopy.json") self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") self.implProcedure7(inst) @@ -186,29 +213,21 @@ def testProcedure7(self): self.implProcedure7(inst2) def implProcedure7(self, inst): - self.assertEqual(inst.bodySite[0].coding[0].code, "17401000") - self.assertEqual(inst.bodySite[0].coding[0].display, "Heart valve structure") - self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.coding[0].code, "34068001") - self.assertEqual(inst.code.coding[0].display, "Heart valve replacement") + self.assertEqual(inst.code.coding[0].code, "73761001") + self.assertEqual(inst.code.coding[0].display, "Colonoscopy (procedure)") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.followUp[0].text, "described in care plan") - self.assertEqual(inst.id, "f001") - self.assertEqual(inst.outcome.text, "improved blood circulation") - self.assertEqual(inst.performedPeriod.end.date, FHIRDate("2011-06-27").date) - self.assertEqual(inst.performedPeriod.end.as_json(), "2011-06-27") - self.assertEqual(inst.performedPeriod.start.date, FHIRDate("2011-06-26").date) - self.assertEqual(inst.performedPeriod.start.as_json(), "2011-06-26") - self.assertEqual(inst.performer[0].role.coding[0].code, "01.000") - self.assertEqual(inst.performer[0].role.coding[0].display, "Arts") - self.assertEqual(inst.performer[0].role.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") - self.assertEqual(inst.performer[0].role.text, "Care role") - self.assertEqual(inst.reasonCode[0].text, "Heart valve disorder") + self.assertEqual(inst.code.text, "Colonoscopy") + self.assertEqual(inst.id, "colonoscopy") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Colonoscopy with complication
") self.assertEqual(inst.text.status, "generated") def testProcedure8(self): - inst = self.instantiate_from("procedure-example-f002-lung.json") + inst = self.instantiate_from("procedure-example-physical-therapy.json") self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") self.implProcedure8(inst) @@ -218,25 +237,27 @@ def testProcedure8(self): self.implProcedure8(inst2) def implProcedure8(self, inst): - self.assertEqual(inst.bodySite[0].coding[0].code, "39607008") - self.assertEqual(inst.bodySite[0].coding[0].display, "Lung structure") + self.assertEqual(inst.bodySite[0].coding[0].code, "36701003") + self.assertEqual(inst.bodySite[0].coding[0].display, "Both knees (body structure)") self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.coding[0].code, "359615001") - self.assertEqual(inst.code.coding[0].display, "Partial lobectomy of lung") + self.assertEqual(inst.bodySite[0].text, "Both knees") + self.assertEqual(inst.category.coding[0].code, "386053000") + self.assertEqual(inst.category.coding[0].display, "Evaluation procedure (procedure)") + self.assertEqual(inst.category.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category.text, "Evaluation") + self.assertEqual(inst.code.coding[0].code, "710830005") + self.assertEqual(inst.code.coding[0].display, "Assessment of passive range of motion (procedure)") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.followUp[0].text, "described in care plan") - self.assertEqual(inst.id, "f002") - self.assertEqual(inst.outcome.text, "improved blood circulation") - self.assertEqual(inst.performedPeriod.end.date, FHIRDate("2013-03-08T09:30:10+01:00").date) - self.assertEqual(inst.performedPeriod.end.as_json(), "2013-03-08T09:30:10+01:00") - self.assertEqual(inst.performedPeriod.start.date, FHIRDate("2013-03-08T09:00:10+01:00").date) - self.assertEqual(inst.performedPeriod.start.as_json(), "2013-03-08T09:00:10+01:00") - self.assertEqual(inst.performer[0].role.coding[0].code, "01.000") - self.assertEqual(inst.performer[0].role.coding[0].display, "Arts") - self.assertEqual(inst.performer[0].role.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") - self.assertEqual(inst.performer[0].role.text, "Care role") - self.assertEqual(inst.reasonCode[0].text, "Malignant tumor of lung") + self.assertEqual(inst.code.text, "Assessment of passive range of motion") + self.assertEqual(inst.id, "physical-therapy") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.performedDateTime.date, FHIRDate("2016-09-27").date) + self.assertEqual(inst.performedDateTime.as_json(), "2016-09-27") + self.assertEqual(inst.reasonCode[0].text, "assessment of mobility limitations due to osteoarthritis") self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Assessment of passive range of motion for both knees on Sept 27, 2016 due to osteoarthritis
") self.assertEqual(inst.text.status, "generated") def testProcedure9(self): @@ -258,21 +279,24 @@ def implProcedure9(self, inst): self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.followUp[0].text, "described in care plan") self.assertEqual(inst.id, "f003") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.outcome.text, "removal of the retropharyngeal abscess") self.assertEqual(inst.performedPeriod.end.date, FHIRDate("2013-03-24T10:30:10+01:00").date) self.assertEqual(inst.performedPeriod.end.as_json(), "2013-03-24T10:30:10+01:00") self.assertEqual(inst.performedPeriod.start.date, FHIRDate("2013-03-24T09:30:10+01:00").date) self.assertEqual(inst.performedPeriod.start.as_json(), "2013-03-24T09:30:10+01:00") - self.assertEqual(inst.performer[0].role.coding[0].code, "01.000") - self.assertEqual(inst.performer[0].role.coding[0].display, "Arts") - self.assertEqual(inst.performer[0].role.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") - self.assertEqual(inst.performer[0].role.text, "Care role") + self.assertEqual(inst.performer[0].function.coding[0].code, "01.000") + self.assertEqual(inst.performer[0].function.coding[0].display, "Arts") + self.assertEqual(inst.performer[0].function.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") + self.assertEqual(inst.performer[0].function.text, "Care role") self.assertEqual(inst.reasonCode[0].text, "abcess in retropharyngeal area") self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") def testProcedure10(self): - inst = self.instantiate_from("procedure-example-f004-tracheotomy.json") + inst = self.instantiate_from("procedure-example.json") self.assertIsNotNone(inst, "Must have instantiated a Procedure instance") self.implProcedure10(inst) @@ -282,24 +306,20 @@ def testProcedure10(self): self.implProcedure10(inst2) def implProcedure10(self, inst): - self.assertEqual(inst.bodySite[0].coding[0].code, "83030008") - self.assertEqual(inst.bodySite[0].coding[0].display, "Retropharyngeal area") - self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.coding[0].code, "48387007") - self.assertEqual(inst.code.coding[0].display, "Tracheotomy") + self.assertEqual(inst.code.coding[0].code, "80146002") + self.assertEqual(inst.code.coding[0].display, "Appendectomy (Procedure)") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.followUp[0].text, "described in care plan") - self.assertEqual(inst.id, "f004") - self.assertEqual(inst.outcome.text, "removal of the retropharyngeal abscess") - self.assertEqual(inst.performedPeriod.end.date, FHIRDate("2013-03-22T10:30:10+01:00").date) - self.assertEqual(inst.performedPeriod.end.as_json(), "2013-03-22T10:30:10+01:00") - self.assertEqual(inst.performedPeriod.start.date, FHIRDate("2013-03-22T09:30:10+01:00").date) - self.assertEqual(inst.performedPeriod.start.as_json(), "2013-03-22T09:30:10+01:00") - self.assertEqual(inst.performer[0].role.coding[0].code, "01.000") - self.assertEqual(inst.performer[0].role.coding[0].display, "Arts") - self.assertEqual(inst.performer[0].role.coding[0].system, "urn:oid:2.16.840.1.113883.2.4.15.111") - self.assertEqual(inst.performer[0].role.text, "Care role") - self.assertEqual(inst.reasonCode[0].text, "ensure breathing during surgery") + self.assertEqual(inst.code.text, "Appendectomy") + self.assertEqual(inst.followUp[0].text, "ROS 5 days - 2013-04-10") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "Routine Appendectomy. Appendix was inflamed and in retro-caecal position") + self.assertEqual(inst.performedDateTime.date, FHIRDate("2013-04-05").date) + self.assertEqual(inst.performedDateTime.as_json(), "2013-04-05") + self.assertEqual(inst.reasonCode[0].text, "Generalized abdominal pain 24 hours. Localized in RIF with rebound and guarding") self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.div, "
Routine Appendectomy
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/procedurerequest_tests.py b/fhirclient/models/procedurerequest_tests.py deleted file mode 100644 index 905b4c6fb..000000000 --- a/fhirclient/models/procedurerequest_tests.py +++ /dev/null @@ -1,267 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import procedurerequest -from .fhirdate import FHIRDate - - -class ProcedureRequestTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("ProcedureRequest", js["resourceType"]) - return procedurerequest.ProcedureRequest(js) - - def testProcedureRequest1(self): - inst = self.instantiate_from("procedurerequest-example-ambulation.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest1(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest1(inst2) - - def implProcedureRequest1(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2017-03-05").date) - self.assertEqual(inst.authoredOn.as_json(), "2017-03-05") - self.assertEqual(inst.code.coding[0].code, "62013009") - self.assertEqual(inst.code.coding[0].display, "Ambulating patient (procedure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Ambulation") - self.assertEqual(inst.id, "ambulation") - self.assertEqual(inst.identifier[0].value, "45678") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest2(self): - inst = self.instantiate_from("procedurerequest-example-appendectomy.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest2(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest2(inst2) - - def implProcedureRequest2(self, inst): - self.assertEqual(inst.code.text, "Appendectomy") - self.assertEqual(inst.id, "appendectomy-narrative") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "additional") - - def testProcedureRequest3(self): - inst = self.instantiate_from("procedurerequest-example-colonoscopy-bx.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest3(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest3(inst2) - - def implProcedureRequest3(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2017-03-05").date) - self.assertEqual(inst.authoredOn.as_json(), "2017-03-05") - self.assertEqual(inst.code.coding[0].code, "76164006") - self.assertEqual(inst.code.coding[0].display, "Biopsy of colon (procedure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Biopsy of colon") - self.assertEqual(inst.id, "colon-biopsy") - self.assertEqual(inst.identifier[0].value, "12345") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.requisition.system, "http://bumc.org/requisitions") - self.assertEqual(inst.requisition.value, "req12345") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest4(self): - inst = self.instantiate_from("procedurerequest-example-colonoscopy.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest4(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest4(inst2) - - def implProcedureRequest4(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2017-03-05").date) - self.assertEqual(inst.authoredOn.as_json(), "2017-03-05") - self.assertEqual(inst.code.coding[0].code, "73761001") - self.assertEqual(inst.code.coding[0].display, "Colonoscopy (procedure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Colonoscopy") - self.assertEqual(inst.id, "colonoscopy") - self.assertEqual(inst.identifier[0].value, "45678") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.requisition.system, "http://bumc.org/requisitions") - self.assertEqual(inst.requisition.value, "req12345") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest5(self): - inst = self.instantiate_from("procedurerequest-example-di.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest5(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest5(inst2) - - def implProcedureRequest5(self, inst): - self.assertEqual(inst.code.coding[0].code, "24627-2") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "Chest CT") - self.assertEqual(inst.id, "di") - self.assertEqual(inst.intent, "original-order") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2013-05-08T09:33:27+07:00").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2013-05-08T09:33:27+07:00") - self.assertEqual(inst.reasonCode[0].text, "Check for metastatic disease") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest6(self): - inst = self.instantiate_from("procedurerequest-example-edu.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest6(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest6(inst2) - - def implProcedureRequest6(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2016-08-16").date) - self.assertEqual(inst.authoredOn.as_json(), "2016-08-16") - self.assertEqual(inst.category[0].coding[0].code, "311401005") - self.assertEqual(inst.category[0].coding[0].display, "Patient education (procedure)") - self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].text, "Education") - self.assertEqual(inst.code.coding[0].code, "48023004") - self.assertEqual(inst.code.coding[0].display, "Breast self-examination technique education (procedure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Health education - breast examination") - self.assertEqual(inst.id, "education") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2014-08-16") - self.assertEqual(inst.reasonCode[0].text, "early detection of breast mass") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest7(self): - inst = self.instantiate_from("procedurerequest-example-ft4.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest7(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest7(inst2) - - def implProcedureRequest7(self, inst): - self.assertEqual(inst.code.coding[0].code, "3024-7") - self.assertEqual(inst.code.coding[0].system, "http://loinc.org") - self.assertEqual(inst.code.text, "Free T4") - self.assertEqual(inst.id, "ft4") - self.assertEqual(inst.intent, "reflex-order") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2015-08-27T09:33:27+07:00").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2015-08-27T09:33:27+07:00") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest8(self): - inst = self.instantiate_from("procedurerequest-example-implant.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest8(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest8(inst2) - - def implProcedureRequest8(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2015-03-30").date) - self.assertEqual(inst.authoredOn.as_json(), "2015-03-30") - self.assertEqual(inst.code.coding[0].code, "25267002") - self.assertEqual(inst.code.coding[0].display, "Insertion of intracardiac pacemaker (procedure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Implant Pacemaker") - self.assertEqual(inst.id, "example-implant") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.reasonCode[0].text, "Bradycardia") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest9(self): - inst = self.instantiate_from("procedurerequest-example-lipid.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest9(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest9(inst2) - - def implProcedureRequest9(self, inst): - self.assertEqual(inst.code.coding[0].code, "LIPID") - self.assertEqual(inst.code.coding[0].system, "http://acme.org/tests") - self.assertEqual(inst.code.text, "Lipid Panel") - self.assertEqual(inst.contained[0].id, "fasting") - self.assertEqual(inst.contained[1].id, "serum") - self.assertEqual(inst.id, "lipid") - self.assertEqual(inst.identifier[0].system, "urn:oid:1.3.4.5.6.7") - self.assertEqual(inst.identifier[0].type.coding[0].code, "PLAC") - self.assertEqual(inst.identifier[0].type.coding[0].system, "http://hl7.org/fhir/identifier-type") - self.assertEqual(inst.identifier[0].type.text, "Placer") - self.assertEqual(inst.identifier[0].value, "2345234234234") - self.assertEqual(inst.intent, "original-order") - self.assertEqual(inst.note[0].text, "patient is afraid of needles") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2013-05-02T16:16:00-07:00").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2013-05-02T16:16:00-07:00") - self.assertEqual(inst.reasonCode[0].coding[0].code, "V173") - self.assertEqual(inst.reasonCode[0].coding[0].display, "Fam hx-ischem heart dis") - self.assertEqual(inst.reasonCode[0].coding[0].system, "http://hl7.org/fhir/sid/icd-9") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.status, "generated") - - def testProcedureRequest10(self): - inst = self.instantiate_from("procedurerequest-example-ob.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcedureRequest instance") - self.implProcedureRequest10(inst) - - js = inst.as_json() - self.assertEqual("ProcedureRequest", js["resourceType"]) - inst2 = procedurerequest.ProcedureRequest(js) - self.implProcedureRequest10(inst2) - - def implProcedureRequest10(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "386637004") - self.assertEqual(inst.category[0].coding[0].display, "Obstetric procedure (procedure)") - self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.category[0].text, "OB") - self.assertEqual(inst.code.coding[0].code, "22633006") - self.assertEqual(inst.code.coding[0].display, "Vaginal delivery, medical personnel present (procedure)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.code.text, "Vaginal delivery") - self.assertEqual(inst.id, "ob") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2012-06-02").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2012-06-02") - self.assertEqual(inst.reasonCode[0].text, "term pregnancy, active labor") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/processrequest.py b/fhirclient/models/processrequest.py deleted file mode 100644 index 5cd48f858..000000000 --- a/fhirclient/models/processrequest.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class ProcessRequest(domainresource.DomainResource): - """ Request to perform some action on or in regards to an existing resource. - - This resource provides the target, request and response, and action details - for an action to be performed by the target on or about existing resources. - """ - - resource_type = "ProcessRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.action = None - """ cancel | poll | reprocess | status. - Type `str`. """ - - self.created = None - """ Creation date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.exclude = None - """ Resource type(s) to exclude. - List of `str` items. """ - - self.identifier = None - """ Business Identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.include = None - """ Resource type(s) to include. - List of `str` items. """ - - self.item = None - """ Items to re-adjudicate. - List of `ProcessRequestItem` items (represented as `dict` in JSON). """ - - self.nullify = None - """ Remove history. - Type `bool`. """ - - self.organization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.period = None - """ Selection period. - Type `Period` (represented as `dict` in JSON). """ - - self.provider = None - """ Responsible practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ - - self.reference = None - """ Reference number/string. - Type `str`. """ - - self.request = None - """ Reference to the Request resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.response = None - """ Reference to the Response resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - self.target = None - """ Party which is the target of the request. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - super(ProcessRequest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ProcessRequest, self).elementProperties() - js.extend([ - ("action", "action", str, False, None, False), - ("created", "created", fhirdate.FHIRDate, False, None, False), - ("exclude", "exclude", str, True, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("include", "include", str, True, None, False), - ("item", "item", ProcessRequestItem, True, None, False), - ("nullify", "nullify", bool, False, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), - ("provider", "provider", fhirreference.FHIRReference, False, None, False), - ("reference", "reference", str, False, None, False), - ("request", "request", fhirreference.FHIRReference, False, None, False), - ("response", "response", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), - ("target", "target", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -from . import backboneelement - -class ProcessRequestItem(backboneelement.BackboneElement): - """ Items to re-adjudicate. - - List of top level items to be re-adjudicated, if none specified then the - entire submission is re-adjudicated. - """ - - resource_type = "ProcessRequestItem" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.sequenceLinkId = None - """ Service instance. - Type `int`. """ - - super(ProcessRequestItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ProcessRequestItem, self).elementProperties() - js.extend([ - ("sequenceLinkId", "sequenceLinkId", int, False, None, True), - ]) - return js - - -import sys -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] -try: - from . import period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/processrequest_tests.py b/fhirclient/models/processrequest_tests.py deleted file mode 100644 index cd68a9218..000000000 --- a/fhirclient/models/processrequest_tests.py +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import processrequest -from .fhirdate import FHIRDate - - -class ProcessRequestTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("ProcessRequest", js["resourceType"]) - return processrequest.ProcessRequest(js) - - def testProcessRequest1(self): - inst = self.instantiate_from("processrequest-example-poll-eob.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest1(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest1(inst2) - - def implProcessRequest1(self, inst): - self.assertEqual(inst.action, "poll") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "1115") - self.assertEqual(inst.identifier[0].system, "http://www.phr.com/patient/12345/processrequest") - self.assertEqual(inst.identifier[0].value, "115") - self.assertEqual(inst.include[0], "ExplanationOfBenefit") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Poll ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest2(self): - inst = self.instantiate_from("processrequest-example-poll-exclusive.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest2(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest2(inst2) - - def implProcessRequest2(self, inst): - self.assertEqual(inst.action, "poll") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.exclude[0], "Communication") - self.assertEqual(inst.exclude[1], "PaymentReconciliation") - self.assertEqual(inst.id, "1113") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "113") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Poll ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest3(self): - inst = self.instantiate_from("processrequest-example-poll-inclusive.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest3(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest3(inst2) - - def implProcessRequest3(self, inst): - self.assertEqual(inst.action, "poll") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "1112") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "112") - self.assertEqual(inst.include[0], "PaymentReconciliation") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Poll ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest4(self): - inst = self.instantiate_from("processrequest-example-poll-payrec.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest4(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest4(inst2) - - def implProcessRequest4(self, inst): - self.assertEqual(inst.action, "poll") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "1114") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "114") - self.assertEqual(inst.include[0], "PaymentReconciliation") - self.assertEqual(inst.period.end.date, FHIRDate("2014-08-20").date) - self.assertEqual(inst.period.end.as_json(), "2014-08-20") - self.assertEqual(inst.period.start.date, FHIRDate("2014-08-10").date) - self.assertEqual(inst.period.start.as_json(), "2014-08-10") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Poll ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest5(self): - inst = self.instantiate_from("processrequest-example-poll-specific.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest5(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest5(inst2) - - def implProcessRequest5(self, inst): - self.assertEqual(inst.action, "poll") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "1111") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "111") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Poll ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest6(self): - inst = self.instantiate_from("processrequest-example-reprocess.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest6(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest6(inst2) - - def implProcessRequest6(self, inst): - self.assertEqual(inst.action, "reprocess") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "44654") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "44543") - self.assertEqual(inst.item[0].sequenceLinkId, 1) - self.assertEqual(inst.reference, "ABC12345G") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the ReProcess ProcessRequest resource.
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest7(self): - inst = self.instantiate_from("processrequest-example-reverse.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest7(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest7(inst2) - - def implProcessRequest7(self, inst): - self.assertEqual(inst.action, "cancel") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "87654") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "76543") - self.assertFalse(inst.nullify) - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Reversal ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest8(self): - inst = self.instantiate_from("processrequest-example-status.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest8(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest8(inst2) - - def implProcessRequest8(self, inst): - self.assertEqual(inst.action, "status") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "87655") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "1776543") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Status ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - - def testProcessRequest9(self): - inst = self.instantiate_from("processrequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessRequest instance") - self.implProcessRequest9(inst) - - js = inst.as_json() - self.assertEqual("ProcessRequest", js["resourceType"]) - inst2 = processrequest.ProcessRequest(js) - self.implProcessRequest9(inst2) - - def implProcessRequest9(self, inst): - self.assertEqual(inst.action, "poll") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.id, "1110") - self.assertEqual(inst.identifier[0].system, "http://happyvalley.com/processrequest") - self.assertEqual(inst.identifier[0].value, "110") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the Poll ProcessRequest
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/processresponse.py b/fhirclient/models/processresponse.py deleted file mode 100644 index 6f20bcca4..000000000 --- a/fhirclient/models/processresponse.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class ProcessResponse(domainresource.DomainResource): - """ ProcessResponse resource. - - This resource provides processing status, errors and notes from the - processing of a resource. - """ - - resource_type = "ProcessResponse" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.communicationRequest = None - """ Request for additional information. - List of `FHIRReference` items referencing `CommunicationRequest` (represented as `dict` in JSON). """ - - self.created = None - """ Creation date. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.disposition = None - """ Disposition Message. - Type `str`. """ - - self.error = None - """ Error code. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.form = None - """ Printed Form Identifier. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.identifier = None - """ Business Identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.organization = None - """ Authoring Organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.outcome = None - """ Processing outcome. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.processNote = None - """ Processing comments or additional requirements. - List of `ProcessResponseProcessNote` items (represented as `dict` in JSON). """ - - self.request = None - """ Request reference. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.requestOrganization = None - """ Responsible organization. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - self.requestProvider = None - """ Responsible Practitioner. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ - - self.status = None - """ active | cancelled | draft | entered-in-error. - Type `str`. """ - - super(ProcessResponse, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ProcessResponse, self).elementProperties() - js.extend([ - ("communicationRequest", "communicationRequest", fhirreference.FHIRReference, True, None, False), - ("created", "created", fhirdate.FHIRDate, False, None, False), - ("disposition", "disposition", str, False, None, False), - ("error", "error", codeableconcept.CodeableConcept, True, None, False), - ("form", "form", codeableconcept.CodeableConcept, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("organization", "organization", fhirreference.FHIRReference, False, None, False), - ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), - ("processNote", "processNote", ProcessResponseProcessNote, True, None, False), - ("request", "request", fhirreference.FHIRReference, False, None, False), - ("requestOrganization", "requestOrganization", fhirreference.FHIRReference, False, None, False), - ("requestProvider", "requestProvider", fhirreference.FHIRReference, False, None, False), - ("status", "status", str, False, None, False), - ]) - return js - - -from . import backboneelement - -class ProcessResponseProcessNote(backboneelement.BackboneElement): - """ Processing comments or additional requirements. - - Suite of processing notes or additional requirements if the processing has - been held. - """ - - resource_type = "ProcessResponseProcessNote" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.text = None - """ Comment on the processing. - Type `str`. """ - - self.type = None - """ display | print | printoper. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ProcessResponseProcessNote, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ProcessResponseProcessNote, self).elementProperties() - js.extend([ - ("text", "text", str, False, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -import sys -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/processresponse_tests.py b/fhirclient/models/processresponse_tests.py deleted file mode 100644 index 3c97180ac..000000000 --- a/fhirclient/models/processresponse_tests.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import processresponse -from .fhirdate import FHIRDate - - -class ProcessResponseTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("ProcessResponse", js["resourceType"]) - return processresponse.ProcessResponse(js) - - def testProcessResponse1(self): - inst = self.instantiate_from("processresponse-example-error.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessResponse instance") - self.implProcessResponse1(inst) - - js = inst.as_json() - self.assertEqual("ProcessResponse", js["resourceType"]) - inst2 = processresponse.ProcessResponse(js) - self.implProcessResponse1(inst2) - - def implProcessResponse1(self, inst): - self.assertEqual(inst.created.date, FHIRDate("2014-07-14").date) - self.assertEqual(inst.created.as_json(), "2014-07-14") - self.assertEqual(inst.disposition, "Referred to claim not found on system.") - self.assertEqual(inst.error[0].coding[0].code, "a001") - self.assertEqual(inst.error[0].coding[0].system, "http://hl7.org/fhir/adjudication-error") - self.assertEqual(inst.form.coding[0].code, "PRRESP/2016/01") - self.assertEqual(inst.form.coding[0].system, "http://ncforms.org/formid") - self.assertEqual(inst.id, "SR2349") - self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/processresponse") - self.assertEqual(inst.identifier[0].value, "ER987634") - self.assertEqual(inst.outcome.coding[0].code, "error") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/processoutcomecodes") - self.assertEqual(inst.processNote[0].text, "Please check the submitted payor identification and local claim number.") - self.assertEqual(inst.processNote[0].type.coding[0].code, "print") - self.assertEqual(inst.processNote[0].type.coding[0].system, "http://hl7.org/fhir/note-type") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the ProcessResponse
") - self.assertEqual(inst.text.status, "generated") - - def testProcessResponse2(self): - inst = self.instantiate_from("processresponse-example-pended.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessResponse instance") - self.implProcessResponse2(inst) - - js = inst.as_json() - self.assertEqual("ProcessResponse", js["resourceType"]) - inst2 = processresponse.ProcessResponse(js) - self.implProcessResponse2(inst2) - - def implProcessResponse2(self, inst): - self.assertEqual(inst.contained[0].id, "comreq-1") - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.disposition, "Additional information required.") - self.assertEqual(inst.id, "SR2499") - self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/processresponse") - self.assertEqual(inst.identifier[0].value, "881222") - self.assertEqual(inst.outcome.coding[0].code, "pended") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/processoutcomecodes") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A ProcessResponse indicating pended status with a request for additional information.
") - self.assertEqual(inst.text.status, "generated") - - def testProcessResponse3(self): - inst = self.instantiate_from("processresponse-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ProcessResponse instance") - self.implProcessResponse3(inst) - - js = inst.as_json() - self.assertEqual("ProcessResponse", js["resourceType"]) - inst2 = processresponse.ProcessResponse(js) - self.implProcessResponse3(inst2) - - def implProcessResponse3(self, inst): - self.assertEqual(inst.created.date, FHIRDate("2014-08-16").date) - self.assertEqual(inst.created.as_json(), "2014-08-16") - self.assertEqual(inst.disposition, "Adjudication processing completed, ClaimResponse and EOB ready for retrieval.") - self.assertEqual(inst.id, "SR2500") - self.assertEqual(inst.identifier[0].system, "http://www.BenefitsInc.com/fhir/processresponse") - self.assertEqual(inst.identifier[0].value, "881234") - self.assertEqual(inst.outcome.coding[0].code, "complete") - self.assertEqual(inst.outcome.coding[0].system, "http://hl7.org/fhir/processoutcomecodes") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
A human-readable rendering of the ProcessResponse
") - self.assertEqual(inst.text.status, "generated") - diff --git a/fhirclient/models/prodcharacteristic.py b/fhirclient/models/prodcharacteristic.py new file mode 100644 index 000000000..8a2b5c6a2 --- /dev/null +++ b/fhirclient/models/prodcharacteristic.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ProdCharacteristic) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import backboneelement + +class ProdCharacteristic(backboneelement.BackboneElement): + """ The marketing status describes the date when a medicinal product is + actually put on the market or the date as of which it is no longer + available. + """ + + resource_type = "ProdCharacteristic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.color = None + """ Where applicable, the color can be specified An appropriate + controlled vocabulary shall be used The term and the term + identifier shall be used. + List of `str` items. """ + + self.depth = None + """ Where applicable, the depth can be specified using a numerical + value and its unit of measurement The unit of measurement shall be + specified in accordance with ISO 11240 and the resulting + terminology The symbol and the symbol identifier shall be used. + Type `Quantity` (represented as `dict` in JSON). """ + + self.externalDiameter = None + """ Where applicable, the external diameter can be specified using a + numerical value and its unit of measurement The unit of measurement + shall be specified in accordance with ISO 11240 and the resulting + terminology The symbol and the symbol identifier shall be used. + Type `Quantity` (represented as `dict` in JSON). """ + + self.height = None + """ Where applicable, the height can be specified using a numerical + value and its unit of measurement The unit of measurement shall be + specified in accordance with ISO 11240 and the resulting + terminology The symbol and the symbol identifier shall be used. + Type `Quantity` (represented as `dict` in JSON). """ + + self.image = None + """ Where applicable, the image can be provided The format of the image + attachment shall be specified by regional implementations. + List of `Attachment` items (represented as `dict` in JSON). """ + + self.imprint = None + """ Where applicable, the imprint can be specified as text. + List of `str` items. """ + + self.nominalVolume = None + """ Where applicable, the nominal volume can be specified using a + numerical value and its unit of measurement The unit of measurement + shall be specified in accordance with ISO 11240 and the resulting + terminology The symbol and the symbol identifier shall be used. + Type `Quantity` (represented as `dict` in JSON). """ + + self.scoring = None + """ Where applicable, the scoring can be specified An appropriate + controlled vocabulary shall be used The term and the term + identifier shall be used. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.shape = None + """ Where applicable, the shape can be specified An appropriate + controlled vocabulary shall be used The term and the term + identifier shall be used. + Type `str`. """ + + self.weight = None + """ Where applicable, the weight can be specified using a numerical + value and its unit of measurement The unit of measurement shall be + specified in accordance with ISO 11240 and the resulting + terminology The symbol and the symbol identifier shall be used. + Type `Quantity` (represented as `dict` in JSON). """ + + self.width = None + """ Where applicable, the width can be specified using a numerical + value and its unit of measurement The unit of measurement shall be + specified in accordance with ISO 11240 and the resulting + terminology The symbol and the symbol identifier shall be used. + Type `Quantity` (represented as `dict` in JSON). """ + + super(ProdCharacteristic, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProdCharacteristic, self).elementProperties() + js.extend([ + ("color", "color", str, True, None, False), + ("depth", "depth", quantity.Quantity, False, None, False), + ("externalDiameter", "externalDiameter", quantity.Quantity, False, None, False), + ("height", "height", quantity.Quantity, False, None, False), + ("image", "image", attachment.Attachment, True, None, False), + ("imprint", "imprint", str, True, None, False), + ("nominalVolume", "nominalVolume", quantity.Quantity, False, None, False), + ("scoring", "scoring", codeableconcept.CodeableConcept, False, None, False), + ("shape", "shape", str, False, None, False), + ("weight", "weight", quantity.Quantity, False, None, False), + ("width", "width", quantity.Quantity, False, None, False), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/productshelflife.py b/fhirclient/models/productshelflife.py new file mode 100644 index 000000000..140062f07 --- /dev/null +++ b/fhirclient/models/productshelflife.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ProductShelfLife) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import backboneelement + +class ProductShelfLife(backboneelement.BackboneElement): + """ The shelf-life and storage information for a medicinal product item or + container can be described using this class. + """ + + resource_type = "ProductShelfLife" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.identifier = None + """ Unique identifier for the packaged Medicinal Product. + Type `Identifier` (represented as `dict` in JSON). """ + + self.period = None + """ The shelf life time period can be specified using a numerical value + for the period of time and its unit of time measurement The unit of + measurement shall be specified in accordance with ISO 11240 and the + resulting terminology The symbol and the symbol identifier shall be + used. + Type `Quantity` (represented as `dict` in JSON). """ + + self.specialPrecautionsForStorage = None + """ Special precautions for storage, if any, can be specified using an + appropriate controlled vocabulary The controlled term and the + controlled term identifier shall be specified. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ This describes the shelf life, taking into account various + scenarios such as shelf life of the packaged Medicinal Product + itself, shelf life after transformation where necessary and shelf + life after the first opening of a bottle, etc. The shelf life type + shall be specified using an appropriate controlled vocabulary The + controlled term and the controlled term identifier shall be + specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ProductShelfLife, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ProductShelfLife, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("period", "period", quantity.Quantity, False, None, True), + ("specialPrecautionsForStorage", "specialPrecautionsForStorage", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] diff --git a/fhirclient/models/provenance.py b/fhirclient/models/provenance.py index f15aa819c..b0e1ca24e 100644 --- a/fhirclient/models/provenance.py +++ b/fhirclient/models/provenance.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Provenance) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Provenance) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -34,7 +34,7 @@ def __init__(self, jsondict=None, strict=True): self.activity = None """ Activity that occurred. - Type `Coding` (represented as `dict` in JSON). """ + Type `CodeableConcept` (represented as `dict` in JSON). """ self.agent = None """ Actor involved. @@ -46,9 +46,13 @@ def __init__(self, jsondict=None, strict=True): self.location = None """ Where the activity occurred, if relevant. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.occurredDateTime = None + """ When the activity occurred. + Type `FHIRDate` (represented as `str` in JSON). """ - self.period = None + self.occurredPeriod = None """ When the activity occurred. Type `Period` (represented as `dict` in JSON). """ @@ -58,7 +62,7 @@ def __init__(self, jsondict=None, strict=True): self.reason = None """ Reason the activity is occurring. - List of `Coding` items (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.recorded = None """ When the activity was recorded / updated. @@ -70,20 +74,21 @@ def __init__(self, jsondict=None, strict=True): self.target = None """ Target Reference(s) (usually version specific). - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(Provenance, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Provenance, self).elementProperties() js.extend([ - ("activity", "activity", coding.Coding, False, None, False), + ("activity", "activity", codeableconcept.CodeableConcept, False, None, False), ("agent", "agent", ProvenanceAgent, True, None, True), ("entity", "entity", ProvenanceEntity, True, None, False), ("location", "location", fhirreference.FHIRReference, False, None, False), - ("period", "period", period.Period, False, None, False), + ("occurredDateTime", "occurredDateTime", fhirdate.FHIRDate, False, "occurred", False), + ("occurredPeriod", "occurredPeriod", period.Period, False, "occurred", False), ("policy", "policy", str, True, None, False), - ("reason", "reason", coding.Coding, True, None, False), + ("reason", "reason", codeableconcept.CodeableConcept, True, None, False), ("recorded", "recorded", fhirdate.FHIRDate, False, None, True), ("signature", "signature", signature.Signature, True, None, False), ("target", "target", fhirreference.FHIRReference, True, None, True), @@ -110,41 +115,31 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.onBehalfOfReference = None + self.onBehalfOf = None """ Who the agent is representing. - Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Device, Organization` (represented as `dict` in JSON). """ - - self.onBehalfOfUri = None - """ Who the agent is representing. - Type `str`. """ - - self.relatedAgentType = None - """ Type of relationship between agents. - Type `CodeableConcept` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.role = None """ What the agents role was. List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.whoReference = None - """ Who participated. - Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Device, Organization` (represented as `dict` in JSON). """ + self.type = None + """ How the agent participated. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.whoUri = None + self.who = None """ Who participated. - Type `str`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ProvenanceAgent, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ProvenanceAgent, self).elementProperties() js.extend([ - ("onBehalfOfReference", "onBehalfOfReference", fhirreference.FHIRReference, False, "onBehalfOf", False), - ("onBehalfOfUri", "onBehalfOfUri", str, False, "onBehalfOf", False), - ("relatedAgentType", "relatedAgentType", codeableconcept.CodeableConcept, False, None, False), + ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), ("role", "role", codeableconcept.CodeableConcept, True, None, False), - ("whoReference", "whoReference", fhirreference.FHIRReference, False, "who", True), - ("whoUri", "whoUri", str, False, "who", True), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("who", "who", fhirreference.FHIRReference, False, None, True), ]) return js @@ -171,17 +166,9 @@ def __init__(self, jsondict=None, strict=True): """ derivation | revision | quotation | source | removal. Type `str`. """ - self.whatIdentifier = None - """ Identity of entity. - Type `Identifier` (represented as `dict` in JSON). """ - - self.whatReference = None + self.what = None """ Identity of entity. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.whatUri = None - """ Identity of entity. - Type `str`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ProvenanceEntity, self).__init__(jsondict=jsondict, strict=strict) @@ -190,9 +177,7 @@ def elementProperties(self): js.extend([ ("agent", "agent", ProvenanceAgent, True, None, False), ("role", "role", str, False, None, True), - ("whatIdentifier", "whatIdentifier", identifier.Identifier, False, "what", True), - ("whatReference", "whatReference", fhirreference.FHIRReference, False, "what", True), - ("whatUri", "whatUri", str, False, "what", True), + ("what", "what", fhirreference.FHIRReference, False, None, True), ]) return js @@ -202,10 +187,6 @@ def elementProperties(self): from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] try: from . import fhirdate except ImportError: @@ -214,10 +195,6 @@ def elementProperties(self): from . import fhirreference except ImportError: fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] try: from . import period except ImportError: diff --git a/fhirclient/models/provenance_tests.py b/fhirclient/models/provenance_tests.py index 5b5ec9792..4d61896a2 100644 --- a/fhirclient/models/provenance_tests.py +++ b/fhirclient/models/provenance_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return provenance.Provenance(js) def testProvenance1(self): - inst = self.instantiate_from("provenance-example-biocompute-object.json") + inst = self.instantiate_from("provenance-example-sig.json") self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") self.implProvenance1(inst) @@ -32,19 +32,29 @@ def testProvenance1(self): self.implProvenance1(inst2) def implProvenance1(self, inst): - self.assertEqual(inst.agent[0].role[0].coding[0].code, "AUT") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") - self.assertEqual(inst.entity[0].role, "source") - self.assertEqual(inst.entity[0].whatIdentifier.type.coding[0].code, "biocompute") - self.assertEqual(inst.entity[0].whatIdentifier.type.coding[0].display, "obj.1001") - self.assertEqual(inst.entity[0].whatIdentifier.type.coding[0].system, "https://hive.biochemistry.gwu.edu") - self.assertEqual(inst.entity[0].whatIdentifier.value, "https://hive.biochemistry.gwu.edu/cgi-bin/prd/htscsrs/servlet.cgi?pageid=bcoexample_1") - self.assertEqual(inst.id, "example-biocompute-object") - self.assertEqual(inst.period.start.date, FHIRDate("2017-06-06").date) - self.assertEqual(inst.period.start.as_json(), "2017-06-06") - self.assertEqual(inst.reason[0].display, "antiviral resistance detection") - self.assertEqual(inst.recorded.date, FHIRDate("2016-06-09T08:12:14+10:00").date) - self.assertEqual(inst.recorded.as_json(), "2016-06-09T08:12:14+10:00") + self.assertEqual(inst.activity.coding[0].code, "AU") + self.assertEqual(inst.activity.coding[0].display, "authenticated") + self.assertEqual(inst.activity.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-DocumentCompletion") + self.assertEqual(inst.agent[0].type.coding[0].code, "VERF") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/contractsignertypecodes") + self.assertEqual(inst.id, "signature") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.reason[0].coding[0].code, "TREAT") + self.assertEqual(inst.reason[0].coding[0].display, "treatment") + self.assertEqual(inst.reason[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.recorded.date, FHIRDate("2015-08-27T08:39:24+10:00").date) + self.assertEqual(inst.recorded.as_json(), "2015-08-27T08:39:24+10:00") + self.assertEqual(inst.signature[0].data, "Li4u") + self.assertEqual(inst.signature[0].sigFormat, "application/signature+xml") + self.assertEqual(inst.signature[0].targetFormat, "application/fhir+xml") + self.assertEqual(inst.signature[0].type[0].code, "1.2.840.10065.1.12.1.5") + self.assertEqual(inst.signature[0].type[0].display, "Verification Signature") + self.assertEqual(inst.signature[0].type[0].system, "urn:iso-astm:E1762-95:2013") + self.assertEqual(inst.signature[0].when.date, FHIRDate("2015-08-27T08:39:24+10:00").date) + self.assertEqual(inst.signature[0].when.as_json(), "2015-08-27T08:39:24+10:00") + self.assertEqual(inst.text.div, "
procedure record authored on 27-June 2015 by Harold Hippocrates, MD Content extracted from Referral received 26-June
") self.assertEqual(inst.text.status, "generated") def testProvenance2(self): @@ -58,23 +68,22 @@ def testProvenance2(self): self.implProvenance2(inst2) def implProvenance2(self, inst): - self.assertEqual(inst.agent[0].role[0].coding[0].code, "AUT") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.agent[0].type.coding[0].code, "AUT") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.entity[0].role, "source") - self.assertEqual(inst.entity[0].whatIdentifier.type.coding[0].code, "CWL") - self.assertEqual(inst.entity[0].whatIdentifier.type.coding[0].display, "lobSTR") - self.assertEqual(inst.entity[0].whatIdentifier.type.coding[0].system, "https://github.com/common-workflow-language/workflows") - self.assertEqual(inst.entity[0].whatIdentifier.value, "https://github.com/common-workflow-language/workflows/blob/master/workflows/lobSTR/lobSTR-workflow.cwl") self.assertEqual(inst.id, "example-cwl") - self.assertEqual(inst.period.start.date, FHIRDate("2016-11-30").date) - self.assertEqual(inst.period.start.as_json(), "2016-11-30") - self.assertEqual(inst.reason[0].display, "profiling Short Tandem Repeats (STRs) from high throughput sequencing data.") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurredPeriod.start.date, FHIRDate("2016-11-30").date) + self.assertEqual(inst.occurredPeriod.start.as_json(), "2016-11-30") + self.assertEqual(inst.reason[0].text, "profiling Short Tandem Repeats (STRs) from high throughput sequencing data.") self.assertEqual(inst.recorded.date, FHIRDate("2016-12-01T08:12:14+10:00").date) self.assertEqual(inst.recorded.as_json(), "2016-12-01T08:12:14+10:00") self.assertEqual(inst.text.status, "generated") def testProvenance3(self): - inst = self.instantiate_from("provenance-example-sig.json") + inst = self.instantiate_from("provenance-example-biocompute-object.json") self.assertIsNotNone(inst, "Must have instantiated a Provenance instance") self.implProvenance3(inst) @@ -84,26 +93,18 @@ def testProvenance3(self): self.implProvenance3(inst2) def implProvenance3(self, inst): - self.assertEqual(inst.activity.code, "AU") - self.assertEqual(inst.activity.display, "authenticated") - self.assertEqual(inst.activity.system, "http://hl7.org/fhir/v3/DocumentCompletion") - self.assertEqual(inst.agent[0].role[0].coding[0].code, "VERF") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://www.hl7.org/fhir/contractsignertypecodes") - self.assertEqual(inst.agent[0].whoUri, "mailto://hhd@ssa.gov") - self.assertEqual(inst.id, "signature") - self.assertEqual(inst.reason[0].code, "TREAT") - self.assertEqual(inst.reason[0].display, "treatment") - self.assertEqual(inst.reason[0].system, "http://hl7.org/fhir/v3/ActReason") - self.assertEqual(inst.recorded.date, FHIRDate("2015-08-27T08:39:24+10:00").date) - self.assertEqual(inst.recorded.as_json(), "2015-08-27T08:39:24+10:00") - self.assertEqual(inst.signature[0].blob, "Li4u") - self.assertEqual(inst.signature[0].contentType, "application/signature+xml") - self.assertEqual(inst.signature[0].type[0].code, "1.2.840.10065.1.12.1.5") - self.assertEqual(inst.signature[0].type[0].display, "Verification Signature") - self.assertEqual(inst.signature[0].type[0].system, "urn:iso-astm:E1762-95:2013") - self.assertEqual(inst.signature[0].when.date, FHIRDate("2015-08-27T08:39:24+10:00").date) - self.assertEqual(inst.signature[0].when.as_json(), "2015-08-27T08:39:24+10:00") - self.assertEqual(inst.text.div, "
procedure record authored on 27-June 2015 by Harold Hippocrates, MD Content extracted from Referral received 26-June
") + self.assertEqual(inst.agent[0].type.coding[0].code, "AUT") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") + self.assertEqual(inst.entity[0].role, "source") + self.assertEqual(inst.id, "example-biocompute-object") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurredPeriod.start.date, FHIRDate("2017-06-06").date) + self.assertEqual(inst.occurredPeriod.start.as_json(), "2017-06-06") + self.assertEqual(inst.reason[0].text, "antiviral resistance detection") + self.assertEqual(inst.recorded.date, FHIRDate("2016-06-09T08:12:14+10:00").date) + self.assertEqual(inst.recorded.as_json(), "2016-06-09T08:12:14+10:00") self.assertEqual(inst.text.status, "generated") def testProvenance4(self): @@ -117,25 +118,25 @@ def testProvenance4(self): self.implProvenance4(inst2) def implProvenance4(self, inst): - self.assertEqual(inst.agent[0].onBehalfOfUri, "#a1") - self.assertEqual(inst.agent[0].relatedAgentType.text, "used") - self.assertEqual(inst.agent[0].role[0].coding[0].code, "AUT") - self.assertEqual(inst.agent[0].role[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.agent[0].type.coding[0].code, "AUT") + self.assertEqual(inst.agent[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.agent[1].id, "a1") - self.assertEqual(inst.agent[1].role[0].coding[0].code, "DEV") - self.assertEqual(inst.agent[1].role[0].coding[0].system, "http://hl7.org/fhir/v3/ParticipationType") + self.assertEqual(inst.agent[1].type.coding[0].code, "DEV") + self.assertEqual(inst.agent[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-ParticipationType") self.assertEqual(inst.entity[0].role, "source") self.assertEqual(inst.id, "example") - self.assertEqual(inst.period.end.date, FHIRDate("2015-06-28").date) - self.assertEqual(inst.period.end.as_json(), "2015-06-28") - self.assertEqual(inst.period.start.date, FHIRDate("2015-06-27").date) - self.assertEqual(inst.period.start.as_json(), "2015-06-27") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurredPeriod.end.date, FHIRDate("2015-06-28").date) + self.assertEqual(inst.occurredPeriod.end.as_json(), "2015-06-28") + self.assertEqual(inst.occurredPeriod.start.date, FHIRDate("2015-06-27").date) + self.assertEqual(inst.occurredPeriod.start.as_json(), "2015-06-27") self.assertEqual(inst.policy[0], "http://acme.com/fhir/Consent/25") - self.assertEqual(inst.reason[0].code, "3457005") - self.assertEqual(inst.reason[0].display, "Referral") - self.assertEqual(inst.reason[0].system, "http://snomed.info/sct") + self.assertEqual(inst.reason[0].coding[0].code, "3457005") + self.assertEqual(inst.reason[0].coding[0].display, "Referral") + self.assertEqual(inst.reason[0].coding[0].system, "http://snomed.info/sct") self.assertEqual(inst.recorded.date, FHIRDate("2015-06-27T08:39:24+10:00").date) self.assertEqual(inst.recorded.as_json(), "2015-06-27T08:39:24+10:00") - self.assertEqual(inst.text.div, "
procedure record authored on 27-June 2015 by Harold Hippocrates, MD Content extracted from XDS managed CDA Referral received 26-June
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/quantity.py b/fhirclient/models/quantity.py index 0a8349d10..277c7f4cb 100644 --- a/fhirclient/models/quantity.py +++ b/fhirclient/models/quantity.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Quantity) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MoneyQuantity) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/questionnaire.py b/fhirclient/models/questionnaire.py index d8df7f1e8..0a6d129ca 100644 --- a/fhirclient/models/questionnaire.py +++ b/fhirclient/models/questionnaire.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -43,9 +43,13 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ + self.derivedFrom = None + """ Instantiates protocol or definition. + List of `str` items. """ + self.description = None """ Natural language description of the questionnaire. Type `str`. """ @@ -99,11 +103,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this questionnaire (globally unique). + """ Canonical identifier for this questionnaire, represented as a URI + (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -120,6 +125,7 @@ def elementProperties(self): ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), + ("derivedFrom", "derivedFrom", str, True, None, False), ("description", "description", str, False, None, False), ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), ("experimental", "experimental", bool, False, None, False), @@ -159,6 +165,14 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.answerOption = None + """ Permitted answer. + List of `QuestionnaireItemAnswerOption` items (represented as `dict` in JSON). """ + + self.answerValueSet = None + """ Valueset containing permitted answers. + Type `str`. """ + self.code = None """ Corresponding concept for this item in a terminology. List of `Coding` items (represented as `dict` in JSON). """ @@ -167,57 +181,17 @@ def __init__(self, jsondict=None, strict=True): """ ElementDefinition - details for the item. Type `str`. """ + self.enableBehavior = None + """ all | any. + Type `str`. """ + self.enableWhen = None """ Only allow data when. List of `QuestionnaireItemEnableWhen` items (represented as `dict` in JSON). """ - self.initialAttachment = None - """ Default value when item is first rendered. - Type `Attachment` (represented as `dict` in JSON). """ - - self.initialBoolean = None - """ Default value when item is first rendered. - Type `bool`. """ - - self.initialCoding = None - """ Default value when item is first rendered. - Type `Coding` (represented as `dict` in JSON). """ - - self.initialDate = None - """ Default value when item is first rendered. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.initialDateTime = None - """ Default value when item is first rendered. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.initialDecimal = None - """ Default value when item is first rendered. - Type `float`. """ - - self.initialInteger = None - """ Default value when item is first rendered. - Type `int`. """ - - self.initialQuantity = None - """ Default value when item is first rendered. - Type `Quantity` (represented as `dict` in JSON). """ - - self.initialReference = None - """ Default value when item is first rendered. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.initialString = None - """ Default value when item is first rendered. - Type `str`. """ - - self.initialTime = None - """ Default value when item is first rendered. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.initialUri = None - """ Default value when item is first rendered. - Type `str`. """ + self.initial = None + """ Initial value(s) when item is first rendered. + List of `QuestionnaireItemInitial` items (represented as `dict` in JSON). """ self.item = None """ Nested questionnaire items. @@ -231,14 +205,6 @@ def __init__(self, jsondict=None, strict=True): """ No more than this many characters. Type `int`. """ - self.option = None - """ Permitted answer. - List of `QuestionnaireItemOption` items (represented as `dict` in JSON). """ - - self.options = None - """ Valueset containing permitted answers. - Type `FHIRReference` referencing `ValueSet` (represented as `dict` in JSON). """ - self.prefix = None """ E.g. "1(a)", "2.5.3". Type `str`. """ @@ -268,26 +234,16 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(QuestionnaireItem, self).elementProperties() js.extend([ + ("answerOption", "answerOption", QuestionnaireItemAnswerOption, True, None, False), + ("answerValueSet", "answerValueSet", str, False, None, False), ("code", "code", coding.Coding, True, None, False), ("definition", "definition", str, False, None, False), + ("enableBehavior", "enableBehavior", str, False, None, False), ("enableWhen", "enableWhen", QuestionnaireItemEnableWhen, True, None, False), - ("initialAttachment", "initialAttachment", attachment.Attachment, False, "initial", False), - ("initialBoolean", "initialBoolean", bool, False, "initial", False), - ("initialCoding", "initialCoding", coding.Coding, False, "initial", False), - ("initialDate", "initialDate", fhirdate.FHIRDate, False, "initial", False), - ("initialDateTime", "initialDateTime", fhirdate.FHIRDate, False, "initial", False), - ("initialDecimal", "initialDecimal", float, False, "initial", False), - ("initialInteger", "initialInteger", int, False, "initial", False), - ("initialQuantity", "initialQuantity", quantity.Quantity, False, "initial", False), - ("initialReference", "initialReference", fhirreference.FHIRReference, False, "initial", False), - ("initialString", "initialString", str, False, "initial", False), - ("initialTime", "initialTime", fhirdate.FHIRDate, False, "initial", False), - ("initialUri", "initialUri", str, False, "initial", False), + ("initial", "initial", QuestionnaireItemInitial, True, None, False), ("item", "item", QuestionnaireItem, True, None, False), ("linkId", "linkId", str, False, None, True), ("maxLength", "maxLength", int, False, None, False), - ("option", "option", QuestionnaireItemOption, True, None, False), - ("options", "options", fhirreference.FHIRReference, False, None, False), ("prefix", "prefix", str, False, None, False), ("readOnly", "readOnly", bool, False, None, False), ("repeats", "repeats", bool, False, None, False), @@ -298,6 +254,66 @@ def elementProperties(self): return js +class QuestionnaireItemAnswerOption(backboneelement.BackboneElement): + """ Permitted answer. + + One of the permitted answers for a "choice" or "open-choice" question. + """ + + resource_type = "QuestionnaireItemAnswerOption" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.initialSelected = None + """ Whether option is selected by default. + Type `bool`. """ + + self.valueCoding = None + """ Answer value. + Type `Coding` (represented as `dict` in JSON). """ + + self.valueDate = None + """ Answer value. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueInteger = None + """ Answer value. + Type `int`. """ + + self.valueReference = None + """ Answer value. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.valueString = None + """ Answer value. + Type `str`. """ + + self.valueTime = None + """ Answer value. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(QuestionnaireItemAnswerOption, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(QuestionnaireItemAnswerOption, self).elementProperties() + js.extend([ + ("initialSelected", "initialSelected", bool, False, None, False), + ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", True), + ("valueInteger", "valueInteger", int, False, "value", True), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), + ("valueString", "valueString", str, False, "value", True), + ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", True), + ]) + return js + + class QuestionnaireItemEnableWhen(backboneelement.BackboneElement): """ Only allow data when. @@ -316,58 +332,50 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.answerAttachment = None - """ Value question must have. - Type `Attachment` (represented as `dict` in JSON). """ - self.answerBoolean = None - """ Value question must have. + """ Value for question comparison based on operator. Type `bool`. """ self.answerCoding = None - """ Value question must have. + """ Value for question comparison based on operator. Type `Coding` (represented as `dict` in JSON). """ self.answerDate = None - """ Value question must have. + """ Value for question comparison based on operator. Type `FHIRDate` (represented as `str` in JSON). """ self.answerDateTime = None - """ Value question must have. + """ Value for question comparison based on operator. Type `FHIRDate` (represented as `str` in JSON). """ self.answerDecimal = None - """ Value question must have. + """ Value for question comparison based on operator. Type `float`. """ self.answerInteger = None - """ Value question must have. + """ Value for question comparison based on operator. Type `int`. """ self.answerQuantity = None - """ Value question must have. + """ Value for question comparison based on operator. Type `Quantity` (represented as `dict` in JSON). """ self.answerReference = None - """ Value question must have. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + """ Value for question comparison based on operator. + Type `FHIRReference` (represented as `dict` in JSON). """ self.answerString = None - """ Value question must have. + """ Value for question comparison based on operator. Type `str`. """ self.answerTime = None - """ Value question must have. + """ Value for question comparison based on operator. Type `FHIRDate` (represented as `str` in JSON). """ - self.answerUri = None - """ Value question must have. + self.operator = None + """ exists | = | != | > | < | >= | <=. Type `str`. """ - self.hasAnswer = None - """ Enable when answered or not. - Type `bool`. """ - self.question = None """ Question that determines whether item is enabled. Type `str`. """ @@ -377,31 +385,30 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(QuestionnaireItemEnableWhen, self).elementProperties() js.extend([ - ("answerAttachment", "answerAttachment", attachment.Attachment, False, "answer", False), - ("answerBoolean", "answerBoolean", bool, False, "answer", False), - ("answerCoding", "answerCoding", coding.Coding, False, "answer", False), - ("answerDate", "answerDate", fhirdate.FHIRDate, False, "answer", False), - ("answerDateTime", "answerDateTime", fhirdate.FHIRDate, False, "answer", False), - ("answerDecimal", "answerDecimal", float, False, "answer", False), - ("answerInteger", "answerInteger", int, False, "answer", False), - ("answerQuantity", "answerQuantity", quantity.Quantity, False, "answer", False), - ("answerReference", "answerReference", fhirreference.FHIRReference, False, "answer", False), - ("answerString", "answerString", str, False, "answer", False), - ("answerTime", "answerTime", fhirdate.FHIRDate, False, "answer", False), - ("answerUri", "answerUri", str, False, "answer", False), - ("hasAnswer", "hasAnswer", bool, False, None, False), + ("answerBoolean", "answerBoolean", bool, False, "answer", True), + ("answerCoding", "answerCoding", coding.Coding, False, "answer", True), + ("answerDate", "answerDate", fhirdate.FHIRDate, False, "answer", True), + ("answerDateTime", "answerDateTime", fhirdate.FHIRDate, False, "answer", True), + ("answerDecimal", "answerDecimal", float, False, "answer", True), + ("answerInteger", "answerInteger", int, False, "answer", True), + ("answerQuantity", "answerQuantity", quantity.Quantity, False, "answer", True), + ("answerReference", "answerReference", fhirreference.FHIRReference, False, "answer", True), + ("answerString", "answerString", str, False, "answer", True), + ("answerTime", "answerTime", fhirdate.FHIRDate, False, "answer", True), + ("operator", "operator", str, False, None, True), ("question", "question", str, False, None, True), ]) return js -class QuestionnaireItemOption(backboneelement.BackboneElement): - """ Permitted answer. +class QuestionnaireItemInitial(backboneelement.BackboneElement): + """ Initial value(s) when item is first rendered. - One of the permitted answers for a "choice" or "open-choice" question. + One or more values that should be pre-populated in the answer when + initially rendering the questionnaire for user input. """ - resource_type = "QuestionnaireItemOption" + resource_type = "QuestionnaireItemInitial" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -411,36 +418,71 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.valueAttachment = None + """ Actual value for initializing the question. + Type `Attachment` (represented as `dict` in JSON). """ + + self.valueBoolean = None + """ Actual value for initializing the question. + Type `bool`. """ + self.valueCoding = None - """ Answer value. + """ Actual value for initializing the question. Type `Coding` (represented as `dict` in JSON). """ self.valueDate = None - """ Answer value. + """ Actual value for initializing the question. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.valueDateTime = None + """ Actual value for initializing the question. Type `FHIRDate` (represented as `str` in JSON). """ + self.valueDecimal = None + """ Actual value for initializing the question. + Type `float`. """ + self.valueInteger = None - """ Answer value. + """ Actual value for initializing the question. Type `int`. """ + self.valueQuantity = None + """ Actual value for initializing the question. + Type `Quantity` (represented as `dict` in JSON). """ + + self.valueReference = None + """ Actual value for initializing the question. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.valueString = None - """ Answer value. + """ Actual value for initializing the question. Type `str`. """ self.valueTime = None - """ Answer value. + """ Actual value for initializing the question. Type `FHIRDate` (represented as `str` in JSON). """ - super(QuestionnaireItemOption, self).__init__(jsondict=jsondict, strict=strict) + self.valueUri = None + """ Actual value for initializing the question. + Type `str`. """ + + super(QuestionnaireItemInitial, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(QuestionnaireItemOption, self).elementProperties() + js = super(QuestionnaireItemInitial, self).elementProperties() js.extend([ + ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), + ("valueBoolean", "valueBoolean", bool, False, "value", True), ("valueCoding", "valueCoding", coding.Coding, False, "value", True), ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", True), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", True), + ("valueDecimal", "valueDecimal", float, False, "value", True), ("valueInteger", "valueInteger", int, False, "value", True), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), ("valueString", "valueString", str, False, "value", True), ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", True), + ("valueUri", "valueUri", str, False, "value", True), ]) return js diff --git a/fhirclient/models/questionnaire_tests.py b/fhirclient/models/questionnaire_tests.py index 9cecededa..8c219bac5 100644 --- a/fhirclient/models/questionnaire_tests.py +++ b/fhirclient/models/questionnaire_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return questionnaire.Questionnaire(js) def testQuestionnaire1(self): - inst = self.instantiate_from("questionnaire-example-bluebook.json") + inst = self.instantiate_from("questionnaire-cqf-example.json") self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") self.implQuestionnaire1(inst) @@ -32,67 +32,99 @@ def testQuestionnaire1(self): self.implQuestionnaire1(inst2) def implQuestionnaire1(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2013-02-19").date) - self.assertEqual(inst.date.as_json(), "2013-02-19") - self.assertEqual(inst.id, "bb") - self.assertEqual(inst.item[0].item[0].item[0].linkId, "nameOfChild") - self.assertEqual(inst.item[0].item[0].item[0].text, "Name of child") - self.assertEqual(inst.item[0].item[0].item[0].type, "string") - self.assertEqual(inst.item[0].item[0].item[1].linkId, "sex") - self.assertEqual(inst.item[0].item[0].item[1].option[0].valueCoding.code, "F") - self.assertEqual(inst.item[0].item[0].item[1].option[1].valueCoding.code, "M") - self.assertEqual(inst.item[0].item[0].item[1].text, "Sex") - self.assertEqual(inst.item[0].item[0].item[1].type, "choice") - self.assertEqual(inst.item[0].item[0].linkId, "group") - self.assertEqual(inst.item[0].item[0].type, "group") - self.assertEqual(inst.item[0].item[1].item[0].linkId, "birthWeight") - self.assertEqual(inst.item[0].item[1].item[0].text, "Birth weight (kg)") - self.assertEqual(inst.item[0].item[1].item[0].type, "decimal") - self.assertEqual(inst.item[0].item[1].item[1].linkId, "birthLength") - self.assertEqual(inst.item[0].item[1].item[1].text, "Birth length (cm)") - self.assertEqual(inst.item[0].item[1].item[1].type, "decimal") - self.assertTrue(inst.item[0].item[1].item[2].item[0].enableWhen[0].hasAnswer) - self.assertEqual(inst.item[0].item[1].item[2].item[0].enableWhen[0].question, "vitaminKgiven") - self.assertEqual(inst.item[0].item[1].item[2].item[0].item[0].linkId, "vitaminiKDose1") - self.assertEqual(inst.item[0].item[1].item[2].item[0].item[0].text, "1st dose") - self.assertEqual(inst.item[0].item[1].item[2].item[0].item[0].type, "dateTime") - self.assertEqual(inst.item[0].item[1].item[2].item[0].item[1].linkId, "vitaminiKDose2") - self.assertEqual(inst.item[0].item[1].item[2].item[0].item[1].text, "2nd dose") - self.assertEqual(inst.item[0].item[1].item[2].item[0].item[1].type, "dateTime") - self.assertEqual(inst.item[0].item[1].item[2].item[0].linkId, "vitaminKgivenDoses") - self.assertEqual(inst.item[0].item[1].item[2].item[0].type, "group") - self.assertEqual(inst.item[0].item[1].item[2].linkId, "vitaminKgiven") - self.assertEqual(inst.item[0].item[1].item[2].option[0].valueCoding.code, "INJECTION") - self.assertEqual(inst.item[0].item[1].item[2].option[1].valueCoding.code, "INTRAVENOUS") - self.assertEqual(inst.item[0].item[1].item[2].option[2].valueCoding.code, "ORAL") - self.assertEqual(inst.item[0].item[1].item[2].text, "Vitamin K given") - self.assertEqual(inst.item[0].item[1].item[2].type, "choice") - self.assertEqual(inst.item[0].item[1].item[3].item[0].linkId, "hepBgivenDate") - self.assertEqual(inst.item[0].item[1].item[3].item[0].text, "Date given") - self.assertEqual(inst.item[0].item[1].item[3].item[0].type, "date") - self.assertEqual(inst.item[0].item[1].item[3].linkId, "hepBgiven") - self.assertEqual(inst.item[0].item[1].item[3].text, "Hep B given y / n") - self.assertEqual(inst.item[0].item[1].item[3].type, "boolean") - self.assertEqual(inst.item[0].item[1].item[4].linkId, "abnormalitiesAtBirth") - self.assertEqual(inst.item[0].item[1].item[4].text, "Abnormalities noted at birth") - self.assertEqual(inst.item[0].item[1].item[4].type, "string") - self.assertEqual(inst.item[0].item[1].linkId, "neonatalInformation") - self.assertEqual(inst.item[0].item[1].text, "Neonatal Information") - self.assertEqual(inst.item[0].item[1].type, "group") - self.assertEqual(inst.item[0].linkId, "birthDetails") - self.assertEqual(inst.item[0].text, "Birth details - To be completed by health professional") - self.assertEqual(inst.item[0].type, "group") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "AU") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.publisher, "New South Wales Department of Health") + self.assertEqual(inst.code[0].code, "44249-1") + self.assertEqual(inst.code[0].display, "PHQ-9 quick depression assessment panel:-:Pt:^Patient:-:Report.PHQ-9") + self.assertEqual(inst.code[0].system, "http://loinc.org") + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/cqf-library") + self.assertEqual(inst.extension[0].valueCanonical, "Library/phq-9-logic") + self.assertEqual(inst.id, "phq-9-questionnaire") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "phq-9") + self.assertEqual(inst.item[0].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[0].code[0].code, "44250-9") + self.assertEqual(inst.item[0].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[0].linkId, "LittleInterest") + self.assertTrue(inst.item[0].required) + self.assertEqual(inst.item[0].text, "Little interest or pleasure in doing things") + self.assertEqual(inst.item[0].type, "choice") + self.assertEqual(inst.item[1].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[1].code[0].code, "44255-8") + self.assertEqual(inst.item[1].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[1].linkId, "FeelingDown") + self.assertTrue(inst.item[1].required) + self.assertEqual(inst.item[1].text, "Feeling down, depressed, or hopeless") + self.assertEqual(inst.item[1].type, "choice") + self.assertEqual(inst.item[2].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[2].code[0].code, "44259-0") + self.assertEqual(inst.item[2].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[2].linkId, "TroubleSleeping") + self.assertTrue(inst.item[2].required) + self.assertEqual(inst.item[2].text, "Trouble falling or staying asleep") + self.assertEqual(inst.item[2].type, "choice") + self.assertEqual(inst.item[3].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[3].code[0].code, "44254-1") + self.assertEqual(inst.item[3].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[3].linkId, "FeelingTired") + self.assertTrue(inst.item[3].required) + self.assertEqual(inst.item[3].text, "Feeling tired or having little energy") + self.assertEqual(inst.item[3].type, "choice") + self.assertEqual(inst.item[4].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[4].code[0].code, "44251-7") + self.assertEqual(inst.item[4].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[4].linkId, "BadAppetite") + self.assertTrue(inst.item[4].required) + self.assertEqual(inst.item[4].text, "Poor appetite or overeating") + self.assertEqual(inst.item[4].type, "choice") + self.assertEqual(inst.item[5].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[5].code[0].code, "44258-2") + self.assertEqual(inst.item[5].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[5].linkId, "FeelingBadAboutSelf") + self.assertTrue(inst.item[5].required) + self.assertEqual(inst.item[5].text, "Feeling bad about yourself - or that you are a failure or have let yourself or your family down") + self.assertEqual(inst.item[5].type, "choice") + self.assertEqual(inst.item[6].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[6].code[0].code, "44252-5") + self.assertEqual(inst.item[6].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[6].linkId, "TroubleConcentrating") + self.assertTrue(inst.item[6].required) + self.assertEqual(inst.item[6].text, "Trouble concentrating on things, such as reading the newspaper or watching television") + self.assertEqual(inst.item[6].type, "choice") + self.assertEqual(inst.item[7].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[7].code[0].code, "44253-3") + self.assertEqual(inst.item[7].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[7].linkId, "MovingSpeaking") + self.assertTrue(inst.item[7].required) + self.assertEqual(inst.item[7].text, "Moving or speaking so slowly that other people could have noticed. Or the opposite - being so fidgety or restless that you have been moving around a lot more than usual") + self.assertEqual(inst.item[7].type, "choice") + self.assertEqual(inst.item[8].code[0].code, "44261-6") + self.assertEqual(inst.item[8].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[8].extension[0].url, "http://hl7.org/fhir/StructureDefinition/cqf-expression") + self.assertEqual(inst.item[8].extension[0].valueExpression.expression, "CalculateTotalScore") + self.assertEqual(inst.item[8].extension[0].valueExpression.language, "text/cql") + self.assertEqual(inst.item[8].linkId, "TotalScore") + self.assertTrue(inst.item[8].required) + self.assertEqual(inst.item[8].text, "Total score") + self.assertEqual(inst.item[8].type, "integer") + self.assertEqual(inst.item[9].answerValueSet, "http://loinc.org/vs/LL358-3") + self.assertEqual(inst.item[9].code[0].code, "44256-6") + self.assertEqual(inst.item[9].code[0].system, "http://loinc.org") + self.assertEqual(inst.item[9].linkId, "Difficulty") + self.assertTrue(inst.item[9].required) + self.assertEqual(inst.item[9].text, "If you checked off any problems, how difficult have these problems made it for you to do your work, take care of things at home, or get along with other people") + self.assertEqual(inst.item[9].type, "choice") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/cqf-questionnaire") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "draft") self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.div, "
PHQ-9 Questionnaire with dynamic logic
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "NSW Government My Personal Health Record") - self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/bb") + self.assertEqual(inst.title, "Patient Health Questionnaire (PHQ-9)") + self.assertEqual(inst.version, "1.0.0") def testQuestionnaire2(self): - inst = self.instantiate_from("questionnaire-example-f201-lifelines.json") + inst = self.instantiate_from("questionnaire-example.json") self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") self.implQuestionnaire2(inst) @@ -102,6 +134,86 @@ def testQuestionnaire2(self): self.implQuestionnaire2(inst2) def implQuestionnaire2(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2012-01").date) + self.assertEqual(inst.date.as_json(), "2012-01") + self.assertEqual(inst.id, "3141") + self.assertEqual(inst.item[0].code[0].code, "COMORBIDITY") + self.assertEqual(inst.item[0].code[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.item[0].item[0].answerValueSet, "http://hl7.org/fhir/ValueSet/yesnodontknow") + self.assertEqual(inst.item[0].item[0].code[0].code, "COMORB") + self.assertEqual(inst.item[0].item[0].code[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.item[0].item[0].item[0].code[0].code, "CARDIAL") + self.assertEqual(inst.item[0].item[0].item[0].code[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.item[0].item[0].item[0].enableWhen[0].answerCoding.code, "Y") + self.assertEqual(inst.item[0].item[0].item[0].enableWhen[0].answerCoding.system, "http://terminology.hl7.org/CodeSystem/v2-0136") + self.assertEqual(inst.item[0].item[0].item[0].enableWhen[0].operator, "=") + self.assertEqual(inst.item[0].item[0].item[0].enableWhen[0].question, "1.1") + self.assertEqual(inst.item[0].item[0].item[0].item[0].answerValueSet, "http://hl7.org/fhir/ValueSet/yesnodontknow") + self.assertEqual(inst.item[0].item[0].item[0].item[0].code[0].code, "COMORBCAR") + self.assertEqual(inst.item[0].item[0].item[0].item[0].code[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].answerValueSet, "http://hl7.org/fhir/ValueSet/yesnodontknow") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[0].code, "COMCAR00") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[0].display, "Angina Pectoris") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[1].code, "194828000") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[1].display, "Angina (disorder)") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[1].system, "http://snomed.info/sct") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].linkId, "1.1.1.1.1") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].prefix, "1.1.1") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].type, "choice") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].answerValueSet, "http://hl7.org/fhir/ValueSet/yesnodontknow") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].code[0].code, "22298006") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].code[0].display, "Myocardial infarction (disorder)") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].code[0].system, "http://snomed.info/sct") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].linkId, "1.1.1.1.2") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].prefix, "1.1.2") + self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].type, "choice") + self.assertEqual(inst.item[0].item[0].item[0].item[0].linkId, "1.1.1.1") + self.assertEqual(inst.item[0].item[0].item[0].item[0].prefix, "1.1") + self.assertEqual(inst.item[0].item[0].item[0].item[0].type, "choice") + self.assertEqual(inst.item[0].item[0].item[0].item[1].answerValueSet, "http://hl7.org/fhir/ValueSet/yesnodontknow") + self.assertEqual(inst.item[0].item[0].item[0].item[1].code[0].code, "COMORBVAS") + self.assertEqual(inst.item[0].item[0].item[0].item[1].code[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.item[0].item[0].item[0].item[1].linkId, "1.1.1.2") + self.assertEqual(inst.item[0].item[0].item[0].item[1].prefix, "1.2") + self.assertEqual(inst.item[0].item[0].item[0].item[1].type, "choice") + self.assertEqual(inst.item[0].item[0].item[0].linkId, "1.1.1") + self.assertEqual(inst.item[0].item[0].item[0].type, "group") + self.assertEqual(inst.item[0].item[0].linkId, "1.1") + self.assertEqual(inst.item[0].item[0].prefix, "1") + self.assertEqual(inst.item[0].item[0].type, "choice") + self.assertEqual(inst.item[0].linkId, "1") + self.assertEqual(inst.item[0].type, "group") + self.assertEqual(inst.item[1].code[0].code, "HISTOPATHOLOGY") + self.assertEqual(inst.item[1].code[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.item[1].item[0].code[0].code, "ABDOMINAL") + self.assertEqual(inst.item[1].item[0].code[0].system, "http://example.org/system/code/sections") + self.assertEqual(inst.item[1].item[0].item[0].code[0].code, "STADPT") + self.assertEqual(inst.item[1].item[0].item[0].code[0].display, "pT category") + self.assertEqual(inst.item[1].item[0].item[0].code[0].system, "http://example.org/system/code/questions") + self.assertEqual(inst.item[1].item[0].item[0].linkId, "2.1.2") + self.assertEqual(inst.item[1].item[0].item[0].type, "choice") + self.assertEqual(inst.item[1].item[0].linkId, "2.1") + self.assertEqual(inst.item[1].item[0].type, "group") + self.assertEqual(inst.item[1].linkId, "2") + self.assertEqual(inst.item[1].type, "group") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.subjectType[0], "Patient") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Cancer Quality Forum Questionnaire 2012") + self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/3141") + + def testQuestionnaire3(self): + inst = self.instantiate_from("questionnaire-example-f201-lifelines.json") + self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") + self.implQuestionnaire3(inst) + + js = inst.as_json() + self.assertEqual("Questionnaire", js["resourceType"]) + inst2 = questionnaire.Questionnaire(js) + self.implQuestionnaire3(inst2) + + def implQuestionnaire3(self, inst): self.assertEqual(inst.code[0].code, "VL 1-1, 18-65_1.2.2") self.assertEqual(inst.code[0].display, "Lifelines Questionnaire 1 part 1") self.assertEqual(inst.code[0].system, "http://example.org/system/code/lifelines/nl") @@ -140,17 +252,17 @@ def implQuestionnaire2(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/f201") - def testQuestionnaire3(self): + def testQuestionnaire4(self): inst = self.instantiate_from("questionnaire-example-gcs.json") self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") - self.implQuestionnaire3(inst) + self.implQuestionnaire4(inst) js = inst.as_json() self.assertEqual("Questionnaire", js["resourceType"]) inst2 = questionnaire.Questionnaire(js) - self.implQuestionnaire3(inst2) + self.implQuestionnaire4(inst2) - def implQuestionnaire3(self, inst): + def implQuestionnaire4(self, inst): self.assertEqual(inst.code[0].code, "9269-2") self.assertEqual(inst.code[0].system, "http://loinc.org") self.assertEqual(inst.contained[0].id, "motor") @@ -159,14 +271,17 @@ def implQuestionnaire3(self, inst): self.assertEqual(inst.date.date, FHIRDate("2015-08-03").date) self.assertEqual(inst.date.as_json(), "2015-08-03") self.assertEqual(inst.id, "gcs") + self.assertEqual(inst.item[0].answerValueSet, "#verbal") self.assertEqual(inst.item[0].code[0].code, "9270-0") self.assertEqual(inst.item[0].code[0].system, "http://loinc.org") self.assertEqual(inst.item[0].linkId, "1.1") self.assertEqual(inst.item[0].type, "choice") + self.assertEqual(inst.item[1].answerValueSet, "#motor") self.assertEqual(inst.item[1].code[0].code, "9268-4") self.assertEqual(inst.item[1].code[0].system, "http://loinc.org") self.assertEqual(inst.item[1].linkId, "1.2") self.assertEqual(inst.item[1].type, "choice") + self.assertEqual(inst.item[2].answerValueSet, "#eye") self.assertEqual(inst.item[2].code[0].code, "9267-6") self.assertEqual(inst.item[2].code[0].system, "http://loinc.org") self.assertEqual(inst.item[2].linkId, "1.3") @@ -178,77 +293,74 @@ def implQuestionnaire3(self, inst): self.assertEqual(inst.title, "Glasgow Coma Score") self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/gcs") - def testQuestionnaire4(self): - inst = self.instantiate_from("questionnaire-example.json") + def testQuestionnaire5(self): + inst = self.instantiate_from("questionnaire-example-bluebook.json") self.assertIsNotNone(inst, "Must have instantiated a Questionnaire instance") - self.implQuestionnaire4(inst) + self.implQuestionnaire5(inst) js = inst.as_json() self.assertEqual("Questionnaire", js["resourceType"]) inst2 = questionnaire.Questionnaire(js) - self.implQuestionnaire4(inst2) + self.implQuestionnaire5(inst2) - def implQuestionnaire4(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2012-01").date) - self.assertEqual(inst.date.as_json(), "2012-01") - self.assertEqual(inst.id, "3141") - self.assertEqual(inst.item[0].code[0].code, "COMORBIDITY") - self.assertEqual(inst.item[0].code[0].system, "http://example.org/system/code/sections") - self.assertEqual(inst.item[0].item[0].code[0].code, "COMORB") - self.assertEqual(inst.item[0].item[0].code[0].system, "http://example.org/system/code/questions") - self.assertEqual(inst.item[0].item[0].item[0].code[0].code, "CARDIAL") - self.assertEqual(inst.item[0].item[0].item[0].code[0].system, "http://example.org/system/code/sections") - self.assertEqual(inst.item[0].item[0].item[0].enableWhen[0].answerCoding.code, "Y") - self.assertEqual(inst.item[0].item[0].item[0].enableWhen[0].answerCoding.system, "http://hl7.org/fhir/v2/0136") - self.assertEqual(inst.item[0].item[0].item[0].enableWhen[0].question, "1.1") - self.assertEqual(inst.item[0].item[0].item[0].item[0].code[0].code, "COMORBCAR") - self.assertEqual(inst.item[0].item[0].item[0].item[0].code[0].system, "http://example.org/system/code/questions") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[0].code, "COMCAR00") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[0].display, "Angina Pectoris") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[0].system, "http://example.org/system/code/questions") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[1].code, "194828000") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[1].display, "Angina (disorder)") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].code[1].system, "http://snomed.info/sct") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].linkId, "1.1.1.1.1") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].prefix, "1.1.1") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[0].type, "choice") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].code[0].code, "22298006") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].code[0].display, "Myocardial infarction (disorder)") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].code[0].system, "http://snomed.info/sct") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].linkId, "1.1.1.1.2") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].prefix, "1.1.2") - self.assertEqual(inst.item[0].item[0].item[0].item[0].item[1].type, "choice") - self.assertEqual(inst.item[0].item[0].item[0].item[0].linkId, "1.1.1.1") - self.assertEqual(inst.item[0].item[0].item[0].item[0].prefix, "1.1") - self.assertEqual(inst.item[0].item[0].item[0].item[0].type, "choice") - self.assertEqual(inst.item[0].item[0].item[0].item[1].code[0].code, "COMORBVAS") - self.assertEqual(inst.item[0].item[0].item[0].item[1].code[0].system, "http://example.org/system/code/questions") - self.assertEqual(inst.item[0].item[0].item[0].item[1].linkId, "1.1.1.2") - self.assertEqual(inst.item[0].item[0].item[0].item[1].prefix, "1.2") - self.assertEqual(inst.item[0].item[0].item[0].item[1].type, "choice") - self.assertEqual(inst.item[0].item[0].item[0].linkId, "1.1.1") - self.assertEqual(inst.item[0].item[0].item[0].type, "group") - self.assertEqual(inst.item[0].item[0].linkId, "1.1") - self.assertEqual(inst.item[0].item[0].prefix, "1") - self.assertEqual(inst.item[0].item[0].type, "choice") - self.assertEqual(inst.item[0].linkId, "1") + def implQuestionnaire5(self, inst): + self.assertEqual(inst.date.date, FHIRDate("2013-02-19").date) + self.assertEqual(inst.date.as_json(), "2013-02-19") + self.assertEqual(inst.id, "bb") + self.assertEqual(inst.item[0].item[0].item[0].linkId, "nameOfChild") + self.assertEqual(inst.item[0].item[0].item[0].text, "Name of child") + self.assertEqual(inst.item[0].item[0].item[0].type, "string") + self.assertEqual(inst.item[0].item[0].item[1].answerOption[0].valueCoding.code, "F") + self.assertEqual(inst.item[0].item[0].item[1].answerOption[1].valueCoding.code, "M") + self.assertEqual(inst.item[0].item[0].item[1].linkId, "sex") + self.assertEqual(inst.item[0].item[0].item[1].text, "Sex") + self.assertEqual(inst.item[0].item[0].item[1].type, "choice") + self.assertEqual(inst.item[0].item[0].linkId, "group") + self.assertEqual(inst.item[0].item[0].type, "group") + self.assertEqual(inst.item[0].item[1].item[0].linkId, "birthWeight") + self.assertEqual(inst.item[0].item[1].item[0].text, "Birth weight (kg)") + self.assertEqual(inst.item[0].item[1].item[0].type, "decimal") + self.assertEqual(inst.item[0].item[1].item[1].linkId, "birthLength") + self.assertEqual(inst.item[0].item[1].item[1].text, "Birth length (cm)") + self.assertEqual(inst.item[0].item[1].item[1].type, "decimal") + self.assertEqual(inst.item[0].item[1].item[2].answerOption[0].valueCoding.code, "INJECTION") + self.assertEqual(inst.item[0].item[1].item[2].answerOption[1].valueCoding.code, "INTRAVENOUS") + self.assertEqual(inst.item[0].item[1].item[2].answerOption[2].valueCoding.code, "ORAL") + self.assertTrue(inst.item[0].item[1].item[2].item[0].enableWhen[0].answerBoolean) + self.assertEqual(inst.item[0].item[1].item[2].item[0].enableWhen[0].operator, "exists") + self.assertEqual(inst.item[0].item[1].item[2].item[0].enableWhen[0].question, "vitaminKgiven") + self.assertEqual(inst.item[0].item[1].item[2].item[0].item[0].linkId, "vitaminiKDose1") + self.assertEqual(inst.item[0].item[1].item[2].item[0].item[0].text, "1st dose") + self.assertEqual(inst.item[0].item[1].item[2].item[0].item[0].type, "dateTime") + self.assertEqual(inst.item[0].item[1].item[2].item[0].item[1].linkId, "vitaminiKDose2") + self.assertEqual(inst.item[0].item[1].item[2].item[0].item[1].text, "2nd dose") + self.assertEqual(inst.item[0].item[1].item[2].item[0].item[1].type, "dateTime") + self.assertEqual(inst.item[0].item[1].item[2].item[0].linkId, "vitaminKgivenDoses") + self.assertEqual(inst.item[0].item[1].item[2].item[0].type, "group") + self.assertEqual(inst.item[0].item[1].item[2].linkId, "vitaminKgiven") + self.assertEqual(inst.item[0].item[1].item[2].text, "Vitamin K given") + self.assertEqual(inst.item[0].item[1].item[2].type, "choice") + self.assertEqual(inst.item[0].item[1].item[3].item[0].linkId, "hepBgivenDate") + self.assertEqual(inst.item[0].item[1].item[3].item[0].text, "Date given") + self.assertEqual(inst.item[0].item[1].item[3].item[0].type, "date") + self.assertEqual(inst.item[0].item[1].item[3].linkId, "hepBgiven") + self.assertEqual(inst.item[0].item[1].item[3].text, "Hep B given y / n") + self.assertEqual(inst.item[0].item[1].item[3].type, "boolean") + self.assertEqual(inst.item[0].item[1].item[4].linkId, "abnormalitiesAtBirth") + self.assertEqual(inst.item[0].item[1].item[4].text, "Abnormalities noted at birth") + self.assertEqual(inst.item[0].item[1].item[4].type, "string") + self.assertEqual(inst.item[0].item[1].linkId, "neonatalInformation") + self.assertEqual(inst.item[0].item[1].text, "Neonatal Information") + self.assertEqual(inst.item[0].item[1].type, "group") + self.assertEqual(inst.item[0].linkId, "birthDetails") + self.assertEqual(inst.item[0].text, "Birth details - To be completed by health professional") self.assertEqual(inst.item[0].type, "group") - self.assertEqual(inst.item[1].code[0].code, "HISTOPATHOLOGY") - self.assertEqual(inst.item[1].code[0].system, "http://example.org/system/code/sections") - self.assertEqual(inst.item[1].item[0].code[0].code, "ABDOMINAL") - self.assertEqual(inst.item[1].item[0].code[0].system, "http://example.org/system/code/sections") - self.assertEqual(inst.item[1].item[0].item[0].code[0].code, "STADPT") - self.assertEqual(inst.item[1].item[0].item[0].code[0].display, "pT category") - self.assertEqual(inst.item[1].item[0].item[0].code[0].system, "http://example.org/system/code/questions") - self.assertEqual(inst.item[1].item[0].item[0].linkId, "2.1.2") - self.assertEqual(inst.item[1].item[0].item[0].type, "choice") - self.assertEqual(inst.item[1].item[0].linkId, "2.1") - self.assertEqual(inst.item[1].item[0].type, "group") - self.assertEqual(inst.item[1].linkId, "2") - self.assertEqual(inst.item[1].type, "group") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "AU") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.publisher, "New South Wales Department of Health") self.assertEqual(inst.status, "draft") self.assertEqual(inst.subjectType[0], "Patient") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Cancer Quality Forum Questionnaire 2012") - self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/3141") + self.assertEqual(inst.title, "NSW Government My Personal Health Record") + self.assertEqual(inst.url, "http://hl7.org/fhir/Questionnaire/bb") diff --git a/fhirclient/models/questionnaireresponse.py b/fhirclient/models/questionnaireresponse.py index 19131e942..dad6d42cf 100644 --- a/fhirclient/models/questionnaireresponse.py +++ b/fhirclient/models/questionnaireresponse.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,7 +27,7 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ Person who received and recorded the answers. - Type `FHIRReference` referencing `Device, Practitioner, Patient, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.authored = None """ Date the answers were gathered. @@ -35,11 +35,11 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Request fulfilled by this QuestionnaireResponse. - List of `FHIRReference` items referencing `ReferralRequest, CarePlan, ProcedureRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.context = None - """ Encounter or Episode during which questionnaire was completed. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.encounter = None + """ Encounter created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ Unique id for this set of answers. @@ -49,17 +49,17 @@ def __init__(self, jsondict=None, strict=True): """ Groups and questions. List of `QuestionnaireResponseItem` items (represented as `dict` in JSON). """ - self.parent = None + self.partOf = None """ Part of this action. - List of `FHIRReference` items referencing `Observation, Procedure` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.questionnaire = None """ Form being answered. - Type `FHIRReference` referencing `Questionnaire` (represented as `dict` in JSON). """ + Type `str`. """ self.source = None """ The person who answered the questions. - Type `FHIRReference` referencing `Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ in-progress | completed | amended | entered-in-error | stopped. @@ -67,7 +67,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ The subject of the questions. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(QuestionnaireResponse, self).__init__(jsondict=jsondict, strict=strict) @@ -77,11 +77,11 @@ def elementProperties(self): ("author", "author", fhirreference.FHIRReference, False, None, False), ("authored", "authored", fhirdate.FHIRDate, False, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, False, None, False), ("item", "item", QuestionnaireResponseItem, True, None, False), - ("parent", "parent", fhirreference.FHIRReference, True, None, False), - ("questionnaire", "questionnaire", fhirreference.FHIRReference, False, None, False), + ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), + ("questionnaire", "questionnaire", str, False, None, False), ("source", "source", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, True), ("subject", "subject", fhirreference.FHIRReference, False, None, False), @@ -124,10 +124,6 @@ def __init__(self, jsondict=None, strict=True): """ Pointer to specific item from Questionnaire. Type `str`. """ - self.subject = None - """ The subject this group's answers are about. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - self.text = None """ Name for group or question text. Type `str`. """ @@ -141,7 +137,6 @@ def elementProperties(self): ("definition", "definition", str, False, None, False), ("item", "item", QuestionnaireResponseItem, True, None, False), ("linkId", "linkId", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), ("text", "text", str, False, None, False), ]) return js @@ -201,7 +196,7 @@ def __init__(self, jsondict=None, strict=True): self.valueReference = None """ Single-valued answer to the question. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.valueString = None """ Single-valued answer to the question. diff --git a/fhirclient/models/questionnaireresponse_tests.py b/fhirclient/models/questionnaireresponse_tests.py index a327eb154..6e63238de 100644 --- a/fhirclient/models/questionnaireresponse_tests.py +++ b/fhirclient/models/questionnaireresponse_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return questionnaireresponse.QuestionnaireResponse(js) def testQuestionnaireResponse1(self): - inst = self.instantiate_from("questionnaireresponse-example-bluebook.json") + inst = self.instantiate_from("questionnaireresponse-example.json") self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") self.implQuestionnaireResponse1(inst) @@ -32,53 +32,37 @@ def testQuestionnaireResponse1(self): self.implQuestionnaireResponse1(inst2) def implQuestionnaireResponse1(self, inst): - self.assertEqual(inst.authored.date, FHIRDate("2013-02-19T14:15:00+10:00").date) - self.assertEqual(inst.authored.as_json(), "2013-02-19T14:15:00+10:00") - self.assertEqual(inst.id, "bb") - self.assertEqual(inst.item[0].item[0].item[0].answer[0].valueString, "Cathy Jones") - self.assertEqual(inst.item[0].item[0].item[0].linkId, "nameOfChild") - self.assertEqual(inst.item[0].item[0].item[0].text, "Name of child") - self.assertEqual(inst.item[0].item[0].item[1].answer[0].valueCoding.code, "f") - self.assertEqual(inst.item[0].item[0].item[1].linkId, "sex") - self.assertEqual(inst.item[0].item[0].item[1].text, "Sex") - self.assertEqual(inst.item[0].item[0].linkId, "group") - self.assertEqual(inst.item[0].item[1].item[0].answer[0].valueDecimal, 3.25) - self.assertEqual(inst.item[0].item[1].item[0].linkId, "birthWeight") - self.assertEqual(inst.item[0].item[1].item[0].text, "Birth weight (kg)") - self.assertEqual(inst.item[0].item[1].item[1].answer[0].valueDecimal, 44.3) - self.assertEqual(inst.item[0].item[1].item[1].linkId, "birthLength") - self.assertEqual(inst.item[0].item[1].item[1].text, "Birth length (cm)") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].answer[0].valueDate.date, FHIRDate("1972-11-30").date) - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].answer[0].valueDate.as_json(), "1972-11-30") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].linkId, "vitaminKDose1") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].text, "1st dose") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].answer[0].valueDate.date, FHIRDate("1972-12-11").date) - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].answer[0].valueDate.as_json(), "1972-12-11") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].linkId, "vitaminKDose2") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].text, "2nd dose") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].linkId, "vitaminKgivenDoses") - self.assertEqual(inst.item[0].item[1].item[2].answer[0].valueCoding.code, "INJECTION") - self.assertEqual(inst.item[0].item[1].item[2].linkId, "vitaminKgiven") - self.assertEqual(inst.item[0].item[1].item[2].text, "Vitamin K given") - self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].answer[0].valueDate.date, FHIRDate("1972-12-04").date) - self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].answer[0].valueDate.as_json(), "1972-12-04") - self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].linkId, "hepBgivenDate") - self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].text, "Date given") - self.assertTrue(inst.item[0].item[1].item[3].answer[0].valueBoolean) - self.assertEqual(inst.item[0].item[1].item[3].linkId, "hepBgiven") - self.assertEqual(inst.item[0].item[1].item[3].text, "Hep B given y / n") - self.assertEqual(inst.item[0].item[1].item[4].answer[0].valueString, "Already able to speak Chinese") - self.assertEqual(inst.item[0].item[1].item[4].linkId, "abnormalitiesAtBirth") - self.assertEqual(inst.item[0].item[1].item[4].text, "Abnormalities noted at birth") - self.assertEqual(inst.item[0].item[1].linkId, "neonatalInformation") - self.assertEqual(inst.item[0].item[1].text, "Neonatal Information") - self.assertEqual(inst.item[0].linkId, "birthDetails") - self.assertEqual(inst.item[0].text, "Birth details - To be completed by health professional") + self.assertEqual(inst.authored.date, FHIRDate("2013-02-19T14:15:00-05:00").date) + self.assertEqual(inst.authored.as_json(), "2013-02-19T14:15:00-05:00") + self.assertEqual(inst.contained[0].id, "patsub") + self.assertEqual(inst.contained[1].id, "order") + self.assertEqual(inst.contained[2].id, "questauth") + self.assertEqual(inst.id, "3141") + self.assertEqual(inst.identifier.system, "http://example.org/fhir/NamingSystem/questionnaire-ids") + self.assertEqual(inst.identifier.value, "Q12349876") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[0].answer[0].valueCoding.code, "1") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[0].linkId, "1.1.1.1") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[1].answer[0].valueCoding.code, "1") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[1].linkId, "1.1.1.2") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[2].answer[0].valueCoding.code, "0") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[2].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[2].linkId, "1.1.1.3") + self.assertEqual(inst.item[0].item[0].answer[0].item[0].linkId, "1.1.1") + self.assertEqual(inst.item[0].item[0].answer[0].valueCoding.code, "1") + self.assertEqual(inst.item[0].item[0].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[0].item[0].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") + self.assertEqual(inst.item[0].item[0].linkId, "1.1") + self.assertEqual(inst.item[0].linkId, "1") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") def testQuestionnaireResponse2(self): - inst = self.instantiate_from("questionnaireresponse-example-f201-lifelines.json") + inst = self.instantiate_from("questionnaireresponse-example-ussg-fht-answers.json") self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") self.implQuestionnaireResponse2(inst) @@ -88,85 +72,6 @@ def testQuestionnaireResponse2(self): self.implQuestionnaireResponse2(inst2) def implQuestionnaireResponse2(self, inst): - self.assertEqual(inst.authored.date, FHIRDate("2013-06-18T00:00:00+01:00").date) - self.assertEqual(inst.authored.as_json(), "2013-06-18T00:00:00+01:00") - self.assertEqual(inst.id, "f201") - self.assertEqual(inst.item[0].item[0].answer[0].valueString, "I am allergic to house dust") - self.assertEqual(inst.item[0].item[0].linkId, "1.1") - self.assertEqual(inst.item[0].item[0].text, "Do you have allergies?") - self.assertEqual(inst.item[0].linkId, "1") - self.assertEqual(inst.item[1].item[0].answer[0].valueString, "Male") - self.assertEqual(inst.item[1].item[0].linkId, "2.1") - self.assertEqual(inst.item[1].item[0].text, "What is your gender?") - self.assertEqual(inst.item[1].item[1].answer[0].valueDate.date, FHIRDate("1960-03-13").date) - self.assertEqual(inst.item[1].item[1].answer[0].valueDate.as_json(), "1960-03-13") - self.assertEqual(inst.item[1].item[1].linkId, "2.2") - self.assertEqual(inst.item[1].item[1].text, "What is your date of birth?") - self.assertEqual(inst.item[1].item[2].answer[0].valueString, "The Netherlands") - self.assertEqual(inst.item[1].item[2].linkId, "2.3") - self.assertEqual(inst.item[1].item[2].text, "What is your country of birth?") - self.assertEqual(inst.item[1].item[3].answer[0].valueString, "married") - self.assertEqual(inst.item[1].item[3].linkId, "2.4") - self.assertEqual(inst.item[1].item[3].text, "What is your marital status?") - self.assertEqual(inst.item[1].linkId, "2") - self.assertEqual(inst.item[1].text, "General questions") - self.assertEqual(inst.item[2].item[0].answer[0].valueString, "No") - self.assertEqual(inst.item[2].item[0].linkId, "3.1") - self.assertEqual(inst.item[2].item[0].text, "Do you smoke?") - self.assertEqual(inst.item[2].item[1].answer[0].valueString, "No, but I used to drink") - self.assertEqual(inst.item[2].item[1].linkId, "3.2") - self.assertEqual(inst.item[2].item[1].text, "Do you drink alchohol?") - self.assertEqual(inst.item[2].linkId, "3") - self.assertEqual(inst.item[2].text, "Intoxications") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testQuestionnaireResponse3(self): - inst = self.instantiate_from("questionnaireresponse-example-gcs.json") - self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") - self.implQuestionnaireResponse3(inst) - - js = inst.as_json() - self.assertEqual("QuestionnaireResponse", js["resourceType"]) - inst2 = questionnaireresponse.QuestionnaireResponse(js) - self.implQuestionnaireResponse3(inst2) - - def implQuestionnaireResponse3(self, inst): - self.assertEqual(inst.authored.date, FHIRDate("2014-12-11T04:44:16Z").date) - self.assertEqual(inst.authored.as_json(), "2014-12-11T04:44:16Z") - self.assertEqual(inst.id, "gcs") - self.assertEqual(inst.item[0].answer[0].valueCoding.code, "LA6560-2") - self.assertEqual(inst.item[0].answer[0].valueCoding.display, "Confused") - self.assertEqual(inst.item[0].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.item[0].answer[0].valueCoding.extension[0].valueDecimal, 4) - self.assertEqual(inst.item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[0].linkId, "1.1") - self.assertEqual(inst.item[1].answer[0].valueCoding.code, "LA6566-9") - self.assertEqual(inst.item[1].answer[0].valueCoding.display, "Localizing pain") - self.assertEqual(inst.item[1].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.item[1].answer[0].valueCoding.extension[0].valueDecimal, 5) - self.assertEqual(inst.item[1].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[1].linkId, "1.2") - self.assertEqual(inst.item[2].answer[0].valueCoding.code, "LA6556-0") - self.assertEqual(inst.item[2].answer[0].valueCoding.display, "Eyes open spontaneously") - self.assertEqual(inst.item[2].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - self.assertEqual(inst.item[2].answer[0].valueCoding.extension[0].valueDecimal, 4) - self.assertEqual(inst.item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].linkId, "1.3") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.text.status, "generated") - - def testQuestionnaireResponse4(self): - inst = self.instantiate_from("questionnaireresponse-example-ussg-fht-answers.json") - self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") - self.implQuestionnaireResponse4(inst) - - js = inst.as_json() - self.assertEqual("QuestionnaireResponse", js["resourceType"]) - inst2 = questionnaireresponse.QuestionnaireResponse(js) - self.implQuestionnaireResponse4(inst2) - - def implQuestionnaireResponse4(self, inst): self.assertEqual(inst.authored.date, FHIRDate("2008-01-17").date) self.assertEqual(inst.authored.as_json(), "2008-01-17") self.assertEqual(inst.id, "ussg-fht-answers") @@ -219,7 +124,7 @@ def implQuestionnaireResponse4(self, inst): self.assertEqual(inst.item[1].item[0].item[6].definition, "http://loinc.org/fhir/DataElement/8302-2") self.assertEqual(inst.item[1].item[0].item[6].linkId, "1.1.7") self.assertEqual(inst.item[1].item[0].item[6].text, "Height") - self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].answer[0].valueCoding.code, "lb") + self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].answer[0].valueCoding.code, "[lb_av]") self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].answer[0].valueCoding.display, "pounds") self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://unitsofmeasure.org") self.assertEqual(inst.item[1].item[0].item[7].answer[0].item[0].item[0].linkId, "1.1.8.1.1") @@ -243,46 +148,45 @@ def implQuestionnaireResponse4(self, inst): self.assertEqual(inst.item[1].linkId, "1") self.assertEqual(inst.item[1].text, "Your health information") self.assertEqual(inst.item[2].definition, "http://loinc.org/fhir/DataElement/54114-4") - self.assertEqual(inst.item[2].item[0].item[0].item[0].answer[0].valueCoding.code, "LA10405-1") - self.assertEqual(inst.item[2].item[0].item[0].item[0].answer[0].valueCoding.display, "Daughter") - self.assertEqual(inst.item[2].item[0].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") - self.assertEqual(inst.item[2].item[0].item[0].item[0].linkId, "2.1.1.1") - self.assertEqual(inst.item[2].item[0].item[0].item[0].text, "Relationship to you") - self.assertEqual(inst.item[2].item[0].item[0].item[1].answer[0].valueString, "Susan") - self.assertEqual(inst.item[2].item[0].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") - self.assertEqual(inst.item[2].item[0].item[0].item[1].linkId, "2.1.1.2") - self.assertEqual(inst.item[2].item[0].item[0].item[1].text, "Name") - self.assertEqual(inst.item[2].item[0].item[0].item[2].answer[0].valueCoding.code, "LA3-6") - self.assertEqual(inst.item[2].item[0].item[0].item[2].answer[0].valueCoding.display, "Female") - self.assertEqual(inst.item[2].item[0].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[0].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") - self.assertEqual(inst.item[2].item[0].item[0].item[2].linkId, "2.1.1.3") - self.assertEqual(inst.item[2].item[0].item[0].item[2].text, "Gender") - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 17) - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].item[0].item[0].text, "Age") - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].valueCoding.code, "LA33-6") - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[2].item[0].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[0].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") - self.assertEqual(inst.item[2].item[0].item[0].item[3].linkId, "2.1.1.4") - self.assertEqual(inst.item[2].item[0].item[0].item[3].text, "Living?") - self.assertEqual(inst.item[2].item[0].item[0].item[4].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[0].item[0].item[4].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[0].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[0].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") - self.assertEqual(inst.item[2].item[0].item[0].item[4].linkId, "2.1.1.5") - self.assertEqual(inst.item[2].item[0].item[0].item[4].text, "Was this person born a twin?") - self.assertEqual(inst.item[2].item[0].item[0].item[5].answer[0].valueCoding.code, "LA32-8") - self.assertEqual(inst.item[2].item[0].item[0].item[5].answer[0].valueCoding.display, "No") - self.assertEqual(inst.item[2].item[0].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") - self.assertEqual(inst.item[2].item[0].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") - self.assertEqual(inst.item[2].item[0].item[0].item[5].linkId, "2.1.1.6") - self.assertEqual(inst.item[2].item[0].item[0].item[5].text, "Was this person adopted?") - self.assertEqual(inst.item[2].item[0].item[0].linkId, "2.1.1") + self.assertEqual(inst.item[2].item[0].item[0].answer[0].valueCoding.code, "LA10405-1") + self.assertEqual(inst.item[2].item[0].item[0].answer[0].valueCoding.display, "Daughter") + self.assertEqual(inst.item[2].item[0].item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54136-7") + self.assertEqual(inst.item[2].item[0].item[0].linkId, "2.1.1.1") + self.assertEqual(inst.item[2].item[0].item[0].text, "Relationship to you") + self.assertEqual(inst.item[2].item[0].item[1].answer[0].valueString, "Susan") + self.assertEqual(inst.item[2].item[0].item[1].definition, "http://loinc.org/fhir/DataElement/54138-3") + self.assertEqual(inst.item[2].item[0].item[1].linkId, "2.1.1.2") + self.assertEqual(inst.item[2].item[0].item[1].text, "Name") + self.assertEqual(inst.item[2].item[0].item[2].answer[0].valueCoding.code, "LA3-6") + self.assertEqual(inst.item[2].item[0].item[2].answer[0].valueCoding.display, "Female") + self.assertEqual(inst.item[2].item[0].item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[0].item[2].definition, "http://loinc.org/fhir/DataElement/54123-5") + self.assertEqual(inst.item[2].item[0].item[2].linkId, "2.1.1.3") + self.assertEqual(inst.item[2].item[0].item[2].text, "Gender") + self.assertEqual(inst.item[2].item[0].item[3].answer[0].item[0].item[0].answer[0].valueDecimal, 17) + self.assertEqual(inst.item[2].item[0].item[3].answer[0].item[0].item[0].definition, "http://loinc.org/fhir/DataElement/54141-7") + self.assertEqual(inst.item[2].item[0].item[3].answer[0].item[0].item[0].linkId, "2.1.1.4.2.2") + self.assertEqual(inst.item[2].item[0].item[3].answer[0].item[0].item[0].text, "Age") + self.assertEqual(inst.item[2].item[0].item[3].answer[0].item[0].linkId, "2.1.1.4.2") + self.assertEqual(inst.item[2].item[0].item[3].answer[0].valueCoding.code, "LA33-6") + self.assertEqual(inst.item[2].item[0].item[3].answer[0].valueCoding.display, "Yes") + self.assertEqual(inst.item[2].item[0].item[3].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[0].item[3].definition, "http://loinc.org/fhir/DataElement/54139-1") + self.assertEqual(inst.item[2].item[0].item[3].linkId, "2.1.1.4") + self.assertEqual(inst.item[2].item[0].item[3].text, "Living?") + self.assertEqual(inst.item[2].item[0].item[4].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[0].item[4].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[0].item[4].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[0].item[4].definition, "http://loinc.org/fhir/DataElement/54121-9") + self.assertEqual(inst.item[2].item[0].item[4].linkId, "2.1.1.5") + self.assertEqual(inst.item[2].item[0].item[4].text, "Was this person born a twin?") + self.assertEqual(inst.item[2].item[0].item[5].answer[0].valueCoding.code, "LA32-8") + self.assertEqual(inst.item[2].item[0].item[5].answer[0].valueCoding.display, "No") + self.assertEqual(inst.item[2].item[0].item[5].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].item[0].item[5].definition, "http://loinc.org/fhir/DataElement/54122-7") + self.assertEqual(inst.item[2].item[0].item[5].linkId, "2.1.1.6") + self.assertEqual(inst.item[2].item[0].item[5].text, "Was this person adopted?") self.assertEqual(inst.item[2].item[0].linkId, "2.1") self.assertEqual(inst.item[2].item[1].item[0].item[0].answer[0].valueCoding.code, "LA10415-0") self.assertEqual(inst.item[2].item[1].item[0].item[0].answer[0].valueCoding.display, "Brother") @@ -717,11 +621,121 @@ def implQuestionnaireResponse4(self, inst): self.assertEqual(inst.item[2].item[9].linkId, "2.1") self.assertEqual(inst.item[2].linkId, "2") self.assertEqual(inst.item[2].text, "Family member health information") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.questionnaire, "Questionnaire/ussg-fht") self.assertEqual(inst.status, "in-progress") self.assertEqual(inst.text.status, "generated") + def testQuestionnaireResponse3(self): + inst = self.instantiate_from("questionnaireresponse-example-f201-lifelines.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse3(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse3(inst2) + + def implQuestionnaireResponse3(self, inst): + self.assertEqual(inst.authored.date, FHIRDate("2013-06-18T00:00:00+01:00").date) + self.assertEqual(inst.authored.as_json(), "2013-06-18T00:00:00+01:00") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.item[0].item[0].answer[0].valueString, "I am allergic to house dust") + self.assertEqual(inst.item[0].item[0].linkId, "1.1") + self.assertEqual(inst.item[0].item[0].text, "Do you have allergies?") + self.assertEqual(inst.item[0].linkId, "1") + self.assertEqual(inst.item[1].item[0].answer[0].valueString, "Male") + self.assertEqual(inst.item[1].item[0].linkId, "2.1") + self.assertEqual(inst.item[1].item[0].text, "What is your gender?") + self.assertEqual(inst.item[1].item[1].answer[0].valueDate.date, FHIRDate("1960-03-13").date) + self.assertEqual(inst.item[1].item[1].answer[0].valueDate.as_json(), "1960-03-13") + self.assertEqual(inst.item[1].item[1].linkId, "2.2") + self.assertEqual(inst.item[1].item[1].text, "What is your date of birth?") + self.assertEqual(inst.item[1].item[2].answer[0].valueString, "The Netherlands") + self.assertEqual(inst.item[1].item[2].linkId, "2.3") + self.assertEqual(inst.item[1].item[2].text, "What is your country of birth?") + self.assertEqual(inst.item[1].item[3].answer[0].valueString, "married") + self.assertEqual(inst.item[1].item[3].linkId, "2.4") + self.assertEqual(inst.item[1].item[3].text, "What is your marital status?") + self.assertEqual(inst.item[1].linkId, "2") + self.assertEqual(inst.item[1].text, "General questions") + self.assertEqual(inst.item[2].item[0].answer[0].valueString, "No") + self.assertEqual(inst.item[2].item[0].linkId, "3.1") + self.assertEqual(inst.item[2].item[0].text, "Do you smoke?") + self.assertEqual(inst.item[2].item[1].answer[0].valueString, "No, but I used to drink") + self.assertEqual(inst.item[2].item[1].linkId, "3.2") + self.assertEqual(inst.item[2].item[1].text, "Do you drink alchohol?") + self.assertEqual(inst.item[2].linkId, "3") + self.assertEqual(inst.item[2].text, "Intoxications") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testQuestionnaireResponse4(self): + inst = self.instantiate_from("questionnaireresponse-example-bluebook.json") + self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") + self.implQuestionnaireResponse4(inst) + + js = inst.as_json() + self.assertEqual("QuestionnaireResponse", js["resourceType"]) + inst2 = questionnaireresponse.QuestionnaireResponse(js) + self.implQuestionnaireResponse4(inst2) + + def implQuestionnaireResponse4(self, inst): + self.assertEqual(inst.authored.date, FHIRDate("2013-02-19T14:15:00+10:00").date) + self.assertEqual(inst.authored.as_json(), "2013-02-19T14:15:00+10:00") + self.assertEqual(inst.id, "bb") + self.assertEqual(inst.item[0].item[0].item[0].answer[0].valueString, "Cathy Jones") + self.assertEqual(inst.item[0].item[0].item[0].linkId, "nameOfChild") + self.assertEqual(inst.item[0].item[0].item[0].text, "Name of child") + self.assertEqual(inst.item[0].item[0].item[1].answer[0].valueCoding.code, "f") + self.assertEqual(inst.item[0].item[0].item[1].linkId, "sex") + self.assertEqual(inst.item[0].item[0].item[1].text, "Sex") + self.assertEqual(inst.item[0].item[0].linkId, "group") + self.assertEqual(inst.item[0].item[1].item[0].answer[0].valueDecimal, 3.25) + self.assertEqual(inst.item[0].item[1].item[0].linkId, "birthWeight") + self.assertEqual(inst.item[0].item[1].item[0].text, "Birth weight (kg)") + self.assertEqual(inst.item[0].item[1].item[1].answer[0].valueDecimal, 44.3) + self.assertEqual(inst.item[0].item[1].item[1].linkId, "birthLength") + self.assertEqual(inst.item[0].item[1].item[1].text, "Birth length (cm)") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].answer[0].valueDate.date, FHIRDate("1972-11-30").date) + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].answer[0].valueDate.as_json(), "1972-11-30") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].linkId, "vitaminKDose1") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[0].text, "1st dose") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].answer[0].valueDate.date, FHIRDate("1972-12-11").date) + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].answer[0].valueDate.as_json(), "1972-12-11") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].linkId, "vitaminKDose2") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].item[1].text, "2nd dose") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].item[0].linkId, "vitaminKgivenDoses") + self.assertEqual(inst.item[0].item[1].item[2].answer[0].valueCoding.code, "INJECTION") + self.assertEqual(inst.item[0].item[1].item[2].linkId, "vitaminKgiven") + self.assertEqual(inst.item[0].item[1].item[2].text, "Vitamin K given") + self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].answer[0].valueDate.date, FHIRDate("1972-12-04").date) + self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].answer[0].valueDate.as_json(), "1972-12-04") + self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].linkId, "hepBgivenDate") + self.assertEqual(inst.item[0].item[1].item[3].answer[0].item[0].text, "Date given") + self.assertTrue(inst.item[0].item[1].item[3].answer[0].valueBoolean) + self.assertEqual(inst.item[0].item[1].item[3].linkId, "hepBgiven") + self.assertEqual(inst.item[0].item[1].item[3].text, "Hep B given y / n") + self.assertEqual(inst.item[0].item[1].item[4].answer[0].valueString, "Already able to speak Chinese") + self.assertEqual(inst.item[0].item[1].item[4].linkId, "abnormalitiesAtBirth") + self.assertEqual(inst.item[0].item[1].item[4].text, "Abnormalities noted at birth") + self.assertEqual(inst.item[0].item[1].linkId, "neonatalInformation") + self.assertEqual(inst.item[0].item[1].text, "Neonatal Information") + self.assertEqual(inst.item[0].linkId, "birthDetails") + self.assertEqual(inst.item[0].text, "Birth details - To be completed by health professional") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + def testQuestionnaireResponse5(self): - inst = self.instantiate_from("questionnaireresponse-example.json") + inst = self.instantiate_from("questionnaireresponse-example-gcs.json") self.assertIsNotNone(inst, "Must have instantiated a QuestionnaireResponse instance") self.implQuestionnaireResponse5(inst) @@ -731,29 +745,31 @@ def testQuestionnaireResponse5(self): self.implQuestionnaireResponse5(inst2) def implQuestionnaireResponse5(self, inst): - self.assertEqual(inst.authored.date, FHIRDate("2013-02-19T14:15:00-05:00").date) - self.assertEqual(inst.authored.as_json(), "2013-02-19T14:15:00-05:00") - self.assertEqual(inst.contained[0].id, "patsub") - self.assertEqual(inst.contained[1].id, "order") - self.assertEqual(inst.contained[2].id, "questauth") - self.assertEqual(inst.id, "3141") - self.assertEqual(inst.identifier.system, "http://example.org/fhir/NamingSystem/questionnaire-ids") - self.assertEqual(inst.identifier.value, "Q12349876") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[0].answer[0].valueCoding.code, "1") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[0].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[0].linkId, "1.1.1.1") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[1].answer[0].valueCoding.code, "1") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[1].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[1].linkId, "1.1.1.2") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[2].answer[0].valueCoding.code, "0") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[2].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].item[2].linkId, "1.1.1.3") - self.assertEqual(inst.item[0].item[0].answer[0].item[0].linkId, "1.1.1") - self.assertEqual(inst.item[0].item[0].answer[0].valueCoding.code, "1") - self.assertEqual(inst.item[0].item[0].answer[0].valueCoding.display, "Yes") - self.assertEqual(inst.item[0].item[0].answer[0].valueCoding.system, "http://cancer.questionnaire.org/system/code/yesno") - self.assertEqual(inst.item[0].item[0].linkId, "1.1") - self.assertEqual(inst.item[0].linkId, "1") + self.assertEqual(inst.authored.date, FHIRDate("2014-12-11T04:44:16Z").date) + self.assertEqual(inst.authored.as_json(), "2014-12-11T04:44:16Z") + self.assertEqual(inst.id, "gcs") + self.assertEqual(inst.item[0].answer[0].valueCoding.code, "LA6560-2") + self.assertEqual(inst.item[0].answer[0].valueCoding.display, "Confused") + self.assertEqual(inst.item[0].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/ordinalValue") + self.assertEqual(inst.item[0].answer[0].valueCoding.extension[0].valueDecimal, 4) + self.assertEqual(inst.item[0].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[0].linkId, "1.1") + self.assertEqual(inst.item[1].answer[0].valueCoding.code, "LA6566-9") + self.assertEqual(inst.item[1].answer[0].valueCoding.display, "Localizing pain") + self.assertEqual(inst.item[1].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/ordinalValue") + self.assertEqual(inst.item[1].answer[0].valueCoding.extension[0].valueDecimal, 5) + self.assertEqual(inst.item[1].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[1].linkId, "1.2") + self.assertEqual(inst.item[2].answer[0].valueCoding.code, "LA6556-0") + self.assertEqual(inst.item[2].answer[0].valueCoding.display, "Eyes open spontaneously") + self.assertEqual(inst.item[2].answer[0].valueCoding.extension[0].url, "http://hl7.org/fhir/StructureDefinition/ordinalValue") + self.assertEqual(inst.item[2].answer[0].valueCoding.extension[0].valueDecimal, 4) + self.assertEqual(inst.item[2].answer[0].valueCoding.system, "http://loinc.org") + self.assertEqual(inst.item[2].linkId, "1.3") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.questionnaire, "Questionnaire/gcs") self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/range.py b/fhirclient/models/range.py index 901d5c547..0118d0749 100644 --- a/fhirclient/models/range.py +++ b/fhirclient/models/range.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Range) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Range) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/ratio.py b/fhirclient/models/ratio.py index efd83c241..277570a87 100644 --- a/fhirclient/models/ratio.py +++ b/fhirclient/models/ratio.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Ratio) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Ratio) on 2019-05-07. +# 2019, SMART Health IT. from . import element diff --git a/fhirclient/models/reference.py b/fhirclient/models/reference.py index 08b82c9d7..c9a93374e 100644 --- a/fhirclient/models/reference.py +++ b/fhirclient/models/reference.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Reference) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Reference) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -33,6 +33,10 @@ def __init__(self, jsondict=None, strict=True): """ Literal reference, Relative, internal or absolute URL. Type `str`. """ + self.type = None + """ Type the reference refers to (e.g. "Patient"). + Type `str`. """ + super(Reference, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -41,6 +45,7 @@ def elementProperties(self): ("display", "display", str, False, None, False), ("identifier", "identifier", identifier.Identifier, False, None, False), ("reference", "reference", str, False, None, False), + ("type", "type", str, False, None, False), ]) return js diff --git a/fhirclient/models/referralrequest.py b/fhirclient/models/referralrequest.py deleted file mode 100644 index e99e228a2..000000000 --- a/fhirclient/models/referralrequest.py +++ /dev/null @@ -1,222 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) on 2017-03-22. -# 2017, SMART Health IT. - - -from . import domainresource - -class ReferralRequest(domainresource.DomainResource): - """ A request for referral or transfer of care. - - Used to record and send details about a request for referral service or - transfer of a patient to the care of another provider or provider - organization. - """ - - resource_type = "ReferralRequest" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.authoredOn = None - """ Date of creation/activation. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.basedOn = None - """ Request fulfilled by this request. - List of `FHIRReference` items referencing `ReferralRequest, CarePlan, ProcedureRequest` (represented as `dict` in JSON). """ - - self.context = None - """ Originating encounter. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - - self.definition = None - """ Instantiates protocol or definition. - List of `FHIRReference` items referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ - - self.description = None - """ A textual description of the referral. - Type `str`. """ - - self.groupIdentifier = None - """ Composite request this is part of. - Type `Identifier` (represented as `dict` in JSON). """ - - self.identifier = None - """ Business identifier. - List of `Identifier` items (represented as `dict` in JSON). """ - - self.intent = None - """ proposal | plan | order. - Type `str`. """ - - self.note = None - """ Comments made about referral request. - List of `Annotation` items (represented as `dict` in JSON). """ - - self.occurrenceDateTime = None - """ When the service(s) requested in the referral should occur. - Type `FHIRDate` (represented as `str` in JSON). """ - - self.occurrencePeriod = None - """ When the service(s) requested in the referral should occur. - Type `Period` (represented as `dict` in JSON). """ - - self.priority = None - """ Urgency of referral / transfer of care request. - Type `str`. """ - - self.reasonCode = None - """ Reason for referral / transfer of care request. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Why is service needed?. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ - - self.recipient = None - """ Receiver of referral / transfer of care request. - List of `FHIRReference` items referencing `Practitioner, Organization, HealthcareService` (represented as `dict` in JSON). """ - - self.relevantHistory = None - """ Key events in history of request. - List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ - - self.replaces = None - """ Request(s) replaced by this request. - List of `FHIRReference` items referencing `ReferralRequest` (represented as `dict` in JSON). """ - - self.requester = None - """ Who/what is requesting service. - Type `ReferralRequestRequester` (represented as `dict` in JSON). """ - - self.serviceRequested = None - """ Actions requested as part of the referral. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - - self.specialty = None - """ The clinical specialty (discipline) that the referral is requested - for. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.status = None - """ draft | active | suspended | cancelled | completed | entered-in- - error | unknown. - Type `str`. """ - - self.subject = None - """ Patient referred to care or transfer. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ - - self.supportingInfo = None - """ Additonal information to support referral or transfer of care - request. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ - - self.type = None - """ Referral/Transition of care request type. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - super(ReferralRequest, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ReferralRequest, self).elementProperties() - js.extend([ - ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), - ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), - ("description", "description", str, False, None, False), - ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), - ("identifier", "identifier", identifier.Identifier, True, None, False), - ("intent", "intent", str, False, None, True), - ("note", "note", annotation.Annotation, True, None, False), - ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), - ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), - ("priority", "priority", str, False, None, False), - ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), - ("recipient", "recipient", fhirreference.FHIRReference, True, None, False), - ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, None, False), - ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), - ("requester", "requester", ReferralRequestRequester, False, None, False), - ("serviceRequested", "serviceRequested", codeableconcept.CodeableConcept, True, None, False), - ("specialty", "specialty", codeableconcept.CodeableConcept, False, None, False), - ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), - ("supportingInfo", "supportingInfo", fhirreference.FHIRReference, True, None, False), - ("type", "type", codeableconcept.CodeableConcept, False, None, False), - ]) - return js - - -from . import backboneelement - -class ReferralRequestRequester(backboneelement.BackboneElement): - """ Who/what is requesting service. - - The individual who initiated the request and has responsibility for its - activation. - """ - - resource_type = "ReferralRequestRequester" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.agent = None - """ Individual making the request. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ - - self.onBehalfOf = None - """ Organization agent is acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - super(ReferralRequestRequester, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ReferralRequestRequester, self).elementProperties() - js.extend([ - ("agent", "agent", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), - ]) - return js - - -import sys -try: - from . import annotation -except ImportError: - annotation = sys.modules[__package__ + '.annotation'] -try: - from . import codeableconcept -except ImportError: - codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import fhirdate -except ImportError: - fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] -try: - from . import identifier -except ImportError: - identifier = sys.modules[__package__ + '.identifier'] -try: - from . import period -except ImportError: - period = sys.modules[__package__ + '.period'] diff --git a/fhirclient/models/referralrequest_tests.py b/fhirclient/models/referralrequest_tests.py deleted file mode 100644 index 3c9743d91..000000000 --- a/fhirclient/models/referralrequest_tests.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import referralrequest -from .fhirdate import FHIRDate - - -class ReferralRequestTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("ReferralRequest", js["resourceType"]) - return referralrequest.ReferralRequest(js) - - def testReferralRequest1(self): - inst = self.instantiate_from("referralrequest-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ReferralRequest instance") - self.implReferralRequest1(inst) - - js = inst.as_json() - self.assertEqual("ReferralRequest", js["resourceType"]) - inst2 = referralrequest.ReferralRequest(js) - self.implReferralRequest1(inst2) - - def implReferralRequest1(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2014-02-14").date) - self.assertEqual(inst.authoredOn.as_json(), "2014-02-14") - self.assertEqual(inst.description, "In the past 2 years Beverly has had 6 instances of r) sided Otitis media. She is falling behind her peers at school, and displaying some learning difficulties.") - self.assertEqual(inst.groupIdentifier.value, "1234") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].system, "http://orionhealth.com/fhir/apps/referralids") - self.assertEqual(inst.identifier[0].value, "ret4421") - self.assertEqual(inst.intent, "order") - self.assertEqual(inst.occurrencePeriod.end.date, FHIRDate("2014-03-14").date) - self.assertEqual(inst.occurrencePeriod.end.as_json(), "2014-03-14") - self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.reasonCode[0].text, "For consideration of Grommets") - self.assertEqual(inst.serviceRequested[0].coding[0].code, "172676009") - self.assertEqual(inst.serviceRequested[0].coding[0].display, "Myringotomy and insertion of tympanic ventilation tube") - self.assertEqual(inst.serviceRequested[0].coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.serviceRequested[0].text, "Insertion of grommets") - self.assertEqual(inst.specialty.coding[0].code, "ent") - self.assertEqual(inst.specialty.coding[0].display, "ENT") - self.assertEqual(inst.specialty.coding[0].system, "http://orionhealth.com/fhir/apps/specialties") - self.assertEqual(inst.status, "active") - self.assertEqual(inst.text.div, "
Referral to Dr Dave for Beverly weaver to have grommets inserted in her r) ear
") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "103696004") - self.assertEqual(inst.type.coding[0].display, "Patient referral to specialist") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") - diff --git a/fhirclient/models/relatedartifact.py b/fhirclient/models/relatedartifact.py index aa70827e2..5c0fb219c 100644 --- a/fhirclient/models/relatedartifact.py +++ b/fhirclient/models/relatedartifact.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/RelatedArtifact) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RelatedArtifact) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -36,9 +36,13 @@ def __init__(self, jsondict=None, strict=True): """ What document is being referenced. Type `Attachment` (represented as `dict` in JSON). """ + self.label = None + """ Short label. + Type `str`. """ + self.resource = None """ What resource is being referenced. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `str`. """ self.type = None """ documentation | justification | citation | predecessor | successor @@ -57,7 +61,8 @@ def elementProperties(self): ("citation", "citation", str, False, None, False), ("display", "display", str, False, None, False), ("document", "document", attachment.Attachment, False, None, False), - ("resource", "resource", fhirreference.FHIRReference, False, None, False), + ("label", "label", str, False, None, False), + ("resource", "resource", str, False, None, False), ("type", "type", str, False, None, True), ("url", "url", str, False, None, False), ]) @@ -69,7 +74,3 @@ def elementProperties(self): from . import attachment except ImportError: attachment = sys.modules[__package__ + '.attachment'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] diff --git a/fhirclient/models/relatedperson.py b/fhirclient/models/relatedperson.py index d43e05ac8..cb37a0b02 100644 --- a/fhirclient/models/relatedperson.py +++ b/fhirclient/models/relatedperson.py @@ -1,14 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class RelatedPerson(domainresource.DomainResource): - """ An person that is related to a patient, but who is not a direct target of + """ A person that is related to a patient, but who is not a direct target of care. Information about a person that is involved in the care for a patient, but @@ -38,6 +38,11 @@ def __init__(self, jsondict=None, strict=True): """ The date on which the related person was born. Type `FHIRDate` (represented as `str` in JSON). """ + self.communication = None + """ A language which may be used to communicate with about the + patient's health. + List of `RelatedPersonCommunication` items (represented as `dict` in JSON). """ + self.gender = None """ male | female | other | unknown. Type `str`. """ @@ -52,7 +57,7 @@ def __init__(self, jsondict=None, strict=True): self.patient = None """ The patient this person is related to. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Period of time that this relationship is considered valid. @@ -64,7 +69,7 @@ def __init__(self, jsondict=None, strict=True): self.relationship = None """ The nature of the relationship. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.telecom = None """ A contact detail for the person. @@ -78,18 +83,55 @@ def elementProperties(self): ("active", "active", bool, False, None, False), ("address", "address", address.Address, True, None, False), ("birthDate", "birthDate", fhirdate.FHIRDate, False, None, False), + ("communication", "communication", RelatedPersonCommunication, True, None, False), ("gender", "gender", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("name", "name", humanname.HumanName, True, None, False), ("patient", "patient", fhirreference.FHIRReference, False, None, True), ("period", "period", period.Period, False, None, False), ("photo", "photo", attachment.Attachment, True, None, False), - ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, True, None, False), ("telecom", "telecom", contactpoint.ContactPoint, True, None, False), ]) return js +from . import backboneelement + +class RelatedPersonCommunication(backboneelement.BackboneElement): + """ A language which may be used to communicate with about the patient's health. + """ + + resource_type = "RelatedPersonCommunication" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.language = None + """ The language which can be used to communicate with the patient + about his or her health. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.preferred = None + """ Language preference indicator. + Type `bool`. """ + + super(RelatedPersonCommunication, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RelatedPersonCommunication, self).elementProperties() + js.extend([ + ("language", "language", codeableconcept.CodeableConcept, False, None, True), + ("preferred", "preferred", bool, False, None, False), + ]) + return js + + import sys try: from . import address diff --git a/fhirclient/models/relatedperson_tests.py b/fhirclient/models/relatedperson_tests.py index f5320955e..55546bba6 100644 --- a/fhirclient/models/relatedperson_tests.py +++ b/fhirclient/models/relatedperson_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return relatedperson.RelatedPerson(js) def testRelatedPerson1(self): - inst = self.instantiate_from("relatedperson-example-f001-sarah.json") + inst = self.instantiate_from("relatedperson-example-peter.json") self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") self.implRelatedPerson1(inst) @@ -32,26 +32,33 @@ def testRelatedPerson1(self): self.implRelatedPerson1(inst2) def implRelatedPerson1(self, inst): - self.assertEqual(inst.gender, "female") - self.assertEqual(inst.id, "f001") - self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.2.4.6.3") - self.assertEqual(inst.identifier[0].type.text, "BSN") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.name[0].family, "Abels") - self.assertEqual(inst.name[0].given[0], "Sarah") - self.assertEqual(inst.name[0].use, "usual") - self.assertEqual(inst.relationship.coding[0].code, "SIGOTHR") - self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.address[0].city, "PleasantVille") + self.assertEqual(inst.address[0].line[0], "534 Erewhon St") + self.assertEqual(inst.address[0].postalCode, "3999") + self.assertEqual(inst.address[0].state, "Vic") + self.assertEqual(inst.address[0].use, "home") + self.assertEqual(inst.gender, "male") + self.assertEqual(inst.id, "peter") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Chalmers") + self.assertEqual(inst.name[0].given[0], "Peter") + self.assertEqual(inst.name[0].given[1], "James") + self.assertEqual(inst.name[0].use, "official") + self.assertEqual(inst.period.start.date, FHIRDate("2012-03-11").date) + self.assertEqual(inst.period.start.as_json(), "2012-03-11") + self.assertEqual(inst.photo[0].contentType, "image/jpeg") + self.assertEqual(inst.photo[0].url, "Binary/f012") + self.assertEqual(inst.relationship[0].coding[0].code, "C") + self.assertEqual(inst.relationship[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0131") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "mobile") - self.assertEqual(inst.telecom[0].value, "0690383372") - self.assertEqual(inst.telecom[1].system, "email") - self.assertEqual(inst.telecom[1].use, "home") - self.assertEqual(inst.telecom[1].value, "s.abels@kpn.nl") + self.assertEqual(inst.telecom[0].use, "work") + self.assertEqual(inst.telecom[0].value, "(03) 5555 6473") self.assertEqual(inst.text.status, "generated") def testRelatedPerson2(self): - inst = self.instantiate_from("relatedperson-example-f002-ariadne.json") + inst = self.instantiate_from("relatedperson-example-f001-sarah.json") self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") self.implRelatedPerson2(inst) @@ -61,24 +68,29 @@ def testRelatedPerson2(self): self.implRelatedPerson2(inst2) def implRelatedPerson2(self, inst): - self.assertEqual(inst.birthDate.date, FHIRDate("1963").date) - self.assertEqual(inst.birthDate.as_json(), "1963") self.assertEqual(inst.gender, "female") - self.assertEqual(inst.id, "f002") - self.assertEqual(inst.name[0].text, "Ariadne Bor-Jansma") + self.assertEqual(inst.id, "f001") + self.assertEqual(inst.identifier[0].system, "urn:oid:2.16.840.1.113883.2.4.6.3") + self.assertEqual(inst.identifier[0].type.text, "BSN") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Abels") + self.assertEqual(inst.name[0].given[0], "Sarah") self.assertEqual(inst.name[0].use, "usual") - self.assertEqual(inst.period.start.date, FHIRDate("1975").date) - self.assertEqual(inst.period.start.as_json(), "1975") - self.assertEqual(inst.photo[0].contentType, "image/jpeg") - self.assertEqual(inst.relationship.coding[0].code, "SIGOTHR") - self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.relationship[0].coding[0].code, "SIGOTHR") + self.assertEqual(inst.relationship[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") self.assertEqual(inst.telecom[0].system, "phone") - self.assertEqual(inst.telecom[0].use, "home") - self.assertEqual(inst.telecom[0].value, "+31201234567") + self.assertEqual(inst.telecom[0].use, "mobile") + self.assertEqual(inst.telecom[0].value, "0690383372") + self.assertEqual(inst.telecom[1].system, "email") + self.assertEqual(inst.telecom[1].use, "home") + self.assertEqual(inst.telecom[1].value, "s.abels@kpn.nl") self.assertEqual(inst.text.status, "generated") def testRelatedPerson3(self): - inst = self.instantiate_from("relatedperson-example-peter.json") + inst = self.instantiate_from("relatedperson-example-newborn-mom.json") self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") self.implRelatedPerson3(inst) @@ -88,26 +100,30 @@ def testRelatedPerson3(self): self.implRelatedPerson3(inst2) def implRelatedPerson3(self, inst): - self.assertEqual(inst.address[0].city, "PleasantVille") - self.assertEqual(inst.address[0].line[0], "534 Erewhon St") - self.assertEqual(inst.address[0].postalCode, "3999") - self.assertEqual(inst.address[0].state, "Vic") + self.assertTrue(inst.active) + self.assertEqual(inst.address[0].line[0], "2222 Home Street") self.assertEqual(inst.address[0].use, "home") - self.assertEqual(inst.gender, "male") - self.assertEqual(inst.id, "peter") - self.assertEqual(inst.name[0].family, "Chalmers") - self.assertEqual(inst.name[0].given[0], "Peter") - self.assertEqual(inst.name[0].given[1], "James") + self.assertEqual(inst.birthDate.date, FHIRDate("1973-05-31").date) + self.assertEqual(inst.birthDate.as_json(), "1973-05-31") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "newborn-mom") + self.assertEqual(inst.identifier[0].system, "http://hl7.org/fhir/sid/us-ssn") + self.assertEqual(inst.identifier[0].type.coding[0].code, "SS") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].value, "444222222") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].family, "Everywoman") + self.assertEqual(inst.name[0].given[0], "Eve") self.assertEqual(inst.name[0].use, "official") - self.assertEqual(inst.period.start.date, FHIRDate("2012-03-11").date) - self.assertEqual(inst.period.start.as_json(), "2012-03-11") - self.assertEqual(inst.photo[0].contentType, "image/jpeg") - self.assertEqual(inst.photo[0].url, "Binary/f012") - self.assertEqual(inst.relationship.coding[0].code, "C") - self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/v2/0131") + self.assertEqual(inst.relationship[0].coding[0].code, "NMTH") + self.assertEqual(inst.relationship[0].coding[0].display, "natural mother") + self.assertEqual(inst.relationship[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") + self.assertEqual(inst.relationship[0].text, "Natural Mother") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].use, "work") - self.assertEqual(inst.telecom[0].value, "(03) 5555 6473") + self.assertEqual(inst.telecom[0].value, "555-555-2003") self.assertEqual(inst.text.status, "generated") def testRelatedPerson4(self): @@ -132,15 +148,48 @@ def implRelatedPerson4(self, inst): self.assertEqual(inst.identifier[0].type.text, "INSEE") self.assertEqual(inst.identifier[0].use, "usual") self.assertEqual(inst.identifier[0].value, "272117510400399") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name[0].family, "du Marché") self.assertEqual(inst.name[0].given[0], "Bénédicte") self.assertEqual(inst.photo[0].contentType, "image/jpeg") self.assertEqual(inst.photo[0].url, "Binary/f016") - self.assertEqual(inst.relationship.coding[0].code, "N") - self.assertEqual(inst.relationship.coding[0].system, "http://hl7.org/fhir/v2/0131") - self.assertEqual(inst.relationship.coding[1].code, "WIFE") - self.assertEqual(inst.relationship.coding[1].system, "http://hl7.org/fhir/v3/RoleCode") + self.assertEqual(inst.relationship[0].coding[0].code, "N") + self.assertEqual(inst.relationship[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0131") + self.assertEqual(inst.relationship[0].coding[1].code, "WIFE") + self.assertEqual(inst.relationship[0].coding[1].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") self.assertEqual(inst.telecom[0].system, "phone") self.assertEqual(inst.telecom[0].value, "+33 (237) 998327") self.assertEqual(inst.text.status, "generated") + + def testRelatedPerson5(self): + inst = self.instantiate_from("relatedperson-example-f002-ariadne.json") + self.assertIsNotNone(inst, "Must have instantiated a RelatedPerson instance") + self.implRelatedPerson5(inst) + + js = inst.as_json() + self.assertEqual("RelatedPerson", js["resourceType"]) + inst2 = relatedperson.RelatedPerson(js) + self.implRelatedPerson5(inst2) + + def implRelatedPerson5(self, inst): + self.assertEqual(inst.birthDate.date, FHIRDate("1963").date) + self.assertEqual(inst.birthDate.as_json(), "1963") + self.assertEqual(inst.gender, "female") + self.assertEqual(inst.id, "f002") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.name[0].text, "Ariadne Bor-Jansma") + self.assertEqual(inst.name[0].use, "usual") + self.assertEqual(inst.period.start.date, FHIRDate("1975").date) + self.assertEqual(inst.period.start.as_json(), "1975") + self.assertEqual(inst.photo[0].contentType, "image/jpeg") + self.assertEqual(inst.relationship[0].coding[0].code, "SIGOTHR") + self.assertEqual(inst.relationship[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/v3-RoleCode") + self.assertEqual(inst.telecom[0].system, "phone") + self.assertEqual(inst.telecom[0].use, "home") + self.assertEqual(inst.telecom[0].value, "+31201234567") + self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/requestgroup.py b/fhirclient/models/requestgroup.py index df49629c4..1ebe7039c 100644 --- a/fhirclient/models/requestgroup.py +++ b/fhirclient/models/requestgroup.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/RequestGroup) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RequestGroup) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -30,7 +30,7 @@ def __init__(self, jsondict=None, strict=True): self.author = None """ Device or practitioner that authored the request group. - Type `FHIRReference` referencing `Device, Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.authoredOn = None """ When the request group was authored. @@ -38,15 +38,15 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Fulfills plan, proposal, or order. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ - self.context = None - """ Encounter or Episode for the request group. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + self.code = None + """ What's being requested/ordered. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.definition = None - """ Instantiates protocol or definition. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + self.encounter = None + """ Created as part of. + Type `FHIRReference` (represented as `dict` in JSON). """ self.groupIdentifier = None """ Composite request this is part of. @@ -56,6 +56,14 @@ def __init__(self, jsondict=None, strict=True): """ Business identifier. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + self.intent = None """ proposal | plan | order. Type `str`. """ @@ -68,17 +76,17 @@ def __init__(self, jsondict=None, strict=True): """ routine | urgent | asap | stat. Type `str`. """ - self.reasonCodeableConcept = None - """ Reason for the request group. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.reasonCode = None + """ Why the request group is needed. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None - """ Reason for the request group. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + """ Why the request group is needed. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.replaces = None """ Request(s) replaced by this request. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ draft | active | suspended | cancelled | completed | entered-in- @@ -87,7 +95,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Who the request group is about. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(RequestGroup, self).__init__(jsondict=jsondict, strict=strict) @@ -98,15 +106,17 @@ def elementProperties(self): ("author", "author", fhirreference.FHIRReference, False, None, False), ("authoredOn", "authoredOn", fhirdate.FHIRDate, False, None, False), ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), ("intent", "intent", str, False, None, True), ("note", "note", annotation.Annotation, True, None, False), ("priority", "priority", str, False, None, False), - ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, True), ("subject", "subject", fhirreference.FHIRReference, False, None, False), @@ -160,18 +170,22 @@ def __init__(self, jsondict=None, strict=True): """ visual-group | logical-group | sentence-group. Type `str`. """ - self.label = None - """ User-visible label for the action (e.g. 1. or A.). - Type `str`. """ - self.participant = None """ Who should perform the action. - List of `FHIRReference` items referencing `Patient, Person, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.precheckBehavior = None """ yes | no. Type `str`. """ + self.prefix = None + """ User-visible prefix for the action (e.g. 1. or A.). + Type `str`. """ + + self.priority = None + """ routine | urgent | asap | stat. + Type `str`. """ + self.relatedAction = None """ Relationship to another action. List of `RequestGroupActionRelatedAction` items (represented as `dict` in JSON). """ @@ -182,7 +196,7 @@ def __init__(self, jsondict=None, strict=True): self.resource = None """ The target of the action. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.selectionBehavior = None """ any | all | all-or-none | exactly-one | at-most-one | one-or-more. @@ -193,6 +207,10 @@ def __init__(self, jsondict=None, strict=True): cannot be interpreted by the receiving system. Type `str`. """ + self.timingAge = None + """ When the action should take place. + Type `Age` (represented as `dict` in JSON). """ + self.timingDateTime = None """ When the action should take place. Type `FHIRDate` (represented as `str` in JSON). """ @@ -219,7 +237,7 @@ def __init__(self, jsondict=None, strict=True): self.type = None """ create | update | remove | fire-event. - Type `Coding` (represented as `dict` in JSON). """ + Type `CodeableConcept` (represented as `dict` in JSON). """ super(RequestGroupAction, self).__init__(jsondict=jsondict, strict=strict) @@ -233,21 +251,23 @@ def elementProperties(self): ("description", "description", str, False, None, False), ("documentation", "documentation", relatedartifact.RelatedArtifact, True, None, False), ("groupingBehavior", "groupingBehavior", str, False, None, False), - ("label", "label", str, False, None, False), ("participant", "participant", fhirreference.FHIRReference, True, None, False), ("precheckBehavior", "precheckBehavior", str, False, None, False), + ("prefix", "prefix", str, False, None, False), + ("priority", "priority", str, False, None, False), ("relatedAction", "relatedAction", RequestGroupActionRelatedAction, True, None, False), ("requiredBehavior", "requiredBehavior", str, False, None, False), ("resource", "resource", fhirreference.FHIRReference, False, None, False), ("selectionBehavior", "selectionBehavior", str, False, None, False), ("textEquivalent", "textEquivalent", str, False, None, False), + ("timingAge", "timingAge", age.Age, False, "timing", False), ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), ("timingDuration", "timingDuration", duration.Duration, False, "timing", False), ("timingPeriod", "timingPeriod", period.Period, False, "timing", False), ("timingRange", "timingRange", range.Range, False, "timing", False), ("timingTiming", "timingTiming", timing.Timing, False, "timing", False), ("title", "title", str, False, None, False), - ("type", "type", coding.Coding, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -269,31 +289,21 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.description = None - """ Natural language description of the condition. - Type `str`. """ - self.expression = None """ Boolean-valued expression. - Type `str`. """ + Type `Expression` (represented as `dict` in JSON). """ self.kind = None """ applicability | start | stop. Type `str`. """ - self.language = None - """ Language of the expression. - Type `str`. """ - super(RequestGroupActionCondition, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(RequestGroupActionCondition, self).elementProperties() js.extend([ - ("description", "description", str, False, None, False), - ("expression", "expression", str, False, None, False), + ("expression", "expression", expression.Expression, False, None, False), ("kind", "kind", str, False, None, True), - ("language", "language", str, False, None, False), ]) return js @@ -346,6 +356,10 @@ def elementProperties(self): import sys +try: + from . import age +except ImportError: + age = sys.modules[__package__ + '.age'] try: from . import annotation except ImportError: @@ -354,14 +368,14 @@ def elementProperties(self): from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] -try: - from . import coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] try: from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/requestgroup_tests.py b/fhirclient/models/requestgroup_tests.py index 73348f430..32585934b 100644 --- a/fhirclient/models/requestgroup_tests.py +++ b/fhirclient/models/requestgroup_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return requestgroup.RequestGroup(js) def testRequestGroup1(self): - inst = self.instantiate_from("requestgroup-example.json") + inst = self.instantiate_from("requestgroup-kdn5-example.json") self.assertIsNotNone(inst, "Must have instantiated a RequestGroup instance") self.implRequestGroup1(inst) @@ -32,54 +32,6 @@ def testRequestGroup1(self): self.implRequestGroup1(inst2) def implRequestGroup1(self, inst): - self.assertEqual(inst.action[0].action[0].description, "Administer medication 1") - self.assertEqual(inst.action[0].action[0].id, "medication-action-1") - self.assertEqual(inst.action[0].action[0].type.code, "create") - self.assertEqual(inst.action[0].action[1].description, "Administer medication 2") - self.assertEqual(inst.action[0].action[1].id, "medication-action-2") - self.assertEqual(inst.action[0].action[1].relatedAction[0].actionId, "medication-action-1") - self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.unit, "h") - self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.value, 1) - self.assertEqual(inst.action[0].action[1].relatedAction[0].relationship, "after-end") - self.assertEqual(inst.action[0].action[1].type.code, "create") - self.assertEqual(inst.action[0].cardinalityBehavior, "single") - self.assertEqual(inst.action[0].description, "Administer medications at the appropriate time") - self.assertEqual(inst.action[0].groupingBehavior, "logical-group") - self.assertEqual(inst.action[0].label, "1") - self.assertEqual(inst.action[0].precheckBehavior, "yes") - self.assertEqual(inst.action[0].requiredBehavior, "must") - self.assertEqual(inst.action[0].selectionBehavior, "all") - self.assertEqual(inst.action[0].textEquivalent, "Administer medication 1, followed an hour later by medication 2") - self.assertEqual(inst.action[0].timingDateTime.date, FHIRDate("2017-03-06T19:00:00Z").date) - self.assertEqual(inst.action[0].timingDateTime.as_json(), "2017-03-06T19:00:00Z") - self.assertEqual(inst.action[0].title, "Administer Medications") - self.assertEqual(inst.authoredOn.date, FHIRDate("2017-03-06T17:31:00Z").date) - self.assertEqual(inst.authoredOn.as_json(), "2017-03-06T17:31:00Z") - self.assertEqual(inst.contained[0].id, "medicationrequest-1") - self.assertEqual(inst.contained[1].id, "medicationrequest-2") - self.assertEqual(inst.groupIdentifier.system, "http://example.org/treatment-group") - self.assertEqual(inst.groupIdentifier.value, "00001") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].value, "requestgroup-1") - self.assertEqual(inst.intent, "plan") - self.assertEqual(inst.note[0].text, "Additional notes about the request group") - self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.reasonCodeableConcept.text, "Treatment") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.div, "
Example RequestGroup illustrating related actions to administer medications in sequence with time delay.
") - self.assertEqual(inst.text.status, "generated") - - def testRequestGroup2(self): - inst = self.instantiate_from("requestgroup-kdn5-example.json") - self.assertIsNotNone(inst, "Must have instantiated a RequestGroup instance") - self.implRequestGroup2(inst) - - js = inst.as_json() - self.assertEqual("RequestGroup", js["resourceType"]) - inst2 = requestgroup.RequestGroup(js) - self.implRequestGroup2(inst2) - - def implRequestGroup2(self, inst): self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[0].url, "day") self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[0].valueInteger, 1) self.assertEqual(inst.action[0].action[0].action[0].action[0].action[0].extension[0].extension[1].url, "day") @@ -109,9 +61,64 @@ def implRequestGroup2(self, inst): self.assertEqual(inst.contained[1].id, "2222") self.assertEqual(inst.id, "kdn5-example") self.assertEqual(inst.identifier[0].value, "requestgroup-kdn5") + self.assertEqual(inst.instantiatesCanonical[0], "PlanDefinition/KDN5") self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.priority, "routine") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.div, "
Administer gemcitabine and carboplatin.
") self.assertEqual(inst.text.status, "generated") + + def testRequestGroup2(self): + inst = self.instantiate_from("requestgroup-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RequestGroup instance") + self.implRequestGroup2(inst) + + js = inst.as_json() + self.assertEqual("RequestGroup", js["resourceType"]) + inst2 = requestgroup.RequestGroup(js) + self.implRequestGroup2(inst2) + + def implRequestGroup2(self, inst): + self.assertEqual(inst.action[0].action[0].description, "Administer medication 1") + self.assertEqual(inst.action[0].action[0].id, "medication-action-1") + self.assertEqual(inst.action[0].action[0].type.coding[0].code, "create") + self.assertEqual(inst.action[0].action[1].description, "Administer medication 2") + self.assertEqual(inst.action[0].action[1].id, "medication-action-2") + self.assertEqual(inst.action[0].action[1].relatedAction[0].actionId, "medication-action-1") + self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.unit, "h") + self.assertEqual(inst.action[0].action[1].relatedAction[0].offsetDuration.value, 1) + self.assertEqual(inst.action[0].action[1].relatedAction[0].relationship, "after-end") + self.assertEqual(inst.action[0].action[1].type.coding[0].code, "create") + self.assertEqual(inst.action[0].cardinalityBehavior, "single") + self.assertEqual(inst.action[0].description, "Administer medications at the appropriate time") + self.assertEqual(inst.action[0].groupingBehavior, "logical-group") + self.assertEqual(inst.action[0].precheckBehavior, "yes") + self.assertEqual(inst.action[0].prefix, "1") + self.assertEqual(inst.action[0].requiredBehavior, "must") + self.assertEqual(inst.action[0].selectionBehavior, "all") + self.assertEqual(inst.action[0].textEquivalent, "Administer medication 1, followed an hour later by medication 2") + self.assertEqual(inst.action[0].timingDateTime.date, FHIRDate("2017-03-06T19:00:00Z").date) + self.assertEqual(inst.action[0].timingDateTime.as_json(), "2017-03-06T19:00:00Z") + self.assertEqual(inst.action[0].title, "Administer Medications") + self.assertEqual(inst.authoredOn.date, FHIRDate("2017-03-06T17:31:00Z").date) + self.assertEqual(inst.authoredOn.as_json(), "2017-03-06T17:31:00Z") + self.assertEqual(inst.contained[0].id, "medicationrequest-1") + self.assertEqual(inst.contained[1].id, "medicationrequest-2") + self.assertEqual(inst.groupIdentifier.system, "http://example.org/treatment-group") + self.assertEqual(inst.groupIdentifier.value, "00001") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.identifier[0].value, "requestgroup-1") + self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "Additional notes about the request group") + self.assertEqual(inst.priority, "routine") + self.assertEqual(inst.reasonCode[0].text, "Treatment") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
Example RequestGroup illustrating related actions to administer medications in sequence with time delay.
") + self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/researchdefinition.py b/fhirclient/models/researchdefinition.py new file mode 100644 index 000000000..111123f7c --- /dev/null +++ b/fhirclient/models/researchdefinition.py @@ -0,0 +1,249 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchDefinition) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class ResearchDefinition(domainresource.DomainResource): + """ A research context or question. + + The ResearchDefinition resource describes the conditional state (population + and any exposures being compared within the population) and outcome (if + specified) that the knowledge (evidence, assertion, recommendation) is + about. + """ + + resource_type = "ResearchDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.approvalDate = None + """ When the research definition was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.comment = None + """ Used for footnotes or explanatory notes. + List of `str` items. """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the research definition. + Type `str`. """ + + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.effectivePeriod = None + """ When the research definition is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.exposure = None + """ What exposure?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.exposureAlternative = None + """ What alternative exposure state?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the research definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for research definition (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the research definition was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.library = None + """ Logic used by the ResearchDefinition. + List of `str` items. """ + + self.name = None + """ Name for this research definition (computer friendly). + Type `str`. """ + + self.outcome = None + """ What outcome?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.population = None + """ What population?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this research definition is defined. + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc.. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.shortTitle = None + """ Title for use in informal contexts. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.subjectCodeableConcept = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate title of the ResearchDefinition. + Type `str`. """ + + self.title = None + """ Name for this research definition (human friendly). + Type `str`. """ + + self.topic = None + """ The category of the ResearchDefinition, such as Education, + Treatment, Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this research definition, represented as a + URI (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the ResearchDefinition. + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the research definition. + Type `str`. """ + + super(ResearchDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchDefinition, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), + ("comment", "comment", str, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("exposure", "exposure", fhirreference.FHIRReference, False, None, False), + ("exposureAlternative", "exposureAlternative", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("library", "library", str, True, None, False), + ("name", "name", str, False, None, False), + ("outcome", "outcome", fhirreference.FHIRReference, False, None, False), + ("population", "population", fhirreference.FHIRReference, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), + ("shortTitle", "shortTitle", str, False, None, False), + ("status", "status", str, False, None, True), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), + ("subtitle", "subtitle", str, False, None, False), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("url", "url", str, False, None, False), + ("usage", "usage", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/researchdefinition_tests.py b/fhirclient/models/researchdefinition_tests.py new file mode 100644 index 000000000..3d8f6ebcd --- /dev/null +++ b/fhirclient/models/researchdefinition_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import researchdefinition +from .fhirdate import FHIRDate + + +class ResearchDefinitionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("ResearchDefinition", js["resourceType"]) + return researchdefinition.ResearchDefinition(js) + + def testResearchDefinition1(self): + inst = self.instantiate_from("researchdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ResearchDefinition instance") + self.implResearchDefinition1(inst) + + js = inst.as_json() + self.assertEqual("ResearchDefinition", js["resourceType"]) + inst2 = researchdefinition.ResearchDefinition(js) + self.implResearchDefinition1(inst2) + + def implResearchDefinition1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/researchelementdefinition.py b/fhirclient/models/researchelementdefinition.py new file mode 100644 index 000000000..17b39e471 --- /dev/null +++ b/fhirclient/models/researchelementdefinition.py @@ -0,0 +1,394 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchElementDefinition) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class ResearchElementDefinition(domainresource.DomainResource): + """ A population, intervention, or exposure definition. + + The ResearchElementDefinition resource describes a "PICO" element that + knowledge (evidence, assertion, recommendation) is about. + """ + + resource_type = "ResearchElementDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.approvalDate = None + """ When the research element definition was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.characteristic = None + """ What defines the members of the research element. + List of `ResearchElementDefinitionCharacteristic` items (represented as `dict` in JSON). """ + + self.comment = None + """ Used for footnotes or explanatory notes. + List of `str` items. """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the research element definition. + Type `str`. """ + + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.effectivePeriod = None + """ When the research element definition is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.identifier = None + """ Additional identifier for the research element definition. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for research element definition (if + applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the research element definition was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.library = None + """ Logic used by the ResearchElementDefinition. + List of `str` items. """ + + self.name = None + """ Name for this research element definition (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this research element definition is defined. + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc.. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.shortTitle = None + """ Title for use in informal contexts. + Type `str`. """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.subjectCodeableConcept = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subjectReference = None + """ E.g. Patient, Practitioner, RelatedPerson, Organization, Location, + Device. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.subtitle = None + """ Subordinate title of the ResearchElementDefinition. + Type `str`. """ + + self.title = None + """ Name for this research element definition (human friendly). + Type `str`. """ + + self.topic = None + """ The category of the ResearchElementDefinition, such as Education, + Treatment, Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ population | exposure | outcome. + Type `str`. """ + + self.url = None + """ Canonical identifier for this research element definition, + represented as a URI (globally unique). + Type `str`. """ + + self.usage = None + """ Describes the clinical usage of the ResearchElementDefinition. + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.variableType = None + """ dichotomous | continuous | descriptive. + Type `str`. """ + + self.version = None + """ Business version of the research element definition. + Type `str`. """ + + super(ResearchElementDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchElementDefinition, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), + ("characteristic", "characteristic", ResearchElementDefinitionCharacteristic, True, None, True), + ("comment", "comment", str, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), + ("experimental", "experimental", bool, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("library", "library", str, True, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), + ("shortTitle", "shortTitle", str, False, None, False), + ("status", "status", str, False, None, True), + ("subjectCodeableConcept", "subjectCodeableConcept", codeableconcept.CodeableConcept, False, "subject", False), + ("subjectReference", "subjectReference", fhirreference.FHIRReference, False, "subject", False), + ("subtitle", "subtitle", str, False, None, False), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", str, False, None, True), + ("url", "url", str, False, None, False), + ("usage", "usage", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("variableType", "variableType", str, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class ResearchElementDefinitionCharacteristic(backboneelement.BackboneElement): + """ What defines the members of the research element. + + A characteristic that defines the members of the research element. Multiple + characteristics are applied with "and" semantics. + """ + + resource_type = "ResearchElementDefinitionCharacteristic" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.definitionCanonical = None + """ What code or expression defines members?. + Type `str`. """ + + self.definitionCodeableConcept = None + """ What code or expression defines members?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.definitionDataRequirement = None + """ What code or expression defines members?. + Type `DataRequirement` (represented as `dict` in JSON). """ + + self.definitionExpression = None + """ What code or expression defines members?. + Type `Expression` (represented as `dict` in JSON). """ + + self.exclude = None + """ Whether the characteristic includes or excludes members. + Type `bool`. """ + + self.participantEffectiveDateTime = None + """ What time period do participants cover. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.participantEffectiveDescription = None + """ What time period do participants cover. + Type `str`. """ + + self.participantEffectiveDuration = None + """ What time period do participants cover. + Type `Duration` (represented as `dict` in JSON). """ + + self.participantEffectiveGroupMeasure = None + """ mean | median | mean-of-mean | mean-of-median | median-of-mean | + median-of-median. + Type `str`. """ + + self.participantEffectivePeriod = None + """ What time period do participants cover. + Type `Period` (represented as `dict` in JSON). """ + + self.participantEffectiveTimeFromStart = None + """ Observation time from study start. + Type `Duration` (represented as `dict` in JSON). """ + + self.participantEffectiveTiming = None + """ What time period do participants cover. + Type `Timing` (represented as `dict` in JSON). """ + + self.studyEffectiveDateTime = None + """ What time period does the study cover. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.studyEffectiveDescription = None + """ What time period does the study cover. + Type `str`. """ + + self.studyEffectiveDuration = None + """ What time period does the study cover. + Type `Duration` (represented as `dict` in JSON). """ + + self.studyEffectiveGroupMeasure = None + """ mean | median | mean-of-mean | mean-of-median | median-of-mean | + median-of-median. + Type `str`. """ + + self.studyEffectivePeriod = None + """ What time period does the study cover. + Type `Period` (represented as `dict` in JSON). """ + + self.studyEffectiveTimeFromStart = None + """ Observation time from study start. + Type `Duration` (represented as `dict` in JSON). """ + + self.studyEffectiveTiming = None + """ What time period does the study cover. + Type `Timing` (represented as `dict` in JSON). """ + + self.unitOfMeasure = None + """ What unit is the outcome described in?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.usageContext = None + """ What code/value pairs define members?. + List of `UsageContext` items (represented as `dict` in JSON). """ + + super(ResearchElementDefinitionCharacteristic, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchElementDefinitionCharacteristic, self).elementProperties() + js.extend([ + ("definitionCanonical", "definitionCanonical", str, False, "definition", True), + ("definitionCodeableConcept", "definitionCodeableConcept", codeableconcept.CodeableConcept, False, "definition", True), + ("definitionDataRequirement", "definitionDataRequirement", datarequirement.DataRequirement, False, "definition", True), + ("definitionExpression", "definitionExpression", expression.Expression, False, "definition", True), + ("exclude", "exclude", bool, False, None, False), + ("participantEffectiveDateTime", "participantEffectiveDateTime", fhirdate.FHIRDate, False, "participantEffective", False), + ("participantEffectiveDescription", "participantEffectiveDescription", str, False, None, False), + ("participantEffectiveDuration", "participantEffectiveDuration", duration.Duration, False, "participantEffective", False), + ("participantEffectiveGroupMeasure", "participantEffectiveGroupMeasure", str, False, None, False), + ("participantEffectivePeriod", "participantEffectivePeriod", period.Period, False, "participantEffective", False), + ("participantEffectiveTimeFromStart", "participantEffectiveTimeFromStart", duration.Duration, False, None, False), + ("participantEffectiveTiming", "participantEffectiveTiming", timing.Timing, False, "participantEffective", False), + ("studyEffectiveDateTime", "studyEffectiveDateTime", fhirdate.FHIRDate, False, "studyEffective", False), + ("studyEffectiveDescription", "studyEffectiveDescription", str, False, None, False), + ("studyEffectiveDuration", "studyEffectiveDuration", duration.Duration, False, "studyEffective", False), + ("studyEffectiveGroupMeasure", "studyEffectiveGroupMeasure", str, False, None, False), + ("studyEffectivePeriod", "studyEffectivePeriod", period.Period, False, "studyEffective", False), + ("studyEffectiveTimeFromStart", "studyEffectiveTimeFromStart", duration.Duration, False, None, False), + ("studyEffectiveTiming", "studyEffectiveTiming", timing.Timing, False, "studyEffective", False), + ("unitOfMeasure", "unitOfMeasure", codeableconcept.CodeableConcept, False, None, False), + ("usageContext", "usageContext", usagecontext.UsageContext, True, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/researchelementdefinition_tests.py b/fhirclient/models/researchelementdefinition_tests.py new file mode 100644 index 000000000..1646921fb --- /dev/null +++ b/fhirclient/models/researchelementdefinition_tests.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import researchelementdefinition +from .fhirdate import FHIRDate + + +class ResearchElementDefinitionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("ResearchElementDefinition", js["resourceType"]) + return researchelementdefinition.ResearchElementDefinition(js) + + def testResearchElementDefinition1(self): + inst = self.instantiate_from("researchelementdefinition-example.json") + self.assertIsNotNone(inst, "Must have instantiated a ResearchElementDefinition instance") + self.implResearchElementDefinition1(inst) + + js = inst.as_json() + self.assertEqual("ResearchElementDefinition", js["resourceType"]) + inst2 = researchelementdefinition.ResearchElementDefinition(js) + self.implResearchElementDefinition1(inst2) + + def implResearchElementDefinition1(self, inst): + self.assertEqual(inst.characteristic[0].definitionCodeableConcept.text, "Diabetic patients over 65") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type, "population") + diff --git a/fhirclient/models/researchstudy.py b/fhirclient/models/researchstudy.py index 47503e823..92aba893b 100644 --- a/fhirclient/models/researchstudy.py +++ b/fhirclient/models/researchstudy.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ResearchStudy) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchStudy) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -36,6 +36,10 @@ def __init__(self, jsondict=None, strict=True): """ Classifications for the study. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.condition = None + """ Condition being studied. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.contact = None """ Contact details for the study. List of `ContactDetail` items (represented as `dict` in JSON). """ @@ -46,46 +50,61 @@ def __init__(self, jsondict=None, strict=True): self.enrollment = None """ Inclusion & exclusion criteria. - List of `FHIRReference` items referencing `Group` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.focus = None - """ Drugs, devices, conditions, etc. under study. + """ Drugs, devices, etc. under study. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.identifier = None """ Business Identifier for study. List of `Identifier` items (represented as `dict` in JSON). """ - self.jurisdiction = None - """ Geographic region(s) for study. - List of `CodeableConcept` items (represented as `dict` in JSON). """ - self.keyword = None """ Used to search for the study. List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.location = None + """ Geographic region(s) for study. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.note = None - """ Comments made about the event. + """ Comments made about the study. List of `Annotation` items (represented as `dict` in JSON). """ + self.objective = None + """ A goal for the study. + List of `ResearchStudyObjective` items (represented as `dict` in JSON). """ + self.partOf = None """ Part of larger study. - List of `FHIRReference` items referencing `ResearchStudy` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.period = None """ When the study began and ended. Type `Period` (represented as `dict` in JSON). """ + self.phase = None + """ n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | + phase-2-phase-3 | phase-3 | phase-4. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.primaryPurposeType = None + """ treatment | prevention | diagnostic | supportive-care | screening | + health-services-research | basic-science | device-feasibility. + Type `CodeableConcept` (represented as `dict` in JSON). """ + self.principalInvestigator = None - """ The individual responsible for the study. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + """ Researcher who oversees multiple aspects of the study. + Type `FHIRReference` (represented as `dict` in JSON). """ self.protocol = None """ Steps followed in executing study. - List of `FHIRReference` items referencing `PlanDefinition` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.reasonStopped = None - """ Reason for terminating study early. + """ accrual-goal-met | closed-due-to-toxicity | closed-due-to-lack-of- + study-progress | temporarily-closed-per-study-design. Type `CodeableConcept` (represented as `dict` in JSON). """ self.relatedArtifact = None @@ -93,16 +112,19 @@ def __init__(self, jsondict=None, strict=True): List of `RelatedArtifact` items (represented as `dict` in JSON). """ self.site = None - """ Location involved in study execution. - List of `FHIRReference` items referencing `Location` (represented as `dict` in JSON). """ + """ Facility where study activities are conducted. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.sponsor = None - """ Organization responsible for the study. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + """ Organization that initiates and is legally responsible for the + study. + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None - """ draft | in-progress | suspended | stopped | completed | entered-in- - error. + """ active | administratively-completed | approved | closed-to-accrual + | closed-to-accrual-and-intervention | completed | disapproved | + in-review | temporarily-closed-to-accrual | temporarily-closed-to- + accrual-and-intervention | withdrawn. Type `str`. """ self.title = None @@ -116,16 +138,20 @@ def elementProperties(self): js.extend([ ("arm", "arm", ResearchStudyArm, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), + ("condition", "condition", codeableconcept.CodeableConcept, True, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("description", "description", str, False, None, False), ("enrollment", "enrollment", fhirreference.FHIRReference, True, None, False), ("focus", "focus", codeableconcept.CodeableConcept, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("keyword", "keyword", codeableconcept.CodeableConcept, True, None, False), + ("location", "location", codeableconcept.CodeableConcept, True, None, False), ("note", "note", annotation.Annotation, True, None, False), + ("objective", "objective", ResearchStudyObjective, True, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("period", "period", period.Period, False, None, False), + ("phase", "phase", codeableconcept.CodeableConcept, False, None, False), + ("primaryPurposeType", "primaryPurposeType", codeableconcept.CodeableConcept, False, None, False), ("principalInvestigator", "principalInvestigator", fhirreference.FHIRReference, False, None, False), ("protocol", "protocol", fhirreference.FHIRReference, True, None, False), ("reasonStopped", "reasonStopped", codeableconcept.CodeableConcept, False, None, False), @@ -158,10 +184,6 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.code = None - """ Categorization of study arm. - Type `CodeableConcept` (represented as `dict` in JSON). """ - self.description = None """ Short explanation of study path. Type `str`. """ @@ -170,14 +192,54 @@ def __init__(self, jsondict=None, strict=True): """ Label for study arm. Type `str`. """ + self.type = None + """ Categorization of study arm. + Type `CodeableConcept` (represented as `dict` in JSON). """ + super(ResearchStudyArm, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(ResearchStudyArm, self).elementProperties() js.extend([ - ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("description", "description", str, False, None, False), ("name", "name", str, False, None, True), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class ResearchStudyObjective(backboneelement.BackboneElement): + """ A goal for the study. + + A goal that the study is aiming to achieve in terms of a scientific + question to be answered by the analysis of data collected during the study. + """ + + resource_type = "ResearchStudyObjective" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.name = None + """ Label for the objective. + Type `str`. """ + + self.type = None + """ primary | secondary | exploratory. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(ResearchStudyObjective, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(ResearchStudyObjective, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js diff --git a/fhirclient/models/researchstudy_tests.py b/fhirclient/models/researchstudy_tests.py index 232df126a..df674f516 100644 --- a/fhirclient/models/researchstudy_tests.py +++ b/fhirclient/models/researchstudy_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -33,7 +33,10 @@ def testResearchStudy1(self): def implResearchStudy1(self, inst): self.assertEqual(inst.id, "example") - self.assertEqual(inst.status, "draft") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/researchsubject.py b/fhirclient/models/researchsubject.py index 87bbde203..ffa51d163 100644 --- a/fhirclient/models/researchsubject.py +++ b/fhirclient/models/researchsubject.py @@ -1,21 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ResearchSubject) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchSubject) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class ResearchSubject(domainresource.DomainResource): - """ Investigation to increase healthcare-related patient-independent knowledge. + """ Physical entity which is the primary unit of interest in the study. - A process where a researcher or organization plans and then executes a - series of steps intended to increase the field of healthcare-related - knowledge. This includes studies of safety, efficacy, comparative - effectiveness and other information about medications, devices, therapies - and other interventional and investigative techniques. A ResearchStudy - involves the gathering of information about human or animal subjects. + A physical entity which is the primary unit of operational and/or + administrative interest in a study. """ resource_type = "ResearchSubject" @@ -38,27 +34,29 @@ def __init__(self, jsondict=None, strict=True): self.consent = None """ Agreement to participate in study. - Type `FHIRReference` referencing `Consent` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None - """ Business Identifier for research subject. - Type `Identifier` (represented as `dict` in JSON). """ + """ Business Identifier for research subject in a study. + List of `Identifier` items (represented as `dict` in JSON). """ self.individual = None """ Who is part of study. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.period = None """ Start and end of participation. Type `Period` (represented as `dict` in JSON). """ self.status = None - """ candidate | enrolled | active | suspended | withdrawn | completed. + """ candidate | eligible | follow-up | ineligible | not-registered | + off-study | on-study | on-study-intervention | on-study-observation + | pending-on-study | potential-candidate | screening | withdrawn. Type `str`. """ self.study = None """ Study subject is part of. - Type `FHIRReference` referencing `ResearchStudy` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(ResearchSubject, self).__init__(jsondict=jsondict, strict=strict) @@ -68,7 +66,7 @@ def elementProperties(self): ("actualArm", "actualArm", str, False, None, False), ("assignedArm", "assignedArm", str, False, None, False), ("consent", "consent", fhirreference.FHIRReference, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("individual", "individual", fhirreference.FHIRReference, False, None, True), ("period", "period", period.Period, False, None, False), ("status", "status", str, False, None, True), diff --git a/fhirclient/models/researchsubject_tests.py b/fhirclient/models/researchsubject_tests.py index 4dc69d48c..6477f4926 100644 --- a/fhirclient/models/researchsubject_tests.py +++ b/fhirclient/models/researchsubject_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -33,9 +33,12 @@ def testResearchSubject1(self): def implResearchSubject1(self, inst): self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier.system, "http://example.org/studysubjectids") - self.assertEqual(inst.identifier.type.text, "Subject id") - self.assertEqual(inst.identifier.value, "123") + self.assertEqual(inst.identifier[0].system, "http://example.org/studysubjectids") + self.assertEqual(inst.identifier[0].type.text, "Subject id") + self.assertEqual(inst.identifier[0].value, "123") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "candidate") self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/resource.py b/fhirclient/models/resource.py index 70774165a..04652dc85 100644 --- a/fhirclient/models/resource.py +++ b/fhirclient/models/resource.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Resource) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Resource) on 2019-05-07. +# 2019, SMART Health IT. from . import fhirabstractresource diff --git a/fhirclient/models/riskassessment.py b/fhirclient/models/riskassessment.py index 9398aa0c4..3c7283f1d 100644 --- a/fhirclient/models/riskassessment.py +++ b/fhirclient/models/riskassessment.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -26,31 +26,27 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Request fulfilled by this assessment. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.basis = None """ Information used in assessment. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.code = None """ Type of assessment. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.comment = None - """ Comments on the risk assessment. - Type `str`. """ - self.condition = None """ Condition assessed. - Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.context = None + self.encounter = None """ Where was assessment performed?. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ Unique identifier for the assessment. - Type `Identifier` (represented as `dict` in JSON). """ + List of `Identifier` items (represented as `dict` in JSON). """ self.method = None """ Evaluation mechanism. @@ -60,6 +56,10 @@ def __init__(self, jsondict=None, strict=True): """ How to reduce risk. Type `str`. """ + self.note = None + """ Comments on the risk assessment. + List of `Annotation` items (represented as `dict` in JSON). """ + self.occurrenceDateTime = None """ When was assessment made?. Type `FHIRDate` (represented as `str` in JSON). """ @@ -70,23 +70,23 @@ def __init__(self, jsondict=None, strict=True): self.parent = None """ Part of this occurrence. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.performer = None """ Who did assessment?. - Type `FHIRReference` referencing `Practitioner, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.prediction = None """ Outcome predicted. List of `RiskAssessmentPrediction` items (represented as `dict` in JSON). """ - self.reasonCodeableConcept = None + self.reasonCode = None """ Why the assessment was necessary?. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None """ Why the assessment was necessary?. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ registered | preliminary | final | amended +. @@ -94,7 +94,7 @@ def __init__(self, jsondict=None, strict=True): self.subject = None """ Who/what does assessment apply to?. - Type `FHIRReference` referencing `Patient, Group` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(RiskAssessment, self).__init__(jsondict=jsondict, strict=strict) @@ -104,21 +104,21 @@ def elementProperties(self): ("basedOn", "basedOn", fhirreference.FHIRReference, False, None, False), ("basis", "basis", fhirreference.FHIRReference, True, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("comment", "comment", str, False, None, False), ("condition", "condition", fhirreference.FHIRReference, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("method", "method", codeableconcept.CodeableConcept, False, None, False), ("mitigation", "mitigation", str, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), ("parent", "parent", fhirreference.FHIRReference, False, None, False), ("performer", "performer", fhirreference.FHIRReference, False, None, False), ("prediction", "prediction", RiskAssessmentPrediction, True, None, False), - ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, True), - ("subject", "subject", fhirreference.FHIRReference, False, None, False), + ("subject", "subject", fhirreference.FHIRReference, False, None, True), ]) return js @@ -178,7 +178,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(RiskAssessmentPrediction, self).elementProperties() js.extend([ - ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, True), + ("outcome", "outcome", codeableconcept.CodeableConcept, False, None, False), ("probabilityDecimal", "probabilityDecimal", float, False, "probability", False), ("probabilityRange", "probabilityRange", range.Range, False, "probability", False), ("qualitativeRisk", "qualitativeRisk", codeableconcept.CodeableConcept, False, None, False), @@ -191,6 +191,10 @@ def elementProperties(self): import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] try: from . import codeableconcept except ImportError: diff --git a/fhirclient/models/riskassessment_tests.py b/fhirclient/models/riskassessment_tests.py index cb64dbaa6..28c50b6e4 100644 --- a/fhirclient/models/riskassessment_tests.py +++ b/fhirclient/models/riskassessment_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return riskassessment.RiskAssessment(js) def testRiskAssessment1(self): - inst = self.instantiate_from("riskassessment-example-cardiac.json") + inst = self.instantiate_from("riskassessment-example-population.json") self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") self.implRiskAssessment1(inst) @@ -32,10 +32,32 @@ def testRiskAssessment1(self): self.implRiskAssessment1(inst2) def implRiskAssessment1(self, inst): + self.assertEqual(inst.contained[0].id, "group1") + self.assertEqual(inst.id, "population") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "generated") + + def testRiskAssessment2(self): + inst = self.instantiate_from("riskassessment-example-cardiac.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment2(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment2(inst2) + + def implRiskAssessment2(self, inst): self.assertEqual(inst.id, "cardiac") - self.assertEqual(inst.identifier.system, "http://example.org") - self.assertEqual(inst.identifier.use, "official") - self.assertEqual(inst.identifier.value, "risk-assessment-cardiac") + self.assertEqual(inst.identifier[0].system, "http://example.org") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "risk-assessment-cardiac") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2014-07-19T16:04:00Z").date) self.assertEqual(inst.occurrenceDateTime.as_json(), "2014-07-19T16:04:00Z") self.assertEqual(inst.prediction[0].outcome.text, "Heart Attack") @@ -51,23 +73,8 @@ def implRiskAssessment1(self, inst): self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "additional") - def testRiskAssessment2(self): - inst = self.instantiate_from("riskassessment-example-population.json") - self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") - self.implRiskAssessment2(inst) - - js = inst.as_json() - self.assertEqual("RiskAssessment", js["resourceType"]) - inst2 = riskassessment.RiskAssessment(js) - self.implRiskAssessment2(inst2) - - def implRiskAssessment2(self, inst): - self.assertEqual(inst.id, "population") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "generated") - def testRiskAssessment3(self): - inst = self.instantiate_from("riskassessment-example-prognosis.json") + inst = self.instantiate_from("riskassessment-example.json") self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") self.implRiskAssessment3(inst) @@ -77,32 +84,12 @@ def testRiskAssessment3(self): self.implRiskAssessment3(inst2) def implRiskAssessment3(self, inst): - self.assertEqual(inst.id, "prognosis") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2010-11-22").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2010-11-22") - self.assertEqual(inst.prediction[0].outcome.coding[0].code, "249943000:363698007=72098002,260868000=6934004") - self.assertEqual(inst.prediction[0].outcome.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.prediction[0].outcome.text, "permanent weakness of the left arm") - self.assertEqual(inst.prediction[0].qualitativeRisk.coding[0].code, "moderate") - self.assertEqual(inst.prediction[0].qualitativeRisk.coding[0].display, "moderate likelihood") - self.assertEqual(inst.prediction[0].qualitativeRisk.coding[0].system, "http://hl7.org/fhir/risk-probability") - self.assertEqual(inst.status, "final") - self.assertEqual(inst.text.status, "additional") - - def testRiskAssessment4(self): - inst = self.instantiate_from("riskassessment-example.json") - self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") - self.implRiskAssessment4(inst) - - js = inst.as_json() - self.assertEqual("RiskAssessment", js["resourceType"]) - inst2 = riskassessment.RiskAssessment(js) - self.implRiskAssessment4(inst2) - - def implRiskAssessment4(self, inst): - self.assertEqual(inst.comment, "High degree of certainty") self.assertEqual(inst.id, "genetic") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.method.coding[0].code, "BRCAPRO") + self.assertEqual(inst.note[0].text, "High degree of certainty") self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2006-01-13T23:01:00Z").date) self.assertEqual(inst.occurrenceDateTime.as_json(), "2006-01-13T23:01:00Z") self.assertEqual(inst.prediction[0].outcome.text, "Breast Cancer") @@ -183,4 +170,56 @@ def implRiskAssessment4(self, inst): self.assertEqual(inst.prediction[7].whenRange.low.value, 83) self.assertEqual(inst.status, "final") self.assertEqual(inst.text.status, "generated") + + def testRiskAssessment4(self): + inst = self.instantiate_from("riskassessment-example-breastcancer.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment4(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment4(inst2) + + def implRiskAssessment4(self, inst): + self.assertEqual(inst.code.coding[0].code, "709510001") + self.assertEqual(inst.code.coding[0].display, "Assessment of risk for disease (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://browser.ihtsdotools.org/") + self.assertEqual(inst.id, "breastcancer-risk") + self.assertEqual(inst.identifier[0].system, "http://example.org") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "risk-assessment-breastcancer1") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "This risk assessment is based on BRCA1 and BRCA2 genetic mutation test") + self.assertEqual(inst.prediction[0].outcome.text, "Unknown risk of developing breast cancer") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "additional") + + def testRiskAssessment5(self): + inst = self.instantiate_from("riskassessment-example-prognosis.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskAssessment instance") + self.implRiskAssessment5(inst) + + js = inst.as_json() + self.assertEqual("RiskAssessment", js["resourceType"]) + inst2 = riskassessment.RiskAssessment(js) + self.implRiskAssessment5(inst2) + + def implRiskAssessment5(self, inst): + self.assertEqual(inst.id, "prognosis") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2010-11-22").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2010-11-22") + self.assertEqual(inst.prediction[0].outcome.coding[0].code, "249943000:363698007=72098002,260868000=6934004") + self.assertEqual(inst.prediction[0].outcome.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.prediction[0].outcome.text, "permanent weakness of the left arm") + self.assertEqual(inst.prediction[0].qualitativeRisk.coding[0].code, "moderate") + self.assertEqual(inst.prediction[0].qualitativeRisk.coding[0].display, "moderate likelihood") + self.assertEqual(inst.prediction[0].qualitativeRisk.coding[0].system, "http://terminology.hl7.org/CodeSystem/risk-probability") + self.assertEqual(inst.status, "final") + self.assertEqual(inst.text.status, "additional") diff --git a/fhirclient/models/riskevidencesynthesis.py b/fhirclient/models/riskevidencesynthesis.py new file mode 100644 index 000000000..3a0e31558 --- /dev/null +++ b/fhirclient/models/riskevidencesynthesis.py @@ -0,0 +1,457 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/RiskEvidenceSynthesis) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class RiskEvidenceSynthesis(domainresource.DomainResource): + """ A quantified estimate of risk based on a body of evidence. + + The RiskEvidenceSynthesis resource describes the likelihood of an outcome + in a population plus exposure state where the risk estimate is derived from + a combination of research studies. + """ + + resource_type = "RiskEvidenceSynthesis" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.approvalDate = None + """ When the risk evidence synthesis was approved by publisher. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.author = None + """ Who authored the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.certainty = None + """ How certain is the risk. + List of `RiskEvidenceSynthesisCertainty` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the risk evidence synthesis. + Type `str`. """ + + self.editor = None + """ Who edited the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.effectivePeriod = None + """ When the risk evidence synthesis is expected to be used. + Type `Period` (represented as `dict` in JSON). """ + + self.endorser = None + """ Who endorsed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.exposure = None + """ What exposure?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.identifier = None + """ Additional identifier for the risk evidence synthesis. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for risk evidence synthesis (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.lastReviewDate = None + """ When the risk evidence synthesis was last reviewed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.name = None + """ Name for this risk evidence synthesis (computer friendly). + Type `str`. """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.outcome = None + """ What outcome?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.population = None + """ What population?. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.relatedArtifact = None + """ Additional documentation, citations, etc.. + List of `RelatedArtifact` items (represented as `dict` in JSON). """ + + self.reviewer = None + """ Who reviewed the content. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.riskEstimate = None + """ What was the estimated risk. + Type `RiskEvidenceSynthesisRiskEstimate` (represented as `dict` in JSON). """ + + self.sampleSize = None + """ What sample size was involved?. + Type `RiskEvidenceSynthesisSampleSize` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.studyType = None + """ Type of study. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.synthesisType = None + """ Type of synthesis. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.title = None + """ Name for this risk evidence synthesis (human friendly). + Type `str`. """ + + self.topic = None + """ The category of the EffectEvidenceSynthesis, such as Education, + Treatment, Assessment, etc.. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this risk evidence synthesis, represented + as a URI (globally unique). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the risk evidence synthesis. + Type `str`. """ + + super(RiskEvidenceSynthesis, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskEvidenceSynthesis, self).elementProperties() + js.extend([ + ("approvalDate", "approvalDate", fhirdate.FHIRDate, False, None, False), + ("author", "author", contactdetail.ContactDetail, True, None, False), + ("certainty", "certainty", RiskEvidenceSynthesisCertainty, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("description", "description", str, False, None, False), + ("editor", "editor", contactdetail.ContactDetail, True, None, False), + ("effectivePeriod", "effectivePeriod", period.Period, False, None, False), + ("endorser", "endorser", contactdetail.ContactDetail, True, None, False), + ("exposure", "exposure", fhirreference.FHIRReference, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("lastReviewDate", "lastReviewDate", fhirdate.FHIRDate, False, None, False), + ("name", "name", str, False, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("outcome", "outcome", fhirreference.FHIRReference, False, None, True), + ("population", "population", fhirreference.FHIRReference, False, None, True), + ("publisher", "publisher", str, False, None, False), + ("relatedArtifact", "relatedArtifact", relatedartifact.RelatedArtifact, True, None, False), + ("reviewer", "reviewer", contactdetail.ContactDetail, True, None, False), + ("riskEstimate", "riskEstimate", RiskEvidenceSynthesisRiskEstimate, False, None, False), + ("sampleSize", "sampleSize", RiskEvidenceSynthesisSampleSize, False, None, False), + ("status", "status", str, False, None, True), + ("studyType", "studyType", codeableconcept.CodeableConcept, False, None, False), + ("synthesisType", "synthesisType", codeableconcept.CodeableConcept, False, None, False), + ("title", "title", str, False, None, False), + ("topic", "topic", codeableconcept.CodeableConcept, True, None, False), + ("url", "url", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class RiskEvidenceSynthesisCertainty(backboneelement.BackboneElement): + """ How certain is the risk. + + A description of the certainty of the risk estimate. + """ + + resource_type = "RiskEvidenceSynthesisCertainty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.certaintySubcomponent = None + """ A component that contributes to the overall certainty. + List of `RiskEvidenceSynthesisCertaintyCertaintySubcomponent` items (represented as `dict` in JSON). """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.rating = None + """ Certainty rating. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(RiskEvidenceSynthesisCertainty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskEvidenceSynthesisCertainty, self).elementProperties() + js.extend([ + ("certaintySubcomponent", "certaintySubcomponent", RiskEvidenceSynthesisCertaintyCertaintySubcomponent, True, None, False), + ("note", "note", annotation.Annotation, True, None, False), + ("rating", "rating", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class RiskEvidenceSynthesisCertaintyCertaintySubcomponent(backboneelement.BackboneElement): + """ A component that contributes to the overall certainty. + + A description of a component of the overall certainty. + """ + + resource_type = "RiskEvidenceSynthesisCertaintyCertaintySubcomponent" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.note = None + """ Used for footnotes or explanatory notes. + List of `Annotation` items (represented as `dict` in JSON). """ + + self.rating = None + """ Subcomponent certainty rating. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of subcomponent of certainty rating. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(RiskEvidenceSynthesisCertaintyCertaintySubcomponent, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskEvidenceSynthesisCertaintyCertaintySubcomponent, self).elementProperties() + js.extend([ + ("note", "note", annotation.Annotation, True, None, False), + ("rating", "rating", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class RiskEvidenceSynthesisRiskEstimate(backboneelement.BackboneElement): + """ What was the estimated risk. + + The estimated risk of the outcome. + """ + + resource_type = "RiskEvidenceSynthesisRiskEstimate" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.denominatorCount = None + """ Sample size for group measured. + Type `int`. """ + + self.description = None + """ Description of risk estimate. + Type `str`. """ + + self.numeratorCount = None + """ Number with the outcome. + Type `int`. """ + + self.precisionEstimate = None + """ How precise the estimate is. + List of `RiskEvidenceSynthesisRiskEstimatePrecisionEstimate` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of risk estimate. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.unitOfMeasure = None + """ What unit is the outcome described in?. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.value = None + """ Point estimate. + Type `float`. """ + + super(RiskEvidenceSynthesisRiskEstimate, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskEvidenceSynthesisRiskEstimate, self).elementProperties() + js.extend([ + ("denominatorCount", "denominatorCount", int, False, None, False), + ("description", "description", str, False, None, False), + ("numeratorCount", "numeratorCount", int, False, None, False), + ("precisionEstimate", "precisionEstimate", RiskEvidenceSynthesisRiskEstimatePrecisionEstimate, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ("unitOfMeasure", "unitOfMeasure", codeableconcept.CodeableConcept, False, None, False), + ("value", "value", float, False, None, False), + ]) + return js + + +class RiskEvidenceSynthesisRiskEstimatePrecisionEstimate(backboneelement.BackboneElement): + """ How precise the estimate is. + + A description of the precision of the estimate for the effect. + """ + + resource_type = "RiskEvidenceSynthesisRiskEstimatePrecisionEstimate" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.from_fhir = None + """ Lower bound. + Type `float`. """ + + self.level = None + """ Level of confidence interval. + Type `float`. """ + + self.to = None + """ Upper bound. + Type `float`. """ + + self.type = None + """ Type of precision estimate. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(RiskEvidenceSynthesisRiskEstimatePrecisionEstimate, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskEvidenceSynthesisRiskEstimatePrecisionEstimate, self).elementProperties() + js.extend([ + ("from_fhir", "from", float, False, None, False), + ("level", "level", float, False, None, False), + ("to", "to", float, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class RiskEvidenceSynthesisSampleSize(backboneelement.BackboneElement): + """ What sample size was involved?. + + A description of the size of the sample involved in the synthesis. + """ + + resource_type = "RiskEvidenceSynthesisSampleSize" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Description of sample size. + Type `str`. """ + + self.numberOfParticipants = None + """ How many participants?. + Type `int`. """ + + self.numberOfStudies = None + """ How many studies?. + Type `int`. """ + + super(RiskEvidenceSynthesisSampleSize, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(RiskEvidenceSynthesisSampleSize, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, False), + ("numberOfParticipants", "numberOfParticipants", int, False, None, False), + ("numberOfStudies", "numberOfStudies", int, False, None, False), + ]) + return js + + +import sys +try: + from . import annotation +except ImportError: + annotation = sys.modules[__package__ + '.annotation'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import period +except ImportError: + period = sys.modules[__package__ + '.period'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/riskevidencesynthesis_tests.py b/fhirclient/models/riskevidencesynthesis_tests.py new file mode 100644 index 000000000..611ed7243 --- /dev/null +++ b/fhirclient/models/riskevidencesynthesis_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import riskevidencesynthesis +from .fhirdate import FHIRDate + + +class RiskEvidenceSynthesisTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("RiskEvidenceSynthesis", js["resourceType"]) + return riskevidencesynthesis.RiskEvidenceSynthesis(js) + + def testRiskEvidenceSynthesis1(self): + inst = self.instantiate_from("riskevidencesynthesis-example.json") + self.assertIsNotNone(inst, "Must have instantiated a RiskEvidenceSynthesis instance") + self.implRiskEvidenceSynthesis1(inst) + + js = inst.as_json() + self.assertEqual("RiskEvidenceSynthesis", js["resourceType"]) + inst2 = riskevidencesynthesis.RiskEvidenceSynthesis(js) + self.implRiskEvidenceSynthesis1(inst2) + + def implRiskEvidenceSynthesis1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/sampleddata.py b/fhirclient/models/sampleddata.py index 7805f5fe7..d716ee69e 100644 --- a/fhirclient/models/sampleddata.py +++ b/fhirclient/models/sampleddata.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/SampledData) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SampledData) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -57,7 +57,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(SampledData, self).elementProperties() js.extend([ - ("data", "data", str, False, None, True), + ("data", "data", str, False, None, False), ("dimensions", "dimensions", int, False, None, True), ("factor", "factor", float, False, None, False), ("lowerLimit", "lowerLimit", float, False, None, False), diff --git a/fhirclient/models/schedule.py b/fhirclient/models/schedule.py index d9662b818..9085ff750 100644 --- a/fhirclient/models/schedule.py +++ b/fhirclient/models/schedule.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Schedule) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Schedule) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,15 +27,11 @@ def __init__(self, jsondict=None, strict=True): Type `bool`. """ self.actor = None - """ The resource this Schedule resource is providing availability - information for. These are expected to usually be one of - HealthcareService, Location, Practitioner, PractitionerRole, - Device, Patient or RelatedPerson. - List of `FHIRReference` items referencing `Patient, Practitioner, PractitionerRole, RelatedPerson, Device, HealthcareService, Location` (represented as `dict` in JSON). """ + """ Resource(s) that availability information is being provided for. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.comment = None - """ Comments on the availability to describe any extended information. - Such as custom constraints on the slots that may be associated. + """ Comments on availability. Type `str`. """ self.identifier = None @@ -43,26 +39,19 @@ def __init__(self, jsondict=None, strict=True): List of `Identifier` items (represented as `dict` in JSON). """ self.planningHorizon = None - """ The period of time that the slots that are attached to this - Schedule resource cover (even if none exist). These cover the - amount of time that an organization's planning horizon; the - interval for which they are currently accepting appointments. This - does not define a "template" for planning outside these dates. + """ Period of time covered by schedule. Type `Period` (represented as `dict` in JSON). """ self.serviceCategory = None - """ A broad categorisation of the service that is to be performed - during this appointment. - Type `CodeableConcept` (represented as `dict` in JSON). """ + """ High-level category. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.serviceType = None - """ The specific service that is to be performed during this - appointment. + """ Specific service. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.specialty = None - """ The specialty of a practitioner that would be required to perform - the service requested in this appointment. + """ Type of specialty needed. List of `CodeableConcept` items (represented as `dict` in JSON). """ super(Schedule, self).__init__(jsondict=jsondict, strict=strict) @@ -75,7 +64,7 @@ def elementProperties(self): ("comment", "comment", str, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("planningHorizon", "planningHorizon", period.Period, False, None, False), - ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, False, None, False), + ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, True, None, False), ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), ]) diff --git a/fhirclient/models/schedule_tests.py b/fhirclient/models/schedule_tests.py index 757ab41ef..258487fc2 100644 --- a/fhirclient/models/schedule_tests.py +++ b/fhirclient/models/schedule_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return schedule.Schedule(js) def testSchedule1(self): - inst = self.instantiate_from("schedule-example.json") + inst = self.instantiate_from("schedule-provider-location1-example.json") self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") self.implSchedule1(inst) @@ -33,25 +33,28 @@ def testSchedule1(self): def implSchedule1(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.comment, "The slots attached to this schedule should be specialized to cover immunizations within the clinic") - self.assertEqual(inst.id, "example") + self.assertEqual(inst.comment, "The slots attached to this schedule are for genetic counselling in the USS Enterprise-D Sickbay.") + self.assertEqual(inst.id, "exampleloc1") self.assertEqual(inst.identifier[0].system, "http://example.org/scheduleid") self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "45") - self.assertEqual(inst.planningHorizon.end.date, FHIRDate("2013-12-25T09:30:00Z").date) - self.assertEqual(inst.planningHorizon.end.as_json(), "2013-12-25T09:30:00Z") - self.assertEqual(inst.planningHorizon.start.date, FHIRDate("2013-12-25T09:15:00Z").date) - self.assertEqual(inst.planningHorizon.start.as_json(), "2013-12-25T09:15:00Z") - self.assertEqual(inst.serviceCategory.coding[0].code, "17") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") - self.assertEqual(inst.serviceType[0].coding[0].code, "57") - self.assertEqual(inst.serviceType[0].coding[0].display, "Immunization") - self.assertEqual(inst.specialty[0].coding[0].code, "408480009") - self.assertEqual(inst.specialty[0].coding[0].display, "Clinical immunology") + self.assertEqual(inst.identifier[0].value, "46") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.planningHorizon.end.date, FHIRDate("2017-12-25T09:30:00Z").date) + self.assertEqual(inst.planningHorizon.end.as_json(), "2017-12-25T09:30:00Z") + self.assertEqual(inst.planningHorizon.start.date, FHIRDate("2017-12-25T09:15:00Z").date) + self.assertEqual(inst.planningHorizon.start.as_json(), "2017-12-25T09:15:00Z") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "17") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") + self.assertEqual(inst.serviceType[0].coding[0].code, "75") + self.assertEqual(inst.serviceType[0].coding[0].display, "Genetic Counselling") + self.assertEqual(inst.specialty[0].coding[0].code, "394580004") + self.assertEqual(inst.specialty[0].coding[0].display, "Clinical genetics") self.assertEqual(inst.text.status, "generated") def testSchedule2(self): - inst = self.instantiate_from("schedule-provider-location1-example.json") + inst = self.instantiate_from("schedule-example.json") self.assertIsNotNone(inst, "Must have instantiated a Schedule instance") self.implSchedule2(inst) @@ -62,21 +65,24 @@ def testSchedule2(self): def implSchedule2(self, inst): self.assertTrue(inst.active) - self.assertEqual(inst.comment, "The slots attached to this schedule are for genetic counselling in the USS Enterprise-D Sickbay.") - self.assertEqual(inst.id, "exampleloc1") + self.assertEqual(inst.comment, "The slots attached to this schedule should be specialized to cover immunizations within the clinic") + self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http://example.org/scheduleid") self.assertEqual(inst.identifier[0].use, "usual") - self.assertEqual(inst.identifier[0].value, "46") - self.assertEqual(inst.planningHorizon.end.date, FHIRDate("2017-12-25T09:30:00Z").date) - self.assertEqual(inst.planningHorizon.end.as_json(), "2017-12-25T09:30:00Z") - self.assertEqual(inst.planningHorizon.start.date, FHIRDate("2017-12-25T09:15:00Z").date) - self.assertEqual(inst.planningHorizon.start.as_json(), "2017-12-25T09:15:00Z") - self.assertEqual(inst.serviceCategory.coding[0].code, "17") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") - self.assertEqual(inst.serviceType[0].coding[0].code, "75") - self.assertEqual(inst.serviceType[0].coding[0].display, "Genetic Counselling") - self.assertEqual(inst.specialty[0].coding[0].code, "394580004") - self.assertEqual(inst.specialty[0].coding[0].display, "Clinical genetics") + self.assertEqual(inst.identifier[0].value, "45") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.planningHorizon.end.date, FHIRDate("2013-12-25T09:30:00Z").date) + self.assertEqual(inst.planningHorizon.end.as_json(), "2013-12-25T09:30:00Z") + self.assertEqual(inst.planningHorizon.start.date, FHIRDate("2013-12-25T09:15:00Z").date) + self.assertEqual(inst.planningHorizon.start.as_json(), "2013-12-25T09:15:00Z") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "17") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") + self.assertEqual(inst.serviceType[0].coding[0].code, "57") + self.assertEqual(inst.serviceType[0].coding[0].display, "Immunization") + self.assertEqual(inst.specialty[0].coding[0].code, "408480009") + self.assertEqual(inst.specialty[0].coding[0].display, "Clinical immunology") self.assertEqual(inst.text.status, "generated") def testSchedule3(self): @@ -96,12 +102,15 @@ def implSchedule3(self, inst): self.assertEqual(inst.identifier[0].system, "http://example.org/scheduleid") self.assertEqual(inst.identifier[0].use, "usual") self.assertEqual(inst.identifier[0].value, "47") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.planningHorizon.end.date, FHIRDate("2017-12-25T09:30:00Z").date) self.assertEqual(inst.planningHorizon.end.as_json(), "2017-12-25T09:30:00Z") self.assertEqual(inst.planningHorizon.start.date, FHIRDate("2017-12-25T09:15:00Z").date) self.assertEqual(inst.planningHorizon.start.as_json(), "2017-12-25T09:15:00Z") - self.assertEqual(inst.serviceCategory.coding[0].code, "31") - self.assertEqual(inst.serviceCategory.coding[0].display, "Specialist Surgical") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "31") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "Specialist Surgical") self.assertEqual(inst.serviceType[0].coding[0].code, "221") self.assertEqual(inst.serviceType[0].coding[0].display, "Surgery - General") self.assertEqual(inst.specialty[0].coding[0].code, "394610002") diff --git a/fhirclient/models/searchparameter.py b/fhirclient/models/searchparameter.py index d90853b31..b638eb571 100644 --- a/fhirclient/models/searchparameter.py +++ b/fhirclient/models/searchparameter.py @@ -1,14 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class SearchParameter(domainresource.DomainResource): - """ Search Parameter for a resource. + """ Search parameter for a resource. A search parameter that defines a named search item that can be used to search/filter on a resource. @@ -49,11 +49,11 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.derivedFrom = None - """ Original Definition for the search parameter. + """ Original definition for the search parameter. Type `str`. """ self.description = None @@ -74,9 +74,17 @@ def __init__(self, jsondict=None, strict=True): self.modifier = None """ missing | exact | contains | not | text | in | not-in | below | - above | type. + above | type | identifier | ofType. List of `str` items. """ + self.multipleAnd = None + """ Allow multiple parameters (and). + Type `bool`. """ + + self.multipleOr = None + """ Allow multiple values per parameter (or). + Type `bool`. """ + self.name = None """ Name for this search parameter (computer friendly). Type `str`. """ @@ -99,15 +107,16 @@ def __init__(self, jsondict=None, strict=True): self.type = None """ number | date | string | token | reference | composite | quantity | - uri. + uri | special. Type `str`. """ self.url = None - """ Logical URI to reference this search parameter (globally unique). + """ Canonical identifier for this search parameter, represented as a + URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -140,6 +149,8 @@ def elementProperties(self): ("expression", "expression", str, False, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("modifier", "modifier", str, True, None, False), + ("multipleAnd", "multipleAnd", bool, False, None, False), + ("multipleOr", "multipleOr", bool, False, None, False), ("name", "name", str, False, None, True), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), @@ -175,7 +186,7 @@ def __init__(self, jsondict=None, strict=True): self.definition = None """ Defines how the part works. - Type `FHIRReference` referencing `SearchParameter` (represented as `dict` in JSON). """ + Type `str`. """ self.expression = None """ Subexpression relative to main expression. @@ -186,7 +197,7 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(SearchParameterComponent, self).elementProperties() js.extend([ - ("definition", "definition", fhirreference.FHIRReference, False, None, True), + ("definition", "definition", str, False, None, True), ("expression", "expression", str, False, None, True), ]) return js @@ -205,10 +216,6 @@ def elementProperties(self): from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] -try: - from . import fhirreference -except ImportError: - fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import usagecontext except ImportError: diff --git a/fhirclient/models/searchparameter_tests.py b/fhirclient/models/searchparameter_tests.py index e8e2cfb01..3129889ce 100644 --- a/fhirclient/models/searchparameter_tests.py +++ b/fhirclient/models/searchparameter_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -82,7 +82,7 @@ def implSearchParameter2(self, inst): self.assertEqual(inst.target[0], "Organization") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type, "reference") - self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example") + self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example-reference") self.assertEqual(inst.xpathUsage, "normal") def testSearchParameter3(self): @@ -120,9 +120,9 @@ def implSearchParameter3(self, inst): self.assertEqual(inst.type, "token") self.assertEqual(inst.url, "http://hl7.org/fhir/SearchParameter/example") self.assertEqual(inst.useContext[0].code.code, "focus") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "positive") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/variant-state") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://terminology.hl7.org/CodeSystem/variant-state") self.assertEqual(inst.version, "1") self.assertEqual(inst.xpath, "f:*/f:id") self.assertEqual(inst.xpathUsage, "normal") diff --git a/fhirclient/models/servicedefinition_tests.py b/fhirclient/models/servicedefinition_tests.py deleted file mode 100644 index f729a0a1a..000000000 --- a/fhirclient/models/servicedefinition_tests.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. - - -import os -import io -import unittest -import json -from . import servicedefinition -from .fhirdate import FHIRDate - - -class ServiceDefinitionTests(unittest.TestCase): - def instantiate_from(self, filename): - datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' - with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: - js = json.load(handle) - self.assertEqual("ServiceDefinition", js["resourceType"]) - return servicedefinition.ServiceDefinition(js) - - def testServiceDefinition1(self): - inst = self.instantiate_from("servicedefinition-example.json") - self.assertIsNotNone(inst, "Must have instantiated a ServiceDefinition instance") - self.implServiceDefinition1(inst) - - js = inst.as_json() - self.assertEqual("ServiceDefinition", js["resourceType"]) - inst2 = servicedefinition.ServiceDefinition(js) - self.implServiceDefinition1(inst2) - - def implServiceDefinition1(self, inst): - self.assertEqual(inst.date.date, FHIRDate("2015-07-22").date) - self.assertEqual(inst.date.as_json(), "2015-07-22") - self.assertEqual(inst.description, "Guideline appropriate ordering is used to assess appropriateness of an order given a patient, a proposed order, and a set of clinical indications.") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "guildeline-appropriate-ordering") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Guideline Appropriate Ordering Module") - self.assertEqual(inst.topic[0].text, "Guideline Appropriate Ordering") - self.assertEqual(inst.topic[1].text, "Appropriate Use Criteria") - self.assertEqual(inst.version, "1.0.0") - diff --git a/fhirclient/models/procedurerequest.py b/fhirclient/models/servicerequest.py similarity index 57% rename from fhirclient/models/procedurerequest.py rename to fhirclient/models/servicerequest.py index f0ce0df84..3d5cda6fa 100644 --- a/fhirclient/models/procedurerequest.py +++ b/fhirclient/models/servicerequest.py @@ -1,20 +1,20 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ServiceRequest) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource -class ProcedureRequest(domainresource.DomainResource): - """ A request for a procedure or diagnostic to be performed. +class ServiceRequest(domainresource.DomainResource): + """ A request for a service to be performed. - A record of a request for diagnostic investigations, treatments, or - operations to be performed. + A record of a request for service such as diagnostic investigations, + treatments, or operations to be performed. """ - resource_type = "ProcedureRequest" + resource_type = "ServiceRequest" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -25,11 +25,11 @@ def __init__(self, jsondict=None, strict=True): """ self.asNeededBoolean = None - """ Preconditions for procedure or diagnostic. + """ Preconditions for service. Type `bool`. """ self.asNeededCodeableConcept = None - """ Preconditions for procedure or diagnostic. + """ Preconditions for service. Type `CodeableConcept` (represented as `dict` in JSON). """ self.authoredOn = None @@ -38,59 +38,83 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ What request fulfills. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.bodySite = None """ Location on Body. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.category = None - """ Classification of procedure. + """ Classification of service. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.code = None """ What is being requested/ordered. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.context = None - """ Encounter or Episode during which request was created. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - - self.definition = None - """ Protocol or definition. - List of `FHIRReference` items referencing `ActivityDefinition, PlanDefinition` (represented as `dict` in JSON). """ - self.doNotPerform = None - """ True if procedure should not be performed. + """ True if service/procedure should not be performed. Type `bool`. """ + self.encounter = None + """ Encounter in which the request was created. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.identifier = None """ Identifiers assigned to this order. List of `Identifier` items (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Instantiates FHIR protocol or definition. + List of `str` items. """ + + self.instantiatesUri = None + """ Instantiates external protocol or definition. + List of `str` items. """ + + self.insurance = None + """ Associated insurance coverage. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.intent = None """ proposal | plan | order +. Type `str`. """ + self.locationCode = None + """ Requested location. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.locationReference = None + """ Requested location. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.note = None """ Comments. List of `Annotation` items (represented as `dict` in JSON). """ self.occurrenceDateTime = None - """ When procedure should occur. + """ When service should occur. Type `FHIRDate` (represented as `str` in JSON). """ self.occurrencePeriod = None - """ When procedure should occur. + """ When service should occur. Type `Period` (represented as `dict` in JSON). """ self.occurrenceTiming = None - """ When procedure should occur. + """ When service should occur. Type `Timing` (represented as `dict` in JSON). """ + self.orderDetail = None + """ Additional order information. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.patientInstruction = None + """ Patient or consumer-oriented instructions. + Type `str`. """ + self.performer = None - """ Requested perfomer. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, Device, RelatedPerson, HealthcareService` (represented as `dict` in JSON). """ + """ Requested performer. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.performerType = None """ Performer role. @@ -100,25 +124,37 @@ def __init__(self, jsondict=None, strict=True): """ routine | urgent | asap | stat. Type `str`. """ + self.quantityQuantity = None + """ Service amount. + Type `Quantity` (represented as `dict` in JSON). """ + + self.quantityRange = None + """ Service amount. + Type `Range` (represented as `dict` in JSON). """ + + self.quantityRatio = None + """ Service amount. + Type `Ratio` (represented as `dict` in JSON). """ + self.reasonCode = None - """ Explanation/Justification for test. + """ Explanation/Justification for procedure or service. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None - """ Explanation/Justification for test. - List of `FHIRReference` items referencing `Condition, Observation` (represented as `dict` in JSON). """ + """ Explanation/Justification for service or service. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.relevantHistory = None """ Request provenance. - List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.replaces = None """ What request replaces. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.requester = None - """ Who/what is requesting procedure or diagnostic. - Type `ProcedureRequestRequester` (represented as `dict` in JSON). """ + """ Who/what is requesting service. + Type `FHIRReference` (represented as `dict` in JSON). """ self.requisition = None """ Composite Request ID. @@ -126,7 +162,7 @@ def __init__(self, jsondict=None, strict=True): self.specimen = None """ Procedure Samples. - List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ draft | active | suspended | completed | entered-in-error | @@ -134,17 +170,17 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.subject = None - """ Individual the service is ordered for. - Type `FHIRReference` referencing `Patient, Group, Location, Device` (represented as `dict` in JSON). """ + """ Individual or Entity the service is ordered for. + Type `FHIRReference` (represented as `dict` in JSON). """ self.supportingInfo = None """ Additional clinical information. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ - super(ProcedureRequest, self).__init__(jsondict=jsondict, strict=strict) + super(ServiceRequest, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(ProcedureRequest, self).elementProperties() + js = super(ServiceRequest, self).elementProperties() js.extend([ ("asNeededBoolean", "asNeededBoolean", bool, False, "asNeeded", False), ("asNeededCodeableConcept", "asNeededCodeableConcept", codeableconcept.CodeableConcept, False, "asNeeded", False), @@ -152,24 +188,33 @@ def elementProperties(self): ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("bodySite", "bodySite", codeableconcept.CodeableConcept, True, None, False), ("category", "category", codeableconcept.CodeableConcept, True, None, False), - ("code", "code", codeableconcept.CodeableConcept, False, None, True), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definition", "definition", fhirreference.FHIRReference, True, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), ("doNotPerform", "doNotPerform", bool, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, True, None, False), + ("instantiatesUri", "instantiatesUri", str, True, None, False), + ("insurance", "insurance", fhirreference.FHIRReference, True, None, False), ("intent", "intent", str, False, None, True), + ("locationCode", "locationCode", codeableconcept.CodeableConcept, True, None, False), + ("locationReference", "locationReference", fhirreference.FHIRReference, True, None, False), ("note", "note", annotation.Annotation, True, None, False), ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), - ("performer", "performer", fhirreference.FHIRReference, False, None, False), + ("orderDetail", "orderDetail", codeableconcept.CodeableConcept, True, None, False), + ("patientInstruction", "patientInstruction", str, False, None, False), + ("performer", "performer", fhirreference.FHIRReference, True, None, False), ("performerType", "performerType", codeableconcept.CodeableConcept, False, None, False), ("priority", "priority", str, False, None, False), + ("quantityQuantity", "quantityQuantity", quantity.Quantity, False, "quantity", False), + ("quantityRange", "quantityRange", range.Range, False, "quantity", False), + ("quantityRatio", "quantityRatio", ratio.Ratio, False, "quantity", False), ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, None, False), ("replaces", "replaces", fhirreference.FHIRReference, True, None, False), - ("requester", "requester", ProcedureRequestRequester, False, None, False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), ("requisition", "requisition", identifier.Identifier, False, None, False), ("specimen", "specimen", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, True), @@ -179,44 +224,6 @@ def elementProperties(self): return js -from . import backboneelement - -class ProcedureRequestRequester(backboneelement.BackboneElement): - """ Who/what is requesting procedure or diagnostic. - - The individual who initiated the request and has responsibility for its - activation. - """ - - resource_type = "ProcedureRequestRequester" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.agent = None - """ Individual making the request. - Type `FHIRReference` referencing `Device, Practitioner, Organization` (represented as `dict` in JSON). """ - - self.onBehalfOf = None - """ Organization agent is acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - super(ProcedureRequestRequester, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(ProcedureRequestRequester, self).elementProperties() - js.extend([ - ("agent", "agent", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), - ]) - return js - - import sys try: from . import annotation @@ -242,6 +249,18 @@ def elementProperties(self): from . import period except ImportError: period = sys.modules[__package__ + '.period'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] try: from . import timing except ImportError: diff --git a/fhirclient/models/servicerequest_tests.py b/fhirclient/models/servicerequest_tests.py new file mode 100644 index 000000000..0dbb2b06d --- /dev/null +++ b/fhirclient/models/servicerequest_tests.py @@ -0,0 +1,332 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import servicerequest +from .fhirdate import FHIRDate + + +class ServiceRequestTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("ServiceRequest", js["resourceType"]) + return servicerequest.ServiceRequest(js) + + def testServiceRequest1(self): + inst = self.instantiate_from("servicerequest-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest1(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest1(inst2) + + def implServiceRequest1(self, inst): + self.assertEqual(inst.asNeededCodeableConcept.text, "as needed to clear mucus") + self.assertEqual(inst.authoredOn.date, FHIRDate("2017-02-01T17:23:07Z").date) + self.assertEqual(inst.authoredOn.as_json(), "2017-02-01T17:23:07Z") + self.assertEqual(inst.code.coding[0].code, "34431008") + self.assertEqual(inst.code.coding[0].display, "Physiotherapy of chest (regime/therapy) ") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.contained[0].id, "signature") + self.assertEqual(inst.contained[1].id, "cystic-fibrosis") + self.assertEqual(inst.id, "physiotherapy") + self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/placer-ids") + self.assertEqual(inst.identifier[0].type.coding[0].code, "PLAC") + self.assertEqual(inst.identifier[0].type.coding[0].display, "Placer Identifier") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].type.text, "Placer") + self.assertEqual(inst.identifier[0].value, "20170201-0001") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceTiming.repeat.duration, 15) + self.assertEqual(inst.occurrenceTiming.repeat.durationMax, 25) + self.assertEqual(inst.occurrenceTiming.repeat.durationUnit, "min") + self.assertEqual(inst.occurrenceTiming.repeat.frequency, 1) + self.assertEqual(inst.occurrenceTiming.repeat.frequencyMax, 4) + self.assertEqual(inst.occurrenceTiming.repeat.period, 1) + self.assertEqual(inst.occurrenceTiming.repeat.periodUnit, "d") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest2(self): + inst = self.instantiate_from("servicerequest-example3.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest2(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest2(inst2) + + def implServiceRequest2(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2017-02-01T17:23:07Z").date) + self.assertEqual(inst.authoredOn.as_json(), "2017-02-01T17:23:07Z") + self.assertEqual(inst.code.coding[0].code, "359962006") + self.assertEqual(inst.code.coding[0].display, "Turning patient in bed (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertTrue(inst.doNotPerform) + self.assertEqual(inst.id, "do-not-turn") + self.assertEqual(inst.identifier[0].system, "http://goodhealth.org/placer-ids") + self.assertEqual(inst.identifier[0].value, "20170201-0002") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority, "stat") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest3(self): + inst = self.instantiate_from("servicerequest-example-lipid.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest3(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest3(inst2) + + def implServiceRequest3(self, inst): + self.assertEqual(inst.code.coding[0].code, "LIPID") + self.assertEqual(inst.code.coding[0].system, "http://acme.org/tests") + self.assertEqual(inst.code.text, "Lipid Panel") + self.assertEqual(inst.contained[0].id, "fasting") + self.assertEqual(inst.contained[1].id, "serum") + self.assertEqual(inst.id, "lipid") + self.assertEqual(inst.identifier[0].system, "urn:oid:1.3.4.5.6.7") + self.assertEqual(inst.identifier[0].type.coding[0].code, "PLAC") + self.assertEqual(inst.identifier[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0203") + self.assertEqual(inst.identifier[0].type.text, "Placer") + self.assertEqual(inst.identifier[0].value, "2345234234234") + self.assertEqual(inst.intent, "original-order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "patient is afraid of needles") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2013-05-02T16:16:00-07:00").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2013-05-02T16:16:00-07:00") + self.assertEqual(inst.reasonCode[0].coding[0].code, "V173") + self.assertEqual(inst.reasonCode[0].coding[0].display, "Fam hx-ischem heart dis") + self.assertEqual(inst.reasonCode[0].coding[0].system, "http://hl7.org/fhir/sid/icd-9") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest4(self): + inst = self.instantiate_from("servicerequest-example-colonoscopy-bx.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest4(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest4(inst2) + + def implServiceRequest4(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2017-03-05").date) + self.assertEqual(inst.authoredOn.as_json(), "2017-03-05") + self.assertEqual(inst.code.coding[0].code, "76164006") + self.assertEqual(inst.code.coding[0].display, "Biopsy of colon (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Biopsy of colon") + self.assertEqual(inst.id, "colon-biopsy") + self.assertEqual(inst.identifier[0].value, "12345") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.requisition.system, "http://bumc.org/requisitions") + self.assertEqual(inst.requisition.value, "req12345") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest5(self): + inst = self.instantiate_from("servicerequest-example4.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest5(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest5(inst2) + + def implServiceRequest5(self, inst): + self.assertEqual(inst.code.coding[0].code, "229115003") + self.assertEqual(inst.code.coding[0].display, "Bench Press (regime/therapy) ") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "benchpress") + self.assertEqual(inst.intent, "plan") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceTiming.repeat.count, 20) + self.assertEqual(inst.occurrenceTiming.repeat.countMax, 30) + self.assertEqual(inst.occurrenceTiming.repeat.frequency, 3) + self.assertEqual(inst.occurrenceTiming.repeat.period, 1) + self.assertEqual(inst.occurrenceTiming.repeat.periodUnit, "wk") + self.assertEqual(inst.patientInstruction, "Start with 30kg 10-15 repetitions for three sets and increase in increments of 5kg when you feel ready") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest6(self): + inst = self.instantiate_from("servicerequest-example-edu.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest6(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest6(inst2) + + def implServiceRequest6(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2016-08-16").date) + self.assertEqual(inst.authoredOn.as_json(), "2016-08-16") + self.assertEqual(inst.category[0].coding[0].code, "311401005") + self.assertEqual(inst.category[0].coding[0].display, "Patient education (procedure)") + self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].text, "Education") + self.assertEqual(inst.code.coding[0].code, "48023004") + self.assertEqual(inst.code.coding[0].display, "Breast self-examination technique education (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Health education - breast examination") + self.assertEqual(inst.id, "education") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2014-08-16").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2014-08-16") + self.assertEqual(inst.reasonCode[0].text, "early detection of breast mass") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest7(self): + inst = self.instantiate_from("servicerequest-example-ventilation.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest7(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest7(inst2) + + def implServiceRequest7(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2018-02-20").date) + self.assertEqual(inst.authoredOn.as_json(), "2018-02-20") + self.assertEqual(inst.code.coding[0].code, "40617009") + self.assertEqual(inst.code.coding[0].display, "Artificial respiration (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Mechanical Ventilation") + self.assertEqual(inst.id, "vent") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.orderDetail[0].coding[0].code, "243144002") + self.assertEqual(inst.orderDetail[0].coding[0].display, "Patient triggered inspiratory assistance (procedure)") + self.assertEqual(inst.orderDetail[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.orderDetail[0].text, "IPPB") + self.assertEqual(inst.orderDetail[1].text, " Initial Settings : Sens: -1 cm H20 Pressure 15 cm H2O moderate flow: Monitor VS every 15 minutes x 4 at the start of mechanical ventilation, then routine for unit OR every 5 hr") + self.assertEqual(inst.reasonCode[0].text, "chronic obstructive lung disease (COLD)") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest8(self): + inst = self.instantiate_from("servicerequest-example-ambulation.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest8(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest8(inst2) + + def implServiceRequest8(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2017-03-05").date) + self.assertEqual(inst.authoredOn.as_json(), "2017-03-05") + self.assertEqual(inst.code.coding[0].code, "62013009") + self.assertEqual(inst.code.coding[0].display, "Ambulating patient (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Ambulation") + self.assertEqual(inst.id, "ambulation") + self.assertEqual(inst.identifier[0].value, "45678") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest9(self): + inst = self.instantiate_from("servicerequest-example-pt.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest9(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest9(inst2) + + def implServiceRequest9(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2016-09-20").date) + self.assertEqual(inst.authoredOn.as_json(), "2016-09-20") + self.assertEqual(inst.bodySite[0].coding[0].code, "36701003") + self.assertEqual(inst.bodySite[0].coding[0].display, "Both knees (body structure)") + self.assertEqual(inst.bodySite[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.bodySite[0].text, "Both knees") + self.assertEqual(inst.category[0].coding[0].code, "386053000") + self.assertEqual(inst.category[0].coding[0].display, "Evaluation procedure (procedure)") + self.assertEqual(inst.category[0].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.category[0].text, "Evaluation") + self.assertEqual(inst.code.coding[0].code, "710830005") + self.assertEqual(inst.code.coding[0].display, "Assessment of passive range of motion (procedure)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.code.text, "Assessment of passive range of motion") + self.assertEqual(inst.id, "physical-therapy") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2016-09-27").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2016-09-27") + self.assertEqual(inst.reasonCode[0].text, "assessment of mobility limitations due to osteoarthritis") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testServiceRequest10(self): + inst = self.instantiate_from("servicerequest-example-di.json") + self.assertIsNotNone(inst, "Must have instantiated a ServiceRequest instance") + self.implServiceRequest10(inst) + + js = inst.as_json() + self.assertEqual("ServiceRequest", js["resourceType"]) + inst2 = servicerequest.ServiceRequest(js) + self.implServiceRequest10(inst2) + + def implServiceRequest10(self, inst): + self.assertEqual(inst.code.coding[0].code, "24627-2") + self.assertEqual(inst.code.coding[0].system, "http://loinc.org") + self.assertEqual(inst.code.text, "Chest CT") + self.assertEqual(inst.id, "di") + self.assertEqual(inst.intent, "original-order") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2013-05-08T09:33:27+07:00").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2013-05-08T09:33:27+07:00") + self.assertEqual(inst.reasonCode[0].text, "Check for metastatic disease") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/signature.py b/fhirclient/models/signature.py index 0054a5aed..873a37e8a 100644 --- a/fhirclient/models/signature.py +++ b/fhirclient/models/signature.py @@ -1,19 +1,20 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Signature) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Signature) on 2019-05-07. +# 2019, SMART Health IT. from . import element class Signature(element.Element): - """ A digital Signature - XML DigSig, JWT, Graphical image of signature, etc.. + """ A Signature - XML DigSig, JWS, Graphical image of signature, etc.. - A digital signature along with supporting context. The signature may be - electronic/cryptographic in nature, or a graphical image representing a - hand-written signature, or a signature process. Different signature - approaches have different utilities. + A signature along with supporting context. The signature may be a digital + signature that is cryptographic in nature, or some other signature + acceptable to the domain. This other signature may be as simple as a + graphical image representing a hand-written signature, or a signature + ceremony Different signature approaches have different utilities. """ resource_type = "Signature" @@ -26,20 +27,20 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.blob = None - """ The actual signature content (XML DigSig. JWT, picture, etc.). + self.data = None + """ The actual signature content (XML DigSig. JWS, picture, etc.). Type `str`. """ - self.contentType = None + self.onBehalfOf = None + """ The party represented. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.sigFormat = None """ The technical format of the signature. Type `str`. """ - self.onBehalfOfReference = None - """ The party represented. - Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Device, Organization` (represented as `dict` in JSON). """ - - self.onBehalfOfUri = None - """ The party represented. + self.targetFormat = None + """ The technical format of the signed resources. Type `str`. """ self.type = None @@ -50,27 +51,22 @@ def __init__(self, jsondict=None, strict=True): """ When the signature was created. Type `FHIRDate` (represented as `str` in JSON). """ - self.whoReference = None - """ Who signed. - Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Device, Organization` (represented as `dict` in JSON). """ - - self.whoUri = None + self.who = None """ Who signed. - Type `str`. """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(Signature, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(Signature, self).elementProperties() js.extend([ - ("blob", "blob", str, False, None, False), - ("contentType", "contentType", str, False, None, False), - ("onBehalfOfReference", "onBehalfOfReference", fhirreference.FHIRReference, False, "onBehalfOf", False), - ("onBehalfOfUri", "onBehalfOfUri", str, False, "onBehalfOf", False), + ("data", "data", str, False, None, False), + ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("sigFormat", "sigFormat", str, False, None, False), + ("targetFormat", "targetFormat", str, False, None, False), ("type", "type", coding.Coding, True, None, True), ("when", "when", fhirdate.FHIRDate, False, None, True), - ("whoReference", "whoReference", fhirreference.FHIRReference, False, "who", True), - ("whoUri", "whoUri", str, False, "who", True), + ("who", "who", fhirreference.FHIRReference, False, None, True), ]) return js diff --git a/fhirclient/models/slot.py b/fhirclient/models/slot.py index 82263840a..c052d631d 100644 --- a/fhirclient/models/slot.py +++ b/fhirclient/models/slot.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Slot) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Slot) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -47,12 +47,12 @@ def __init__(self, jsondict=None, strict=True): self.schedule = None """ The schedule resource that this slot defines an interval of status information. - Type `FHIRReference` referencing `Schedule` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.serviceCategory = None - """ A broad categorisation of the service that is to be performed + """ A broad categorization of the service that is to be performed during this appointment. - Type `CodeableConcept` (represented as `dict` in JSON). """ + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.serviceType = None """ The type of appointments that can be booked into this slot (ideally @@ -85,7 +85,7 @@ def elementProperties(self): ("identifier", "identifier", identifier.Identifier, True, None, False), ("overbooked", "overbooked", bool, False, None, False), ("schedule", "schedule", fhirreference.FHIRReference, False, None, True), - ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, False, None, False), + ("serviceCategory", "serviceCategory", codeableconcept.CodeableConcept, True, None, False), ("serviceType", "serviceType", codeableconcept.CodeableConcept, True, None, False), ("specialty", "specialty", codeableconcept.CodeableConcept, True, None, False), ("start", "start", fhirdate.FHIRDate, False, None, True), diff --git a/fhirclient/models/slot_tests.py b/fhirclient/models/slot_tests.py index ab3f877d7..63ec61e60 100644 --- a/fhirclient/models/slot_tests.py +++ b/fhirclient/models/slot_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -38,16 +38,19 @@ def implSlot1(self, inst): self.assertEqual(inst.id, "1") self.assertEqual(inst.identifier[0].system, "http://example.org/identifiers/slots") self.assertEqual(inst.identifier[0].value, "123132") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertTrue(inst.overbooked) - self.assertEqual(inst.serviceCategory.coding[0].code, "17") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "17") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") self.assertEqual(inst.start.date, FHIRDate("2013-12-25T09:00:00Z").date) self.assertEqual(inst.start.as_json(), "2013-12-25T09:00:00Z") self.assertEqual(inst.status, "busy") self.assertEqual(inst.text.status, "generated") def testSlot2(self): - inst = self.instantiate_from("slot-example-tentative.json") + inst = self.instantiate_from("slot-example.json") self.assertIsNotNone(inst, "Must have instantiated a Slot instance") self.implSlot2(inst) @@ -57,15 +60,25 @@ def testSlot2(self): self.implSlot2(inst2) def implSlot2(self, inst): - self.assertEqual(inst.comment, "Dr Careful is out of the office") - self.assertEqual(inst.end.date, FHIRDate("2013-12-25T10:00:00Z").date) - self.assertEqual(inst.end.as_json(), "2013-12-25T10:00:00Z") - self.assertEqual(inst.id, "2") - self.assertEqual(inst.serviceCategory.coding[0].code, "17") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") - self.assertEqual(inst.start.date, FHIRDate("2013-12-25T09:45:00Z").date) - self.assertEqual(inst.start.as_json(), "2013-12-25T09:45:00Z") - self.assertEqual(inst.status, "busy-tentative") + self.assertEqual(inst.appointmentType.coding[0].code, "WALKIN") + self.assertEqual(inst.appointmentType.coding[0].display, "A previously unscheduled walk-in visit") + self.assertEqual(inst.appointmentType.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0276") + self.assertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T09:30:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T09:30:00Z") + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "17") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") + self.assertEqual(inst.serviceType[0].coding[0].code, "57") + self.assertEqual(inst.serviceType[0].coding[0].display, "Immunization") + self.assertEqual(inst.specialty[0].coding[0].code, "408480009") + self.assertEqual(inst.specialty[0].coding[0].display, "Clinical immunology") + self.assertEqual(inst.start.date, FHIRDate("2013-12-25T09:15:00Z").date) + self.assertEqual(inst.start.as_json(), "2013-12-25T09:15:00Z") + self.assertEqual(inst.status, "free") self.assertEqual(inst.text.status, "generated") def testSlot3(self): @@ -83,15 +96,18 @@ def implSlot3(self, inst): self.assertEqual(inst.end.date, FHIRDate("2013-12-25T09:45:00Z").date) self.assertEqual(inst.end.as_json(), "2013-12-25T09:45:00Z") self.assertEqual(inst.id, "3") - self.assertEqual(inst.serviceCategory.coding[0].code, "17") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "17") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") self.assertEqual(inst.start.date, FHIRDate("2013-12-25T09:30:00Z").date) self.assertEqual(inst.start.as_json(), "2013-12-25T09:30:00Z") self.assertEqual(inst.status, "busy-unavailable") self.assertEqual(inst.text.status, "generated") def testSlot4(self): - inst = self.instantiate_from("slot-example.json") + inst = self.instantiate_from("slot-example-tentative.json") self.assertIsNotNone(inst, "Must have instantiated a Slot instance") self.implSlot4(inst) @@ -101,21 +117,17 @@ def testSlot4(self): self.implSlot4(inst2) def implSlot4(self, inst): - self.assertEqual(inst.appointmentType.coding[0].code, "WALKIN") - self.assertEqual(inst.appointmentType.coding[0].display, "A previously unscheduled walk-in visit") - self.assertEqual(inst.appointmentType.coding[0].system, "http://hl7.org/fhir/v2/0276") - self.assertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") - self.assertEqual(inst.end.date, FHIRDate("2013-12-25T09:30:00Z").date) - self.assertEqual(inst.end.as_json(), "2013-12-25T09:30:00Z") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.serviceCategory.coding[0].code, "17") - self.assertEqual(inst.serviceCategory.coding[0].display, "General Practice") - self.assertEqual(inst.serviceType[0].coding[0].code, "57") - self.assertEqual(inst.serviceType[0].coding[0].display, "Immunization") - self.assertEqual(inst.specialty[0].coding[0].code, "408480009") - self.assertEqual(inst.specialty[0].coding[0].display, "Clinical immunology") - self.assertEqual(inst.start.date, FHIRDate("2013-12-25T09:15:00Z").date) - self.assertEqual(inst.start.as_json(), "2013-12-25T09:15:00Z") - self.assertEqual(inst.status, "free") + self.assertEqual(inst.comment, "Dr Careful is out of the office") + self.assertEqual(inst.end.date, FHIRDate("2013-12-25T10:00:00Z").date) + self.assertEqual(inst.end.as_json(), "2013-12-25T10:00:00Z") + self.assertEqual(inst.id, "2") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.serviceCategory[0].coding[0].code, "17") + self.assertEqual(inst.serviceCategory[0].coding[0].display, "General Practice") + self.assertEqual(inst.start.date, FHIRDate("2013-12-25T09:45:00Z").date) + self.assertEqual(inst.start.as_json(), "2013-12-25T09:45:00Z") + self.assertEqual(inst.status, "busy-tentative") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/specimen.py b/fhirclient/models/specimen.py index 35d73ff3b..e1dd9b5ba 100644 --- a/fhirclient/models/specimen.py +++ b/fhirclient/models/specimen.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Specimen) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Specimen) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -31,6 +31,10 @@ def __init__(self, jsondict=None, strict=True): """ Collection details. Type `SpecimenCollection` (represented as `dict` in JSON). """ + self.condition = None + """ State of the specimen. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + self.container = None """ Direct container of specimen (tube/slide, etc.). List of `SpecimenContainer` items (represented as `dict` in JSON). """ @@ -45,7 +49,7 @@ def __init__(self, jsondict=None, strict=True): self.parent = None """ Specimen from which this specimen originated. - List of `FHIRReference` items referencing `Specimen` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.processing = None """ Processing and processing step details. @@ -57,16 +61,17 @@ def __init__(self, jsondict=None, strict=True): self.request = None """ Why the specimen was collected. - List of `FHIRReference` items referencing `ProcedureRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ available | unavailable | unsatisfactory | entered-in-error. Type `str`. """ self.subject = None - """ Where the specimen came from. This may be from the patient(s) or - from the environment or a device. - Type `FHIRReference` referencing `Patient, Group, Device, Substance` (represented as `dict` in JSON). """ + """ Where the specimen came from. This may be from patient(s), from a + location (e.g., the source of an environmental sample), or a + sampling of a substance or a device. + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ Kind of material that forms the specimen. @@ -79,6 +84,7 @@ def elementProperties(self): js.extend([ ("accessionIdentifier", "accessionIdentifier", identifier.Identifier, False, None, False), ("collection", "collection", SpecimenCollection, False, None, False), + ("condition", "condition", codeableconcept.CodeableConcept, True, None, False), ("container", "container", SpecimenContainer, True, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("note", "note", annotation.Annotation, True, None, False), @@ -87,7 +93,7 @@ def elementProperties(self): ("receivedTime", "receivedTime", fhirdate.FHIRDate, False, None, False), ("request", "request", fhirreference.FHIRReference, True, None, False), ("status", "status", str, False, None, False), - ("subject", "subject", fhirreference.FHIRReference, False, None, True), + ("subject", "subject", fhirreference.FHIRReference, False, None, False), ("type", "type", codeableconcept.CodeableConcept, False, None, False), ]) return js @@ -125,7 +131,19 @@ def __init__(self, jsondict=None, strict=True): self.collector = None """ Who collected the specimen. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.duration = None + """ How long it took to collect specimen. + Type `Duration` (represented as `dict` in JSON). """ + + self.fastingStatusCodeableConcept = None + """ Whether or how long patient abstained from food and/or drink. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fastingStatusDuration = None + """ Whether or how long patient abstained from food and/or drink. + Type `Duration` (represented as `dict` in JSON). """ self.method = None """ Technique used to perform collection. @@ -144,6 +162,9 @@ def elementProperties(self): ("collectedDateTime", "collectedDateTime", fhirdate.FHIRDate, False, "collected", False), ("collectedPeriod", "collectedPeriod", period.Period, False, "collected", False), ("collector", "collector", fhirreference.FHIRReference, False, None, False), + ("duration", "duration", duration.Duration, False, None, False), + ("fastingStatusCodeableConcept", "fastingStatusCodeableConcept", codeableconcept.CodeableConcept, False, "fastingStatus", False), + ("fastingStatusDuration", "fastingStatusDuration", duration.Duration, False, "fastingStatus", False), ("method", "method", codeableconcept.CodeableConcept, False, None, False), ("quantity", "quantity", quantity.Quantity, False, None, False), ]) @@ -173,7 +194,7 @@ def __init__(self, jsondict=None, strict=True): self.additiveReference = None """ Additive associated with container. - Type `FHIRReference` referencing `Substance` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.capacity = None """ Container volume or size. @@ -229,7 +250,7 @@ def __init__(self, jsondict=None, strict=True): self.additive = None """ Material used in the processing step. - List of `FHIRReference` items referencing `Substance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.description = None """ Textual description of procedure. @@ -270,6 +291,10 @@ def elementProperties(self): from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/specimen_tests.py b/fhirclient/models/specimen_tests.py index 854ebfc9a..21afe0aa2 100644 --- a/fhirclient/models/specimen_tests.py +++ b/fhirclient/models/specimen_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,9 +37,12 @@ def implSpecimen1(self, inst): self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2015-08-16T07:03:00Z").date) self.assertEqual(inst.collection.collectedDateTime.as_json(), "2015-08-16T07:03:00Z") self.assertEqual(inst.collection.method.coding[0].code, "BAP") - self.assertEqual(inst.collection.method.coding[0].system, "http://hl7.org/fhir/v2/0488") + self.assertEqual(inst.collection.method.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0488") self.assertEqual(inst.contained[0].id, "stool") self.assertEqual(inst.id, "isolate") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "Patient dropped off specimen") self.assertEqual(inst.receivedTime.date, FHIRDate("2015-08-18T07:03:00Z").date) self.assertEqual(inst.receivedTime.as_json(), "2015-08-18T07:03:00Z") @@ -50,7 +53,7 @@ def implSpecimen1(self, inst): self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") def testSpecimen2(self): - inst = self.instantiate_from("specimen-example-serum.json") + inst = self.instantiate_from("specimen-example-pooled-serum.json") self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") self.implSpecimen2(inst) @@ -60,18 +63,24 @@ def testSpecimen2(self): self.implSpecimen2(inst2) def implSpecimen2(self, inst): - self.assertEqual(inst.accessionIdentifier.system, "http://acme.com/labs/accession-ids") - self.assertEqual(inst.accessionIdentifier.value, "20150816-00124") - self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2015-08-16T06:40:17Z").date) - self.assertEqual(inst.collection.collectedDateTime.as_json(), "2015-08-16T06:40:17Z") - self.assertEqual(inst.container[0].type.coding[0].code, "SST") - self.assertEqual(inst.container[0].type.coding[0].display, "Serum Separator Tube") - self.assertEqual(inst.container[0].type.coding[0].system, "http://acme.com/labs") - self.assertEqual(inst.id, "sst") + self.assertEqual(inst.accessionIdentifier.system, "https://vetmed.iastate.edu/vdl") + self.assertEqual(inst.accessionIdentifier.value, "20171120-1234") + self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2017-11-14").date) + self.assertEqual(inst.collection.collectedDateTime.as_json(), "2017-11-14") + self.assertEqual(inst.container[0].type.coding[0].code, "RTT") + self.assertEqual(inst.container[0].type.coding[0].display, "Red Top Tube") + self.assertEqual(inst.container[0].type.coding[0].system, "https://vetmed.iastate.edu/vdl") + self.assertEqual(inst.container[0].type.text, "Red Top Blood Collection Tube") + self.assertEqual(inst.id, "pooled-serum") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.note[0].text, "Pooled serum sample from 30 individuals") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "119364003") - self.assertEqual(inst.type.coding[0].display, "Serum sample") - self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.type.coding[0].code, "Serum sample, pooled") + self.assertEqual(inst.type.coding[0].display, "Serum sample, pooled") + self.assertEqual(inst.type.coding[0].system, "https://vetmed.iastate.edu/vdl") + self.assertEqual(inst.type.text, "Pooled serum sample") def testSpecimen3(self): inst = self.instantiate_from("specimen-example-urine.json") @@ -94,9 +103,12 @@ def implSpecimen3(self, inst): self.assertEqual(inst.container[0].specimenQuantity.value, 10) self.assertEqual(inst.container[0].type.text, "Non-sterile specimen container") self.assertEqual(inst.id, "vma-urine") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.processing[0].description, "Acidify to pH < 3.0 with 6 N HCl.") self.assertEqual(inst.processing[0].procedure.coding[0].code, "ACID") - self.assertEqual(inst.processing[0].procedure.coding[0].system, "http://hl7.org/fhir/v2/0373") + self.assertEqual(inst.processing[0].procedure.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0373") self.assertEqual(inst.processing[0].timeDateTime.date, FHIRDate("2015-08-18T08:10:00Z").date) self.assertEqual(inst.processing[0].timeDateTime.as_json(), "2015-08-18T08:10:00Z") self.assertEqual(inst.receivedTime.date, FHIRDate("2015-08-18T07:03:00Z").date) @@ -105,10 +117,10 @@ def implSpecimen3(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.type.coding[0].code, "RANDU") self.assertEqual(inst.type.coding[0].display, "Urine, Random") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/v2/0487") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0487") def testSpecimen4(self): - inst = self.instantiate_from("specimen-example.json") + inst = self.instantiate_from("specimen-example-serum.json") self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") self.implSpecimen4(inst) @@ -118,6 +130,33 @@ def testSpecimen4(self): self.implSpecimen4(inst2) def implSpecimen4(self, inst): + self.assertEqual(inst.accessionIdentifier.system, "http://acme.com/labs/accession-ids") + self.assertEqual(inst.accessionIdentifier.value, "20150816-00124") + self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2015-08-16T06:40:17Z").date) + self.assertEqual(inst.collection.collectedDateTime.as_json(), "2015-08-16T06:40:17Z") + self.assertEqual(inst.container[0].type.coding[0].code, "SST") + self.assertEqual(inst.container[0].type.coding[0].display, "Serum Separator Tube") + self.assertEqual(inst.container[0].type.coding[0].system, "http://acme.com/labs") + self.assertEqual(inst.id, "sst") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "119364003") + self.assertEqual(inst.type.coding[0].display, "Serum sample") + self.assertEqual(inst.type.coding[0].system, "http://snomed.info/sct") + + def testSpecimen5(self): + inst = self.instantiate_from("specimen-example.json") + self.assertIsNotNone(inst, "Must have instantiated a Specimen instance") + self.implSpecimen5(inst) + + js = inst.as_json() + self.assertEqual("Specimen", js["resourceType"]) + inst2 = specimen.Specimen(js) + self.implSpecimen5(inst2) + + def implSpecimen5(self, inst): self.assertEqual(inst.accessionIdentifier.system, "http://lab.acme.org/specimens/2011") self.assertEqual(inst.accessionIdentifier.value, "X352356") self.assertEqual(inst.collection.bodySite.coding[0].code, "49852007") @@ -127,7 +166,7 @@ def implSpecimen4(self, inst): self.assertEqual(inst.collection.collectedDateTime.date, FHIRDate("2011-05-30T06:15:00Z").date) self.assertEqual(inst.collection.collectedDateTime.as_json(), "2011-05-30T06:15:00Z") self.assertEqual(inst.collection.method.coding[0].code, "LNV") - self.assertEqual(inst.collection.method.coding[0].system, "http://hl7.org/fhir/v2/0488") + self.assertEqual(inst.collection.method.coding[0].system, "http://terminology.hl7.org/CodeSystem/v2-0488") self.assertEqual(inst.collection.quantity.unit, "mL") self.assertEqual(inst.collection.quantity.value, 6) self.assertEqual(inst.contained[0].id, "hep") @@ -141,6 +180,9 @@ def implSpecimen4(self, inst): self.assertEqual(inst.id, "101") self.assertEqual(inst.identifier[0].system, "http://ehr.acme.org/identifiers/collections") self.assertEqual(inst.identifier[0].value, "23234352356") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.note[0].text, "Specimen is grossly lipemic") self.assertEqual(inst.receivedTime.date, FHIRDate("2011-03-04T07:03:00Z").date) self.assertEqual(inst.receivedTime.as_json(), "2011-03-04T07:03:00Z") diff --git a/fhirclient/models/specimendefinition.py b/fhirclient/models/specimendefinition.py new file mode 100644 index 000000000..06d070da7 --- /dev/null +++ b/fhirclient/models/specimendefinition.py @@ -0,0 +1,306 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SpecimenDefinition) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class SpecimenDefinition(domainresource.DomainResource): + """ Kind of specimen. + + A kind of specimen with associated set of requirements. + """ + + resource_type = "SpecimenDefinition" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.collection = None + """ Specimen collection procedure. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.identifier = None + """ Business identifier of a kind of specimen. + Type `Identifier` (represented as `dict` in JSON). """ + + self.patientPreparation = None + """ Patient preparation for collection. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.timeAspect = None + """ Time aspect for collection. + Type `str`. """ + + self.typeCollected = None + """ Kind of material to collect. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.typeTested = None + """ Specimen in container intended for testing by lab. + List of `SpecimenDefinitionTypeTested` items (represented as `dict` in JSON). """ + + super(SpecimenDefinition, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenDefinition, self).elementProperties() + js.extend([ + ("collection", "collection", codeableconcept.CodeableConcept, True, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("patientPreparation", "patientPreparation", codeableconcept.CodeableConcept, True, None, False), + ("timeAspect", "timeAspect", str, False, None, False), + ("typeCollected", "typeCollected", codeableconcept.CodeableConcept, False, None, False), + ("typeTested", "typeTested", SpecimenDefinitionTypeTested, True, None, False), + ]) + return js + + +from . import backboneelement + +class SpecimenDefinitionTypeTested(backboneelement.BackboneElement): + """ Specimen in container intended for testing by lab. + + Specimen conditioned in a container as expected by the testing laboratory. + """ + + resource_type = "SpecimenDefinitionTypeTested" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.container = None + """ The specimen's container. + Type `SpecimenDefinitionTypeTestedContainer` (represented as `dict` in JSON). """ + + self.handling = None + """ Specimen handling before testing. + List of `SpecimenDefinitionTypeTestedHandling` items (represented as `dict` in JSON). """ + + self.isDerived = None + """ Primary or secondary specimen. + Type `bool`. """ + + self.preference = None + """ preferred | alternate. + Type `str`. """ + + self.rejectionCriterion = None + """ Rejection criterion. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.requirement = None + """ Specimen requirements. + Type `str`. """ + + self.retentionTime = None + """ Specimen retention time. + Type `Duration` (represented as `dict` in JSON). """ + + self.type = None + """ Type of intended specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SpecimenDefinitionTypeTested, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenDefinitionTypeTested, self).elementProperties() + js.extend([ + ("container", "container", SpecimenDefinitionTypeTestedContainer, False, None, False), + ("handling", "handling", SpecimenDefinitionTypeTestedHandling, True, None, False), + ("isDerived", "isDerived", bool, False, None, False), + ("preference", "preference", str, False, None, True), + ("rejectionCriterion", "rejectionCriterion", codeableconcept.CodeableConcept, True, None, False), + ("requirement", "requirement", str, False, None, False), + ("retentionTime", "retentionTime", duration.Duration, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SpecimenDefinitionTypeTestedContainer(backboneelement.BackboneElement): + """ The specimen's container. + """ + + resource_type = "SpecimenDefinitionTypeTestedContainer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additive = None + """ Additive associated with container. + List of `SpecimenDefinitionTypeTestedContainerAdditive` items (represented as `dict` in JSON). """ + + self.cap = None + """ Color of container cap. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.capacity = None + """ Container capacity. + Type `Quantity` (represented as `dict` in JSON). """ + + self.description = None + """ Container description. + Type `str`. """ + + self.material = None + """ Container material. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.minimumVolumeQuantity = None + """ Minimum volume. + Type `Quantity` (represented as `dict` in JSON). """ + + self.minimumVolumeString = None + """ Minimum volume. + Type `str`. """ + + self.preparation = None + """ Specimen container preparation. + Type `str`. """ + + self.type = None + """ Kind of container associated with the kind of specimen. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SpecimenDefinitionTypeTestedContainer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenDefinitionTypeTestedContainer, self).elementProperties() + js.extend([ + ("additive", "additive", SpecimenDefinitionTypeTestedContainerAdditive, True, None, False), + ("cap", "cap", codeableconcept.CodeableConcept, False, None, False), + ("capacity", "capacity", quantity.Quantity, False, None, False), + ("description", "description", str, False, None, False), + ("material", "material", codeableconcept.CodeableConcept, False, None, False), + ("minimumVolumeQuantity", "minimumVolumeQuantity", quantity.Quantity, False, "minimumVolume", False), + ("minimumVolumeString", "minimumVolumeString", str, False, "minimumVolume", False), + ("preparation", "preparation", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SpecimenDefinitionTypeTestedContainerAdditive(backboneelement.BackboneElement): + """ Additive associated with container. + + Substance introduced in the kind of container to preserve, maintain or + enhance the specimen. Examples: Formalin, Citrate, EDTA. + """ + + resource_type = "SpecimenDefinitionTypeTestedContainerAdditive" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.additiveCodeableConcept = None + """ Additive associated with container. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.additiveReference = None + """ Additive associated with container. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(SpecimenDefinitionTypeTestedContainerAdditive, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenDefinitionTypeTestedContainerAdditive, self).elementProperties() + js.extend([ + ("additiveCodeableConcept", "additiveCodeableConcept", codeableconcept.CodeableConcept, False, "additive", True), + ("additiveReference", "additiveReference", fhirreference.FHIRReference, False, "additive", True), + ]) + return js + + +class SpecimenDefinitionTypeTestedHandling(backboneelement.BackboneElement): + """ Specimen handling before testing. + + Set of instructions for preservation/transport of the specimen at a defined + temperature interval, prior the testing process. + """ + + resource_type = "SpecimenDefinitionTypeTestedHandling" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.instruction = None + """ Preservation instruction. + Type `str`. """ + + self.maxDuration = None + """ Maximum preservation time. + Type `Duration` (represented as `dict` in JSON). """ + + self.temperatureQualifier = None + """ Temperature qualifier. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.temperatureRange = None + """ Temperature range. + Type `Range` (represented as `dict` in JSON). """ + + super(SpecimenDefinitionTypeTestedHandling, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SpecimenDefinitionTypeTestedHandling, self).elementProperties() + js.extend([ + ("instruction", "instruction", str, False, None, False), + ("maxDuration", "maxDuration", duration.Duration, False, None, False), + ("temperatureQualifier", "temperatureQualifier", codeableconcept.CodeableConcept, False, None, False), + ("temperatureRange", "temperatureRange", range.Range, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import duration +except ImportError: + duration = sys.modules[__package__ + '.duration'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/specimendefinition_tests.py b/fhirclient/models/specimendefinition_tests.py new file mode 100644 index 000000000..ed93dd43d --- /dev/null +++ b/fhirclient/models/specimendefinition_tests.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import specimendefinition +from .fhirdate import FHIRDate + + +class SpecimenDefinitionTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("SpecimenDefinition", js["resourceType"]) + return specimendefinition.SpecimenDefinition(js) + + def testSpecimenDefinition1(self): + inst = self.instantiate_from("specimendefinition-example-serum-plasma.json") + self.assertIsNotNone(inst, "Must have instantiated a SpecimenDefinition instance") + self.implSpecimenDefinition1(inst) + + js = inst.as_json() + self.assertEqual("SpecimenDefinition", js["resourceType"]) + inst2 = specimendefinition.SpecimenDefinition(js) + self.implSpecimenDefinition1(inst2) + + def implSpecimenDefinition1(self, inst): + self.assertEqual(inst.id, "2364") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.patientPreparation[0].text, "12 hour fasting") + self.assertEqual(inst.patientPreparation[1].coding[0].code, "263678003") + self.assertEqual(inst.patientPreparation[1].coding[0].display, "At rest") + self.assertEqual(inst.patientPreparation[1].coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.timeAspect, "preferrably morning time") + self.assertEqual(inst.typeCollected.coding[0].code, "122555007") + self.assertEqual(inst.typeCollected.coding[0].display, "Venous blood specimen") + self.assertEqual(inst.typeCollected.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.typeTested[0].container.cap.coding[0].code, "yellow") + self.assertEqual(inst.typeTested[0].container.cap.coding[0].display, "yellow cap") + self.assertEqual(inst.typeTested[0].container.cap.coding[0].system, "urn:iso:std:iso:6710:2017") + self.assertEqual(inst.typeTested[0].container.material.coding[0].code, "61088005") + self.assertEqual(inst.typeTested[0].container.material.coding[0].display, "plastic") + self.assertEqual(inst.typeTested[0].container.material.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.typeTested[0].container.minimumVolumeQuantity.code, "mL") + self.assertEqual(inst.typeTested[0].container.minimumVolumeQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[0].container.minimumVolumeQuantity.unit, "ml") + self.assertEqual(inst.typeTested[0].container.minimumVolumeQuantity.value, 2) + self.assertEqual(inst.typeTested[0].container.type.coding[0].code, "702281005") + self.assertEqual(inst.typeTested[0].container.type.coding[0].display, "Evacuated blood collection tube, thrombin/clot activator/gel separator") + self.assertEqual(inst.typeTested[0].container.type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.typeTested[0].handling[0].maxDuration.code, "min") + self.assertEqual(inst.typeTested[0].handling[0].maxDuration.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[0].handling[0].maxDuration.unit, "minute") + self.assertEqual(inst.typeTested[0].handling[0].maxDuration.value, 60) + self.assertEqual(inst.typeTested[0].handling[0].temperatureQualifier.text, "Ambient temperature") + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.high.code, "Cel") + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.high.unit, "°C") + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.high.value, 25) + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.low.code, "Cel") + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.low.unit, "°C") + self.assertEqual(inst.typeTested[0].handling[0].temperatureRange.low.value, 15) + self.assertEqual(inst.typeTested[0].handling[1].maxDuration.code, "h") + self.assertEqual(inst.typeTested[0].handling[1].maxDuration.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[0].handling[1].maxDuration.unit, "hour") + self.assertEqual(inst.typeTested[0].handling[1].maxDuration.value, 8) + self.assertEqual(inst.typeTested[0].handling[1].temperatureQualifier.text, "Refrigerated temperature") + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.high.code, "Cel") + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.high.unit, "°C") + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.high.value, 8) + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.low.code, "Cel") + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.low.unit, "°C") + self.assertEqual(inst.typeTested[0].handling[1].temperatureRange.low.value, 2) + self.assertEqual(inst.typeTested[0].preference, "preferred") + self.assertEqual(inst.typeTested[0].type.coding[0].code, "119364003") + self.assertEqual(inst.typeTested[0].type.coding[0].display, "Serum specimen") + self.assertEqual(inst.typeTested[0].type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.typeTested[1].container.cap.coding[0].code, "green") + self.assertEqual(inst.typeTested[1].container.cap.coding[0].display, "green cap") + self.assertEqual(inst.typeTested[1].container.cap.coding[0].system, "urn:iso:std:iso:6710:2017") + self.assertEqual(inst.typeTested[1].container.material.coding[0].code, "32039001") + self.assertEqual(inst.typeTested[1].container.material.coding[0].display, "glass") + self.assertEqual(inst.typeTested[1].container.material.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.typeTested[1].container.minimumVolumeQuantity.code, "mL") + self.assertEqual(inst.typeTested[1].container.minimumVolumeQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[1].container.minimumVolumeQuantity.unit, "ml") + self.assertEqual(inst.typeTested[1].container.minimumVolumeQuantity.value, 2) + self.assertEqual(inst.typeTested[1].container.type.coding[0].code, "767390000") + self.assertEqual(inst.typeTested[1].container.type.coding[0].display, "Evacuated blood collection tube with heparin lithium and gel separator") + self.assertEqual(inst.typeTested[1].container.type.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.typeTested[1].handling[0].maxDuration.code, "min") + self.assertEqual(inst.typeTested[1].handling[0].maxDuration.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[1].handling[0].maxDuration.unit, "minute") + self.assertEqual(inst.typeTested[1].handling[0].maxDuration.value, 60) + self.assertEqual(inst.typeTested[1].handling[0].temperatureQualifier.text, "Ambient temperature") + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.high.code, "Cel") + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.high.unit, "°C") + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.high.value, 25) + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.low.code, "Cel") + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.low.unit, "°C") + self.assertEqual(inst.typeTested[1].handling[0].temperatureRange.low.value, 15) + self.assertEqual(inst.typeTested[1].handling[1].maxDuration.code, "h") + self.assertEqual(inst.typeTested[1].handling[1].maxDuration.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[1].handling[1].maxDuration.unit, "hour") + self.assertEqual(inst.typeTested[1].handling[1].maxDuration.value, 8) + self.assertEqual(inst.typeTested[1].handling[1].temperatureQualifier.text, "Refrigerated temperature") + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.high.code, "Cel") + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.high.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.high.unit, "°C") + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.high.value, 8) + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.low.code, "Cel") + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.low.system, "http://unitsofmeasure.org") + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.low.unit, "°C") + self.assertEqual(inst.typeTested[1].handling[1].temperatureRange.low.value, 2) + self.assertEqual(inst.typeTested[1].preference, "alternate") + self.assertEqual(inst.typeTested[1].rejectionCriterion[0].coding[0].code, "insufficient") + self.assertEqual(inst.typeTested[1].rejectionCriterion[0].coding[0].display, "insufficient specimen volume") + self.assertEqual(inst.typeTested[1].rejectionCriterion[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/rejection-criteria") + self.assertEqual(inst.typeTested[1].rejectionCriterion[1].coding[0].code, "hemolized") + self.assertEqual(inst.typeTested[1].rejectionCriterion[1].coding[0].display, "hemolized specimen") + self.assertEqual(inst.typeTested[1].rejectionCriterion[1].coding[0].system, "http://terminology.hl7.org/CodeSystem/rejection-criteria") + self.assertEqual(inst.typeTested[1].type.coding[0].code, "119361006") + self.assertEqual(inst.typeTested[1].type.coding[0].display, "Plasma specimen") + self.assertEqual(inst.typeTested[1].type.coding[0].system, "http://snomed.info/sct") + diff --git a/fhirclient/models/structuredefinition.py b/fhirclient/models/structuredefinition.py index d052ebdaf..684031b5a 100644 --- a/fhirclient/models/structuredefinition.py +++ b/fhirclient/models/structuredefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -38,23 +38,19 @@ def __init__(self, jsondict=None, strict=True): List of `ContactDetail` items (represented as `dict` in JSON). """ self.context = None - """ Where the extension can be used in instances. - List of `str` items. """ + """ If an extension, where it can be used in instances. + List of `StructureDefinitionContext` items (represented as `dict` in JSON). """ self.contextInvariant = None """ FHIRPath invariants - when the extension can be used. List of `str` items. """ - self.contextType = None - """ resource | datatype | extension. - Type `str`. """ - self.copyright = None """ Use and/or publishing restrictions. Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.derivation = None @@ -126,12 +122,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this structure definition (globally - unique). + """ Canonical identifier for this structure definition, represented as + a URI (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -146,9 +142,8 @@ def elementProperties(self): ("abstract", "abstract", bool, False, None, True), ("baseDefinition", "baseDefinition", str, False, None, False), ("contact", "contact", contactdetail.ContactDetail, True, None, False), - ("context", "context", str, True, None, False), + ("context", "context", StructureDefinitionContext, True, None, False), ("contextInvariant", "contextInvariant", str, True, None, False), - ("contextType", "contextType", str, False, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("derivation", "derivation", str, False, None, False), @@ -177,6 +172,42 @@ def elementProperties(self): from . import backboneelement +class StructureDefinitionContext(backboneelement.BackboneElement): + """ If an extension, where it can be used in instances. + + Identifies the types of resource or data type elements to which the + extension can be applied. + """ + + resource_type = "StructureDefinitionContext" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.expression = None + """ Where the extension can be used in instances. + Type `str`. """ + + self.type = None + """ fhirpath | element | extension. + Type `str`. """ + + super(StructureDefinitionContext, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(StructureDefinitionContext, self).elementProperties() + js.extend([ + ("expression", "expression", str, False, None, True), + ("type", "type", str, False, None, True), + ]) + return js + + class StructureDefinitionDifferential(backboneelement.BackboneElement): """ Differential view of the structure. @@ -256,7 +287,7 @@ def elementProperties(self): class StructureDefinitionSnapshot(backboneelement.BackboneElement): """ Snapshot view of the structure. - A snapshot view is expressed in a stand alone form that can be used and + A snapshot view is expressed in a standalone form that can be used and interpreted without considering the base StructureDefinition. """ diff --git a/fhirclient/models/structuredefinition_tests.py b/fhirclient/models/structuredefinition_tests.py index 97db8b62c..322449678 100644 --- a/fhirclient/models/structuredefinition_tests.py +++ b/fhirclient/models/structuredefinition_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return structuredefinition.StructureDefinition(js) def testStructureDefinition1(self): - inst = self.instantiate_from("structuredefinition-example.json") + inst = self.instantiate_from("structuredefinition-example-section-library.json") self.assertIsNotNone(inst, "Must have instantiated a StructureDefinition instance") self.implStructureDefinition1(inst) @@ -32,180 +32,113 @@ def testStructureDefinition1(self): self.implStructureDefinition1(inst2) def implStructureDefinition1(self, inst): + self.assertTrue(inst.abstract) + self.assertEqual(inst.baseDefinition, "http://hl7.org/fhir/StructureDefinition/Composition") + self.assertEqual(inst.date.date, FHIRDate("2018-11-05T17:57:00+11:00").date) + self.assertEqual(inst.date.as_json(), "2018-11-05T17:57:00+11:00") + self.assertEqual(inst.derivation, "constraint") + self.assertEqual(inst.differential.element[0].id, "Composition") + self.assertEqual(inst.differential.element[0].path, "Composition") + self.assertEqual(inst.differential.element[1].id, "Composition.section") + self.assertEqual(inst.differential.element[1].path, "Composition.section") + self.assertEqual(inst.differential.element[1].slicing.description, "Slice by .section.code when using this library of sections") + self.assertEqual(inst.differential.element[1].slicing.discriminator[0].path, "code") + self.assertEqual(inst.differential.element[1].slicing.discriminator[0].type, "pattern") + self.assertTrue(inst.differential.element[1].slicing.ordered) + self.assertEqual(inst.differential.element[1].slicing.rules, "closed") + self.assertEqual(inst.differential.element[2].id, "Composition.section:procedure") + self.assertEqual(inst.differential.element[2].path, "Composition.section") + self.assertEqual(inst.differential.element[2].sliceName, "procedure") + self.assertEqual(inst.differential.element[3].fixedString, "Procedures Performed") + self.assertEqual(inst.differential.element[3].id, "Composition.section:procedure.title") + self.assertEqual(inst.differential.element[3].min, 1) + self.assertEqual(inst.differential.element[3].path, "Composition.section.title") + self.assertEqual(inst.differential.element[4].id, "Composition.section:procedure.code") + self.assertEqual(inst.differential.element[4].min, 1) + self.assertEqual(inst.differential.element[4].path, "Composition.section.code") + self.assertEqual(inst.differential.element[4].patternCodeableConcept.coding[0].code, "29554-3") + self.assertEqual(inst.differential.element[4].patternCodeableConcept.coding[0].display, "Procedure Narrative") + self.assertEqual(inst.differential.element[4].patternCodeableConcept.coding[0].system, "http://loinc.org") + self.assertEqual(inst.differential.element[5].id, "Composition.section:medications") + self.assertEqual(inst.differential.element[5].path, "Composition.section") + self.assertEqual(inst.differential.element[5].sliceName, "medications") + self.assertEqual(inst.differential.element[6].fixedString, "Medications Administered") + self.assertEqual(inst.differential.element[6].id, "Composition.section:medications.title") + self.assertEqual(inst.differential.element[6].min, 1) + self.assertEqual(inst.differential.element[6].path, "Composition.section.title") + self.assertEqual(inst.differential.element[7].id, "Composition.section:medications.code") + self.assertEqual(inst.differential.element[7].min, 1) + self.assertEqual(inst.differential.element[7].path, "Composition.section.code") + self.assertEqual(inst.differential.element[7].patternCodeableConcept.coding[0].code, "29549-3") + self.assertEqual(inst.differential.element[7].patternCodeableConcept.coding[0].display, "Medication administered Narrative") + self.assertEqual(inst.differential.element[7].patternCodeableConcept.coding[0].system, "http://loinc.org") + self.assertEqual(inst.differential.element[8].id, "Composition.section:plan") + self.assertEqual(inst.differential.element[8].path, "Composition.section") + self.assertEqual(inst.differential.element[8].sliceName, "plan") + self.assertEqual(inst.differential.element[9].fixedString, "Discharge Treatment Plan") + self.assertEqual(inst.differential.element[9].id, "Composition.section:plan.title") + self.assertEqual(inst.differential.element[9].min, 1) + self.assertEqual(inst.differential.element[9].path, "Composition.section.title") + self.assertFalse(inst.experimental) + self.assertEqual(inst.id, "example-section-library") + self.assertEqual(inst.kind, "complex-type") + self.assertEqual(inst.name, "DocumentSectionLibrary") + self.assertEqual(inst.status, "active") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Document Section Library (For testing section templates)") + self.assertEqual(inst.type, "Composition") + self.assertEqual(inst.url, "http://hl7.org/fhir/StructureDefinition/example-section-library") + + def testStructureDefinition2(self): + inst = self.instantiate_from("structuredefinition-example-composition.json") + self.assertIsNotNone(inst, "Must have instantiated a StructureDefinition instance") + self.implStructureDefinition2(inst) + + js = inst.as_json() + self.assertEqual("StructureDefinition", js["resourceType"]) + inst2 = structuredefinition.StructureDefinition(js) + self.implStructureDefinition2(inst2) + + def implStructureDefinition2(self, inst): self.assertFalse(inst.abstract) - self.assertEqual(inst.baseDefinition, "http://hl7.org/fhir/StructureDefinition/DiagnosticReport") - self.assertEqual(inst.contact[0].name, "Grahame Grieve") - self.assertEqual(inst.contact[0].telecom[0].system, "email") - self.assertEqual(inst.contact[0].telecom[0].value, "grahame@healthintersections.com.au") - self.assertEqual(inst.copyright, "Creative Commons 0, per FHIR specification") - self.assertEqual(inst.date.date, FHIRDate("2012-05-12").date) - self.assertEqual(inst.date.as_json(), "2012-05-12") + self.assertEqual(inst.baseDefinition, "http://hl7.org/fhir/StructureDefinition/Composition") + self.assertEqual(inst.date.date, FHIRDate("2018-11-05T17:47:00+11:00").date) + self.assertEqual(inst.date.as_json(), "2018-11-05T17:47:00+11:00") self.assertEqual(inst.derivation, "constraint") - self.assertEqual(inst.description, "Describes how the lab report is used for a standard Lipid Profile - Cholesterol, Triglyceride and Cholesterol fractions. Uses LOINC codes") - self.assertTrue(inst.experimental) - self.assertEqual(inst.fhirVersion, "1.0.0") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier[0].value, "1.2.36.90146595217.4.2") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "AU") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.keyword[0].code, "314079002") - self.assertEqual(inst.keyword[0].display, "Hyperlipidemia screening test (procedure)") - self.assertEqual(inst.keyword[0].system, "http://snomed.info/sct") - self.assertEqual(inst.kind, "resource") - self.assertEqual(inst.mapping[0].comment, "Actual mappings haven't yet been filled out") - self.assertEqual(inst.mapping[0].identity, "m1") - self.assertEqual(inst.mapping[0].name, "RCPA Lipid Report recommendations") - self.assertEqual(inst.mapping[0].uri, "https://www.rcpa.edu.au/getattachment/0961c6d1-ec80-4500-8dc0-de516500e05b/Lipid-and-lipoprotein-testing.aspx") - self.assertEqual(inst.name, "LipidProfileExample") - self.assertEqual(inst.publisher, "Health Intersections Pty Ltd") - self.assertEqual(inst.purpose, "Provide an example to demonstrate how to use StructureDefinition") - self.assertEqual(inst.snapshot.element[0].base.max, "1") - self.assertEqual(inst.snapshot.element[0].base.min, 1) - self.assertEqual(inst.snapshot.element[0].base.path, "DiagnosticReport") - self.assertEqual(inst.snapshot.element[0].definition, "The findings and interpretation of a general lipd lab profile.") - self.assertEqual(inst.snapshot.element[0].id, "DiagnosticReport") - self.assertFalse(inst.snapshot.element[0].isModifier) - self.assertEqual(inst.snapshot.element[0].max, "1") - self.assertEqual(inst.snapshot.element[0].min, 1) - self.assertEqual(inst.snapshot.element[0].path, "DiagnosticReport") - self.assertEqual(inst.snapshot.element[0].short, "Lipid Lab Report") - self.assertEqual(inst.snapshot.element[1].base.max, "*") - self.assertEqual(inst.snapshot.element[1].base.min, 0) - self.assertEqual(inst.snapshot.element[1].base.path, "DiagnosticReport.extension") - self.assertEqual(inst.snapshot.element[1].id, "DiagnosticReport.extension") - self.assertFalse(inst.snapshot.element[1].isModifier) - self.assertEqual(inst.snapshot.element[1].max, "*") - self.assertEqual(inst.snapshot.element[1].min, 0) - self.assertEqual(inst.snapshot.element[1].path, "DiagnosticReport.extension") - self.assertEqual(inst.snapshot.element[1].short, "Additional Content defined by implementations") - self.assertEqual(inst.snapshot.element[1].slicing.discriminator[0].path, "url") - self.assertEqual(inst.snapshot.element[1].slicing.discriminator[0].type, "value") - self.assertFalse(inst.snapshot.element[1].slicing.ordered) - self.assertEqual(inst.snapshot.element[1].slicing.rules, "open") - self.assertEqual(inst.snapshot.element[1].type[0].code, "Extension") - self.assertEqual(inst.snapshot.element[2].alias[0], "narrative") - self.assertEqual(inst.snapshot.element[2].alias[1], "html") - self.assertEqual(inst.snapshot.element[2].alias[2], "xhtml") - self.assertEqual(inst.snapshot.element[2].alias[3], "display") - self.assertEqual(inst.snapshot.element[2].base.max, "1") - self.assertEqual(inst.snapshot.element[2].base.min, 0) - self.assertEqual(inst.snapshot.element[2].base.path, "DiagnosticReport.text") - self.assertEqual(inst.snapshot.element[2].comment, "Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative.") - self.assertEqual(inst.snapshot.element[2].id, "DiagnosticReport.text") - self.assertFalse(inst.snapshot.element[2].isModifier) - self.assertEqual(inst.snapshot.element[2].max, "1") - self.assertEqual(inst.snapshot.element[2].min, 0) - self.assertEqual(inst.snapshot.element[2].path, "DiagnosticReport.text") - self.assertEqual(inst.snapshot.element[2].short, "Text summary of the resource, for human interpretation") - self.assertEqual(inst.snapshot.element[2].type[0].code, "Narrative") - self.assertEqual(inst.snapshot.element[3].alias[0], "inline resources") - self.assertEqual(inst.snapshot.element[3].alias[1], "anonymous resources") - self.assertEqual(inst.snapshot.element[3].alias[2], "contained resources") - self.assertEqual(inst.snapshot.element[3].base.max, "*") - self.assertEqual(inst.snapshot.element[3].base.min, 0) - self.assertEqual(inst.snapshot.element[3].base.path, "DiagnosticReport.contained") - self.assertEqual(inst.snapshot.element[3].comment, "This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again.") - self.assertEqual(inst.snapshot.element[3].id, "DiagnosticReport.contained") - self.assertFalse(inst.snapshot.element[3].isModifier) - self.assertEqual(inst.snapshot.element[3].max, "*") - self.assertEqual(inst.snapshot.element[3].min, 0) - self.assertEqual(inst.snapshot.element[3].path, "DiagnosticReport.contained") - self.assertEqual(inst.snapshot.element[3].short, "Contained, inline Resources") - self.assertEqual(inst.snapshot.element[3].type[0].code, "Resource") - self.assertEqual(inst.snapshot.element[4].base.max, "1") - self.assertEqual(inst.snapshot.element[4].base.min, 1) - self.assertEqual(inst.snapshot.element[4].base.path, "DiagnosticReport.status") - self.assertEqual(inst.snapshot.element[4].binding.strength, "required") - self.assertEqual(inst.snapshot.element[4].comment, "This is labeled as \"Is Modifier\" because applications need to take appropriate action if a report is withdrawn.") - self.assertEqual(inst.snapshot.element[4].definition, "The status of the diagnostic report as a whole.") - self.assertEqual(inst.snapshot.element[4].id, "DiagnosticReport.status") - self.assertFalse(inst.snapshot.element[4].isModifier) - self.assertEqual(inst.snapshot.element[4].max, "1") - self.assertEqual(inst.snapshot.element[4].min, 1) - self.assertEqual(inst.snapshot.element[4].path, "DiagnosticReport.status") - self.assertEqual(inst.snapshot.element[4].short, "registered|interim|final|amended|cancelled|withdrawn") - self.assertEqual(inst.snapshot.element[4].type[0].code, "code") - self.assertEqual(inst.snapshot.element[5].base.max, "1") - self.assertEqual(inst.snapshot.element[5].base.min, 1) - self.assertEqual(inst.snapshot.element[5].base.path, "DiagnosticReport.issued") - self.assertEqual(inst.snapshot.element[5].comment, "May be different from the update time of the resource itself, because that is the status of the record (potentially a secondary copy), not the actual release time of the report.") - self.assertEqual(inst.snapshot.element[5].definition, "The date and/or time that this version of the report was released from the source diagnostic service.") - self.assertEqual(inst.snapshot.element[5].id, "DiagnosticReport.issued") - self.assertFalse(inst.snapshot.element[5].isModifier) - self.assertEqual(inst.snapshot.element[5].max, "1") - self.assertEqual(inst.snapshot.element[5].min, 1) - self.assertEqual(inst.snapshot.element[5].path, "DiagnosticReport.issued") - self.assertEqual(inst.snapshot.element[5].short, "Date this version was released") - self.assertEqual(inst.snapshot.element[5].type[0].code, "dateTime") - self.assertEqual(inst.snapshot.element[6].base.max, "1") - self.assertEqual(inst.snapshot.element[6].base.min, 1) - self.assertEqual(inst.snapshot.element[6].base.path, "DiagnosticReport.subject") - self.assertEqual(inst.snapshot.element[6].definition, "The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.") - self.assertEqual(inst.snapshot.element[6].id, "DiagnosticReport.subject") - self.assertFalse(inst.snapshot.element[6].isModifier) - self.assertEqual(inst.snapshot.element[6].max, "1") - self.assertEqual(inst.snapshot.element[6].min, 1) - self.assertEqual(inst.snapshot.element[6].path, "DiagnosticReport.subject") - self.assertEqual(inst.snapshot.element[6].short, "The subject of the report") - self.assertEqual(inst.snapshot.element[6].type[0].aggregation[0], "bundled") - self.assertEqual(inst.snapshot.element[6].type[0].code, "Reference") - self.assertEqual(inst.snapshot.element[6].type[0].targetProfile, "http://hl7.org/fhir/StructureDefinition/Patient") - self.assertEqual(inst.snapshot.element[6].type[0].versioning, "either") - self.assertEqual(inst.snapshot.element[6].type[1].aggregation[0], "bundled") - self.assertEqual(inst.snapshot.element[6].type[1].code, "Reference") - self.assertEqual(inst.snapshot.element[6].type[1].targetProfile, "http://hl7.org/fhir/StructureDefinition/Group") - self.assertEqual(inst.snapshot.element[6].type[2].aggregation[0], "bundled") - self.assertEqual(inst.snapshot.element[6].type[2].code, "Reference") - self.assertEqual(inst.snapshot.element[6].type[2].targetProfile, "http://hl7.org/fhir/StructureDefinition/Device") - self.assertEqual(inst.snapshot.element[7].base.max, "1") - self.assertEqual(inst.snapshot.element[7].base.min, 1) - self.assertEqual(inst.snapshot.element[7].base.path, "DiagnosticReport.performer") - self.assertEqual(inst.snapshot.element[7].comment, "This is not necessarily the source of the atomic data items - it's the entity that takes responsibility for the clinical report.") - self.assertEqual(inst.snapshot.element[7].definition, "The diagnostic service that is responsible for issuing the report.") - self.assertEqual(inst.snapshot.element[7].id, "DiagnosticReport.performer") - self.assertFalse(inst.snapshot.element[7].isModifier) - self.assertEqual(inst.snapshot.element[7].max, "1") - self.assertEqual(inst.snapshot.element[7].min, 1) - self.assertEqual(inst.snapshot.element[7].path, "DiagnosticReport.performer") - self.assertEqual(inst.snapshot.element[7].short, "Responsible Diagnostic Service") - self.assertEqual(inst.snapshot.element[7].type[0].code, "Reference") - self.assertEqual(inst.snapshot.element[7].type[0].targetProfile, "http://hl7.org/fhir/StructureDefinition/Organization") - self.assertEqual(inst.snapshot.element[8].base.max, "*") - self.assertEqual(inst.snapshot.element[8].base.min, 0) - self.assertEqual(inst.snapshot.element[8].base.path, "DiagnosticReport.identifier") - self.assertEqual(inst.snapshot.element[8].definition, "The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.") - self.assertEqual(inst.snapshot.element[8].id, "DiagnosticReport.identifier") - self.assertFalse(inst.snapshot.element[8].isModifier) - self.assertEqual(inst.snapshot.element[8].max, "1") - self.assertEqual(inst.snapshot.element[8].min, 0) - self.assertEqual(inst.snapshot.element[8].path, "DiagnosticReport.identifier") - self.assertEqual(inst.snapshot.element[8].short, "Id for external references to this report") - self.assertEqual(inst.snapshot.element[8].type[0].code, "Identifier") - self.assertEqual(inst.snapshot.element[9].base.max, "*") - self.assertEqual(inst.snapshot.element[9].base.min, 0) - self.assertEqual(inst.snapshot.element[9].base.path, "DiagnosticReport.request") - self.assertEqual(inst.snapshot.element[9].definition, "Details concerning a single pathology test requested.") - self.assertEqual(inst.snapshot.element[9].id, "DiagnosticReport.request") - self.assertFalse(inst.snapshot.element[9].isModifier) - self.assertEqual(inst.snapshot.element[9].max, "*") - self.assertEqual(inst.snapshot.element[9].min, 0) - self.assertEqual(inst.snapshot.element[9].path, "DiagnosticReport.request") - self.assertEqual(inst.snapshot.element[9].short, "What was requested") - self.assertEqual(inst.snapshot.element[9].type[0].aggregation[0], "referenced") - self.assertEqual(inst.snapshot.element[9].type[0].code, "Reference") - self.assertEqual(inst.snapshot.element[9].type[0].targetProfile, "http://hl7.org/fhir/StructureDefinition/ProcedureRequest") - self.assertEqual(inst.snapshot.element[9].type[0].versioning, "specific") - self.assertEqual(inst.status, "draft") + self.assertEqual(inst.differential.element[0].id, "Composition") + self.assertEqual(inst.differential.element[0].path, "Composition") + self.assertEqual(inst.differential.element[1].id, "Composition.section") + self.assertEqual(inst.differential.element[1].path, "Composition.section") + self.assertEqual(inst.differential.element[1].slicing.description, "Slice by .section.code") + self.assertEqual(inst.differential.element[1].slicing.discriminator[0].path, "code") + self.assertEqual(inst.differential.element[1].slicing.discriminator[0].type, "pattern") + self.assertTrue(inst.differential.element[1].slicing.ordered) + self.assertEqual(inst.differential.element[1].slicing.rules, "closed") + self.assertEqual(inst.differential.element[2].id, "Composition.section:procedure") + self.assertEqual(inst.differential.element[2].min, 1) + self.assertEqual(inst.differential.element[2].path, "Composition.section") + self.assertEqual(inst.differential.element[2].sliceName, "procedure") + self.assertEqual(inst.differential.element[2].type[0].code, "BackboneElement") + self.assertEqual(inst.differential.element[2].type[0].profile[0], "http://hl7.org/fhir/StructureDefinition/document-section-library") + self.assertEqual(inst.differential.element[3].id, "Composition.section:medications") + self.assertEqual(inst.differential.element[3].min, 1) + self.assertEqual(inst.differential.element[3].path, "Composition.section") + self.assertEqual(inst.differential.element[3].sliceName, "medications") + self.assertEqual(inst.differential.element[3].type[0].code, "BackboneElement") + self.assertEqual(inst.differential.element[3].type[0].profile[0], "http://hl7.org/fhir/StructureDefinition/document-section-library") + self.assertEqual(inst.differential.element[4].id, "Composition.section:plan") + self.assertEqual(inst.differential.element[4].min, 0) + self.assertEqual(inst.differential.element[4].path, "Composition.section") + self.assertEqual(inst.differential.element[4].sliceName, "plan") + self.assertEqual(inst.differential.element[4].type[0].code, "BackboneElement") + self.assertEqual(inst.differential.element[4].type[0].profile[0], "http://hl7.org/fhir/StructureDefinition/document-section-library") + self.assertFalse(inst.experimental) + self.assertEqual(inst.id, "example-composition") + self.assertEqual(inst.kind, "complex-type") + self.assertEqual(inst.name, "DocumentStructure") + self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.title, "Example Lipid Profile") - self.assertEqual(inst.type, "DiagnosticReport") - self.assertEqual(inst.url, "http://hl7.org/fhir/StructureDefinition/example") - self.assertEqual(inst.useContext[0].code.code, "focus") - self.assertEqual(inst.useContext[0].code.display, "Clinical Focus") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "314079002") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].display, "Hyperlipidemia screening test (procedure)") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.version, "2") + self.assertEqual(inst.title, "Document Structure (For testing section templates)") + self.assertEqual(inst.type, "Composition") + self.assertEqual(inst.url, "http://hl7.org/fhir/StructureDefinition/example-composition") diff --git a/fhirclient/models/structuremap.py b/fhirclient/models/structuremap.py index 33919ca2f..a3ed67756 100644 --- a/fhirclient/models/structuremap.py +++ b/fhirclient/models/structuremap.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/StructureMap) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/StructureMap) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -31,7 +31,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -83,11 +83,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this structure map (globally unique). + """ Canonical identifier for this structure map, represented as a URI + (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -126,7 +127,7 @@ def elementProperties(self): class StructureMapGroup(backboneelement.BackboneElement): """ Named sections for reader convenience. - Organizes the mapping into managable chunks for human review/ease of + Organizes the mapping into manageable chunks for human review/ease of maintenance. """ @@ -141,7 +142,7 @@ def __init__(self, jsondict=None, strict=True): """ self.documentation = None - """ Additional description/explaination for group. + """ Additional description/explanation for group. Type `str`. """ self.extends = None @@ -362,6 +363,10 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `bool`. """ + self.defaultValueCanonical = None + """ Default value if no value exists. + Type `str`. """ + self.defaultValueCode = None """ Default value if no value exists. Type `str`. """ @@ -374,14 +379,26 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `Coding` (represented as `dict` in JSON). """ + self.defaultValueContactDetail = None + """ Default value if no value exists. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.defaultValueContactPoint = None """ Default value if no value exists. Type `ContactPoint` (represented as `dict` in JSON). """ + self.defaultValueContributor = None + """ Default value if no value exists. + Type `Contributor` (represented as `dict` in JSON). """ + self.defaultValueCount = None """ Default value if no value exists. Type `Count` (represented as `dict` in JSON). """ + self.defaultValueDataRequirement = None + """ Default value if no value exists. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.defaultValueDate = None """ Default value if no value exists. Type `FHIRDate` (represented as `str` in JSON). """ @@ -398,10 +415,18 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `Distance` (represented as `dict` in JSON). """ + self.defaultValueDosage = None + """ Default value if no value exists. + Type `Dosage` (represented as `dict` in JSON). """ + self.defaultValueDuration = None """ Default value if no value exists. Type `Duration` (represented as `dict` in JSON). """ + self.defaultValueExpression = None + """ Default value if no value exists. + Type `Expression` (represented as `dict` in JSON). """ + self.defaultValueHumanName = None """ Default value if no value exists. Type `HumanName` (represented as `dict` in JSON). """ @@ -426,10 +451,6 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `str`. """ - self.defaultValueMeta = None - """ Default value if no value exists. - Type `Meta` (represented as `dict` in JSON). """ - self.defaultValueMoney = None """ Default value if no value exists. Type `Money` (represented as `dict` in JSON). """ @@ -438,6 +459,10 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `str`. """ + self.defaultValueParameterDefinition = None + """ Default value if no value exists. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.defaultValuePeriod = None """ Default value if no value exists. Type `Period` (represented as `dict` in JSON). """ @@ -462,6 +487,10 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `FHIRReference` (represented as `dict` in JSON). """ + self.defaultValueRelatedArtifact = None + """ Default value if no value exists. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.defaultValueSampledData = None """ Default value if no value exists. Type `SampledData` (represented as `dict` in JSON). """ @@ -482,6 +511,10 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `Timing` (represented as `dict` in JSON). """ + self.defaultValueTriggerDefinition = None + """ Default value if no value exists. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.defaultValueUnsignedInt = None """ Default value if no value exists. Type `int`. """ @@ -490,6 +523,18 @@ def __init__(self, jsondict=None, strict=True): """ Default value if no value exists. Type `str`. """ + self.defaultValueUrl = None + """ Default value if no value exists. + Type `str`. """ + + self.defaultValueUsageContext = None + """ Default value if no value exists. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.defaultValueUuid = None + """ Default value if no value exists. + Type `str`. """ + self.element = None """ Optional field for this source. Type `str`. """ @@ -498,6 +543,10 @@ def __init__(self, jsondict=None, strict=True): """ first | not_first | last | not_last | only_one. Type `str`. """ + self.logMessage = None + """ Message to put in log if source exists (FHIRPath). + Type `str`. """ + self.max = None """ Specified maximum cardinality (number or *). Type `str`. """ @@ -528,40 +577,52 @@ def elementProperties(self): ("defaultValueAttachment", "defaultValueAttachment", attachment.Attachment, False, "defaultValue", False), ("defaultValueBase64Binary", "defaultValueBase64Binary", str, False, "defaultValue", False), ("defaultValueBoolean", "defaultValueBoolean", bool, False, "defaultValue", False), + ("defaultValueCanonical", "defaultValueCanonical", str, False, "defaultValue", False), ("defaultValueCode", "defaultValueCode", str, False, "defaultValue", False), ("defaultValueCodeableConcept", "defaultValueCodeableConcept", codeableconcept.CodeableConcept, False, "defaultValue", False), ("defaultValueCoding", "defaultValueCoding", coding.Coding, False, "defaultValue", False), + ("defaultValueContactDetail", "defaultValueContactDetail", contactdetail.ContactDetail, False, "defaultValue", False), ("defaultValueContactPoint", "defaultValueContactPoint", contactpoint.ContactPoint, False, "defaultValue", False), + ("defaultValueContributor", "defaultValueContributor", contributor.Contributor, False, "defaultValue", False), ("defaultValueCount", "defaultValueCount", count.Count, False, "defaultValue", False), + ("defaultValueDataRequirement", "defaultValueDataRequirement", datarequirement.DataRequirement, False, "defaultValue", False), ("defaultValueDate", "defaultValueDate", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueDateTime", "defaultValueDateTime", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueDecimal", "defaultValueDecimal", float, False, "defaultValue", False), ("defaultValueDistance", "defaultValueDistance", distance.Distance, False, "defaultValue", False), + ("defaultValueDosage", "defaultValueDosage", dosage.Dosage, False, "defaultValue", False), ("defaultValueDuration", "defaultValueDuration", duration.Duration, False, "defaultValue", False), + ("defaultValueExpression", "defaultValueExpression", expression.Expression, False, "defaultValue", False), ("defaultValueHumanName", "defaultValueHumanName", humanname.HumanName, False, "defaultValue", False), ("defaultValueId", "defaultValueId", str, False, "defaultValue", False), ("defaultValueIdentifier", "defaultValueIdentifier", identifier.Identifier, False, "defaultValue", False), ("defaultValueInstant", "defaultValueInstant", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueInteger", "defaultValueInteger", int, False, "defaultValue", False), ("defaultValueMarkdown", "defaultValueMarkdown", str, False, "defaultValue", False), - ("defaultValueMeta", "defaultValueMeta", meta.Meta, False, "defaultValue", False), ("defaultValueMoney", "defaultValueMoney", money.Money, False, "defaultValue", False), ("defaultValueOid", "defaultValueOid", str, False, "defaultValue", False), + ("defaultValueParameterDefinition", "defaultValueParameterDefinition", parameterdefinition.ParameterDefinition, False, "defaultValue", False), ("defaultValuePeriod", "defaultValuePeriod", period.Period, False, "defaultValue", False), ("defaultValuePositiveInt", "defaultValuePositiveInt", int, False, "defaultValue", False), ("defaultValueQuantity", "defaultValueQuantity", quantity.Quantity, False, "defaultValue", False), ("defaultValueRange", "defaultValueRange", range.Range, False, "defaultValue", False), ("defaultValueRatio", "defaultValueRatio", ratio.Ratio, False, "defaultValue", False), ("defaultValueReference", "defaultValueReference", fhirreference.FHIRReference, False, "defaultValue", False), + ("defaultValueRelatedArtifact", "defaultValueRelatedArtifact", relatedartifact.RelatedArtifact, False, "defaultValue", False), ("defaultValueSampledData", "defaultValueSampledData", sampleddata.SampledData, False, "defaultValue", False), ("defaultValueSignature", "defaultValueSignature", signature.Signature, False, "defaultValue", False), ("defaultValueString", "defaultValueString", str, False, "defaultValue", False), ("defaultValueTime", "defaultValueTime", fhirdate.FHIRDate, False, "defaultValue", False), ("defaultValueTiming", "defaultValueTiming", timing.Timing, False, "defaultValue", False), + ("defaultValueTriggerDefinition", "defaultValueTriggerDefinition", triggerdefinition.TriggerDefinition, False, "defaultValue", False), ("defaultValueUnsignedInt", "defaultValueUnsignedInt", int, False, "defaultValue", False), ("defaultValueUri", "defaultValueUri", str, False, "defaultValue", False), + ("defaultValueUrl", "defaultValueUrl", str, False, "defaultValue", False), + ("defaultValueUsageContext", "defaultValueUsageContext", usagecontext.UsageContext, False, "defaultValue", False), + ("defaultValueUuid", "defaultValueUuid", str, False, "defaultValue", False), ("element", "element", str, False, None, False), ("listMode", "listMode", str, False, None, False), + ("logMessage", "logMessage", str, False, None, False), ("max", "max", str, False, None, False), ("min", "min", int, False, None, False), ("type", "type", str, False, None, False), @@ -711,7 +772,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Canonical URL for structure definition. + """ Canonical reference to structure definition. Type `str`. """ super(StructureMapStructure, self).__init__(jsondict=jsondict, strict=strict) @@ -760,18 +821,34 @@ def elementProperties(self): from . import contactpoint except ImportError: contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import contributor +except ImportError: + contributor = sys.modules[__package__ + '.contributor'] try: from . import count except ImportError: count = sys.modules[__package__ + '.count'] +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] try: from . import distance except ImportError: distance = sys.modules[__package__ + '.distance'] +try: + from . import dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] try: from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: @@ -788,14 +865,14 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] -try: - from . import meta -except ImportError: - meta = sys.modules[__package__ + '.meta'] try: from . import money except ImportError: money = sys.modules[__package__ + '.money'] +try: + from . import parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] try: from . import period except ImportError: @@ -812,6 +889,10 @@ def elementProperties(self): from . import ratio except ImportError: ratio = sys.modules[__package__ + '.ratio'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] try: from . import sampleddata except ImportError: @@ -824,6 +905,10 @@ def elementProperties(self): from . import timing except ImportError: timing = sys.modules[__package__ + '.timing'] +try: + from . import triggerdefinition +except ImportError: + triggerdefinition = sys.modules[__package__ + '.triggerdefinition'] try: from . import usagecontext except ImportError: diff --git a/fhirclient/models/structuremap_tests.py b/fhirclient/models/structuremap_tests.py index 29e4ac037..04f57f7d2 100644 --- a/fhirclient/models/structuremap_tests.py +++ b/fhirclient/models/structuremap_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os diff --git a/fhirclient/models/subscription.py b/fhirclient/models/subscription.py index 38f9c0b8b..104df3020 100644 --- a/fhirclient/models/subscription.py +++ b/fhirclient/models/subscription.py @@ -1,20 +1,20 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Subscription) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Subscription) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource class Subscription(domainresource.DomainResource): - """ A server push subscription criteria. + """ Server push subscription criteria. - The subscription resource is used to define a push based subscription from + The subscription resource is used to define a push-based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined - "channel" so that another system is able to take an appropriate action. + "channel" so that another system can take an appropriate action. """ resource_type = "Subscription" @@ -36,7 +36,7 @@ def __init__(self, jsondict=None, strict=True): List of `ContactPoint` items (represented as `dict` in JSON). """ self.criteria = None - """ Rule for server push criteria. + """ Rule for server push. Type `str`. """ self.end = None @@ -55,10 +55,6 @@ def __init__(self, jsondict=None, strict=True): """ requested | active | error | off. Type `str`. """ - self.tag = None - """ A tag to add to matching resources. - List of `Coding` items (represented as `dict` in JSON). """ - super(Subscription, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -71,7 +67,6 @@ def elementProperties(self): ("error", "error", str, False, None, False), ("reason", "reason", str, False, None, True), ("status", "status", str, False, None, True), - ("tag", "tag", coding.Coding, True, None, False), ]) return js @@ -104,7 +99,7 @@ def __init__(self, jsondict=None, strict=True): List of `str` items. """ self.payload = None - """ Mimetype to send, or omit for no payload. + """ MIME type to send, or omit for no payload. Type `str`. """ self.type = None @@ -125,10 +120,6 @@ def elementProperties(self): import sys -try: - from . import coding -except ImportError: - coding = sys.modules[__package__ + '.coding'] try: from . import contactpoint except ImportError: diff --git a/fhirclient/models/subscription_tests.py b/fhirclient/models/subscription_tests.py index b183e0208..61934a379 100644 --- a/fhirclient/models/subscription_tests.py +++ b/fhirclient/models/subscription_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -43,10 +43,11 @@ def implSubscription1(self, inst): self.assertEqual(inst.end.as_json(), "2021-01-01T00:00:00Z") self.assertEqual(inst.error, "Socket Error 10060 - can't connect to host") self.assertEqual(inst.id, "example-error") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.reason, "Monitor new neonatal function") self.assertEqual(inst.status, "error") - self.assertEqual(inst.tag[0].code, "bili-done") - self.assertEqual(inst.tag[0].system, "http://example.org/fhir/cs/internal") self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") @@ -71,10 +72,11 @@ def implSubscription2(self, inst): self.assertEqual(inst.end.date, FHIRDate("2021-01-01T00:00:00Z").date) self.assertEqual(inst.end.as_json(), "2021-01-01T00:00:00Z") self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.reason, "Monitor new neonatal function") self.assertEqual(inst.status, "requested") - self.assertEqual(inst.tag[0].code, "bili-done") - self.assertEqual(inst.tag[0].system, "http://example.org/fhir/cs/internal") self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/substance.py b/fhirclient/models/substance.py index 01f269210..20f7995e7 100644 --- a/fhirclient/models/substance.py +++ b/fhirclient/models/substance.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Substance) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Substance) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -93,7 +93,7 @@ def __init__(self, jsondict=None, strict=True): self.substanceReference = None """ A component of the substance. - Type `FHIRReference` referencing `Substance` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(SubstanceIngredient, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/substance_tests.py b/fhirclient/models/substance_tests.py index cff0e93ce..292977f55 100644 --- a/fhirclient/models/substance_tests.py +++ b/fhirclient/models/substance_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return substance.Substance(js) def testSubstance1(self): - inst = self.instantiate_from("substance-example-amoxicillin-clavulanate.json") + inst = self.instantiate_from("substance-example-silver-nitrate-product.json") self.assertIsNotNone(inst, "Must have instantiated a Substance instance") self.implSubstance1(inst) @@ -32,9 +32,43 @@ def testSubstance1(self): self.implSubstance1(inst2) def implSubstance1(self, inst): + self.assertEqual(inst.category[0].coding[0].code, "chemical") + self.assertEqual(inst.category[0].coding[0].display, "Chemical") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/substance-category") + self.assertEqual(inst.code.coding[0].code, "333346007") + self.assertEqual(inst.code.coding[0].display, "Silver nitrate 20% solution (product)") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.description, "Solution for silver nitrate stain") + self.assertEqual(inst.id, "f204") + self.assertEqual(inst.identifier[0].system, "http://acme.org/identifiers/substances") + self.assertEqual(inst.identifier[0].value, "15970") + self.assertEqual(inst.instance[0].expiry.date, FHIRDate("2018-01-01").date) + self.assertEqual(inst.instance[0].expiry.as_json(), "2018-01-01") + self.assertEqual(inst.instance[0].identifier.system, "http://acme.org/identifiers/substances/lot") + self.assertEqual(inst.instance[0].identifier.value, "AB94687") + self.assertEqual(inst.instance[0].quantity.code, "mL") + self.assertEqual(inst.instance[0].quantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.instance[0].quantity.unit, "mL") + self.assertEqual(inst.instance[0].quantity.value, 100) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.status, "generated") + + def testSubstance2(self): + inst = self.instantiate_from("substance-example-amoxicillin-clavulanate.json") + self.assertIsNotNone(inst, "Must have instantiated a Substance instance") + self.implSubstance2(inst) + + js = inst.as_json() + self.assertEqual("Substance", js["resourceType"]) + inst2 = substance.Substance(js) + self.implSubstance2(inst2) + + def implSubstance2(self, inst): self.assertEqual(inst.category[0].coding[0].code, "drug") self.assertEqual(inst.category[0].coding[0].display, "Drug or Medicament") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org.fhir/substance-category") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/substance-category") self.assertEqual(inst.code.coding[0].code, "392259005") self.assertEqual(inst.code.coding[0].display, "Amoxicillin + clavulanate potassium 875mg/125mg tablet (product)") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") @@ -58,27 +92,13 @@ def implSubstance1(self, inst): self.assertEqual(inst.ingredient[1].quantity.numerator.system, "http://unitsofmeasure.org") self.assertEqual(inst.ingredient[1].quantity.numerator.unit, "mg") self.assertEqual(inst.ingredient[1].quantity.numerator.value, 125) - self.assertEqual(inst.text.status, "generated") - - def testSubstance2(self): - inst = self.instantiate_from("substance-example-f201-dust.json") - self.assertIsNotNone(inst, "Must have instantiated a Substance instance") - self.implSubstance2(inst) - - js = inst.as_json() - self.assertEqual("Substance", js["resourceType"]) - inst2 = substance.Substance(js) - self.implSubstance2(inst2) - - def implSubstance2(self, inst): - self.assertEqual(inst.code.coding[0].code, "406466009") - self.assertEqual(inst.code.coding[0].display, "House dust allergen") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f201") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") def testSubstance3(self): - inst = self.instantiate_from("substance-example-f202-staphylococcus.json") + inst = self.instantiate_from("substance-example-f203-potassium.json") self.assertIsNotNone(inst, "Must have instantiated a Substance instance") self.implSubstance3(inst) @@ -88,14 +108,22 @@ def testSubstance3(self): self.implSubstance3(inst2) def implSubstance3(self, inst): - self.assertEqual(inst.code.coding[0].code, "3092008") - self.assertEqual(inst.code.coding[0].display, "Staphylococcus Aureus") + self.assertEqual(inst.category[0].coding[0].code, "chemical") + self.assertEqual(inst.category[0].coding[0].display, "Chemical") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/substance-category") + self.assertEqual(inst.code.coding[0].code, "88480006") + self.assertEqual(inst.code.coding[0].display, "Potassium") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f202") + self.assertEqual(inst.id, "f203") + self.assertEqual(inst.identifier[0].system, "http://acme.org/identifiers/substances") + self.assertEqual(inst.identifier[0].value, "1234") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") def testSubstance4(self): - inst = self.instantiate_from("substance-example-f203-potassium.json") + inst = self.instantiate_from("substance-example-f201-dust.json") self.assertIsNotNone(inst, "Must have instantiated a Substance instance") self.implSubstance4(inst) @@ -105,19 +133,17 @@ def testSubstance4(self): self.implSubstance4(inst2) def implSubstance4(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "chemical") - self.assertEqual(inst.category[0].coding[0].display, "Chemical") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org.fhir/substance-category") - self.assertEqual(inst.code.coding[0].code, "88480006") - self.assertEqual(inst.code.coding[0].display, "Potassium") + self.assertEqual(inst.code.coding[0].code, "406466009") + self.assertEqual(inst.code.coding[0].display, "House dust allergen") self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.id, "f203") - self.assertEqual(inst.identifier[0].system, "http://acme.org/identifiers/substances") - self.assertEqual(inst.identifier[0].value, "1234") + self.assertEqual(inst.id, "f201") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") def testSubstance5(self): - inst = self.instantiate_from("substance-example-silver-nitrate-product.json") + inst = self.instantiate_from("substance-example.json") self.assertIsNotNone(inst, "Must have instantiated a Substance instance") self.implSubstance5(inst) @@ -127,28 +153,21 @@ def testSubstance5(self): self.implSubstance5(inst2) def implSubstance5(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "chemical") - self.assertEqual(inst.category[0].coding[0].display, "Chemical") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org.fhir/substance-category") - self.assertEqual(inst.code.coding[0].code, "333346007") - self.assertEqual(inst.code.coding[0].display, "Silver nitrate 20% solution (product)") - self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") - self.assertEqual(inst.description, "Solution for silver nitrate stain") - self.assertEqual(inst.id, "f204") + self.assertEqual(inst.category[0].coding[0].code, "allergen") + self.assertEqual(inst.category[0].coding[0].display, "Allergen") + self.assertEqual(inst.category[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/substance-category") + self.assertEqual(inst.code.text, "apitoxin (Honey Bee Venom)") + self.assertEqual(inst.id, "example") self.assertEqual(inst.identifier[0].system, "http://acme.org/identifiers/substances") - self.assertEqual(inst.identifier[0].value, "15970") - self.assertEqual(inst.instance[0].expiry.date, FHIRDate("2018-01-01").date) - self.assertEqual(inst.instance[0].expiry.as_json(), "2018-01-01") - self.assertEqual(inst.instance[0].identifier.system, "http://acme.org/identifiers/substances/lot") - self.assertEqual(inst.instance[0].identifier.value, "AB94687") - self.assertEqual(inst.instance[0].quantity.code, "mL") - self.assertEqual(inst.instance[0].quantity.system, "http://unitsofmeasure.org") - self.assertEqual(inst.instance[0].quantity.unit, "mL") - self.assertEqual(inst.instance[0].quantity.value, 100) + self.assertEqual(inst.identifier[0].value, "1463") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") def testSubstance6(self): - inst = self.instantiate_from("substance-example.json") + inst = self.instantiate_from("substance-example-f202-staphylococcus.json") self.assertIsNotNone(inst, "Must have instantiated a Substance instance") self.implSubstance6(inst) @@ -158,13 +177,12 @@ def testSubstance6(self): self.implSubstance6(inst2) def implSubstance6(self, inst): - self.assertEqual(inst.category[0].coding[0].code, "allergen") - self.assertEqual(inst.category[0].coding[0].display, "Allergen") - self.assertEqual(inst.category[0].coding[0].system, "http://hl7.org.fhir/substance-category") - self.assertEqual(inst.code.text, "apitoxin (Honey Bee Venom)") - self.assertEqual(inst.id, "example") - self.assertEqual(inst.identifier[0].system, "http://acme.org/identifiers/substances") - self.assertEqual(inst.identifier[0].value, "1463") - self.assertEqual(inst.status, "active") + self.assertEqual(inst.code.coding[0].code, "3092008") + self.assertEqual(inst.code.coding[0].display, "Staphylococcus Aureus") + self.assertEqual(inst.code.coding[0].system, "http://snomed.info/sct") + self.assertEqual(inst.id, "f202") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/substanceamount.py b/fhirclient/models/substanceamount.py new file mode 100644 index 000000000..dc3983faf --- /dev/null +++ b/fhirclient/models/substanceamount.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceAmount) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import backboneelement + +class SubstanceAmount(backboneelement.BackboneElement): + """ Chemical substances are a single substance type whose primary defining + element is the molecular structure. Chemical substances shall be defined on + the basis of their complete covalent molecular structure; the presence of a + salt (counter-ion) and/or solvates (water, alcohols) is also captured. + Purity, grade, physical form or particle size are not taken into account in + the definition of a chemical substance or in the assignment of a Substance + ID. + """ + + resource_type = "SubstanceAmount" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amountQuantity = None + """ Used to capture quantitative values for a variety of elements. If + only limits are given, the arithmetic mean would be the average. If + only a single definite value for a given element is given, it would + be captured in this field. + Type `Quantity` (represented as `dict` in JSON). """ + + self.amountRange = None + """ Used to capture quantitative values for a variety of elements. If + only limits are given, the arithmetic mean would be the average. If + only a single definite value for a given element is given, it would + be captured in this field. + Type `Range` (represented as `dict` in JSON). """ + + self.amountString = None + """ Used to capture quantitative values for a variety of elements. If + only limits are given, the arithmetic mean would be the average. If + only a single definite value for a given element is given, it would + be captured in this field. + Type `str`. """ + + self.amountText = None + """ A textual comment on a numeric value. + Type `str`. """ + + self.amountType = None + """ Most elements that require a quantitative value will also have a + field called amount type. Amount type should always be specified + because the actual value of the amount is often dependent on it. + EXAMPLE: In capturing the actual relative amounts of substances or + molecular fragments it is essential to indicate whether the amount + refers to a mole ratio or weight ratio. For any given element an + effort should be made to use same the amount type for all related + definitional elements. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.referenceRange = None + """ Reference range of possible or expected values. + Type `SubstanceAmountReferenceRange` (represented as `dict` in JSON). """ + + super(SubstanceAmount, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceAmount, self).elementProperties() + js.extend([ + ("amountQuantity", "amountQuantity", quantity.Quantity, False, "amount", False), + ("amountRange", "amountRange", range.Range, False, "amount", False), + ("amountString", "amountString", str, False, "amount", False), + ("amountText", "amountText", str, False, None, False), + ("amountType", "amountType", codeableconcept.CodeableConcept, False, None, False), + ("referenceRange", "referenceRange", SubstanceAmountReferenceRange, False, None, False), + ]) + return js + + +from . import element + +class SubstanceAmountReferenceRange(element.Element): + """ Reference range of possible or expected values. + """ + + resource_type = "SubstanceAmountReferenceRange" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.highLimit = None + """ Upper limit possible or expected. + Type `Quantity` (represented as `dict` in JSON). """ + + self.lowLimit = None + """ Lower limit possible or expected. + Type `Quantity` (represented as `dict` in JSON). """ + + super(SubstanceAmountReferenceRange, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceAmountReferenceRange, self).elementProperties() + js.extend([ + ("highLimit", "highLimit", quantity.Quantity, False, None, False), + ("lowLimit", "lowLimit", quantity.Quantity, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/substancenucleicacid.py b/fhirclient/models/substancenucleicacid.py new file mode 100644 index 000000000..e688477b5 --- /dev/null +++ b/fhirclient/models/substancenucleicacid.py @@ -0,0 +1,256 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceNucleicAcid) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class SubstanceNucleicAcid(domainresource.DomainResource): + """ Nucleic acids are defined by three distinct elements: the base, sugar and + linkage. Individual substance/moiety IDs will be created for each of these + elements. The nucleotide sequence will be always entered in the 5’-3’ + direction. + """ + + resource_type = "SubstanceNucleicAcid" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.areaOfHybridisation = None + """ The area of hybridisation shall be described if applicable for + double stranded RNA or DNA. The number associated with the subunit + followed by the number associated to the residue shall be specified + in increasing order. The underscore “” shall be used as separator + as follows: “Subunitnumber Residue”. + Type `str`. """ + + self.numberOfSubunits = None + """ The number of linear sequences of nucleotides linked through + phosphodiester bonds shall be described. Subunits would be strands + of nucleic acids that are tightly associated typically through + Watson-Crick base pairing. NOTE: If not specified in the reference + source, the assumption is that there is 1 subunit. + Type `int`. """ + + self.oligoNucleotideType = None + """ (TBC). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sequenceType = None + """ The type of the sequence shall be specified based on a controlled + vocabulary. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subunit = None + """ Subunits are listed in order of decreasing length; sequences of the + same length will be ordered by molecular weight; subunits that have + identical sequences will be repeated multiple times. + List of `SubstanceNucleicAcidSubunit` items (represented as `dict` in JSON). """ + + super(SubstanceNucleicAcid, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceNucleicAcid, self).elementProperties() + js.extend([ + ("areaOfHybridisation", "areaOfHybridisation", str, False, None, False), + ("numberOfSubunits", "numberOfSubunits", int, False, None, False), + ("oligoNucleotideType", "oligoNucleotideType", codeableconcept.CodeableConcept, False, None, False), + ("sequenceType", "sequenceType", codeableconcept.CodeableConcept, False, None, False), + ("subunit", "subunit", SubstanceNucleicAcidSubunit, True, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceNucleicAcidSubunit(backboneelement.BackboneElement): + """ Subunits are listed in order of decreasing length; sequences of the same + length will be ordered by molecular weight; subunits that have identical + sequences will be repeated multiple times. + """ + + resource_type = "SubstanceNucleicAcidSubunit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.fivePrime = None + """ The nucleotide present at the 5’ terminal shall be specified based + on a controlled vocabulary. Since the sequence is represented from + the 5' to the 3' end, the 5’ prime nucleotide is the letter at the + first position in the sequence. A separate representation would be + redundant. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.length = None + """ The length of the sequence shall be captured. + Type `int`. """ + + self.linkage = None + """ The linkages between sugar residues will also be captured. + List of `SubstanceNucleicAcidSubunitLinkage` items (represented as `dict` in JSON). """ + + self.sequence = None + """ Actual nucleotide sequence notation from 5' to 3' end using + standard single letter codes. In addition to the base sequence, + sugar and type of phosphate or non-phosphate linkage should also be + captured. + Type `str`. """ + + self.sequenceAttachment = None + """ (TBC). + Type `Attachment` (represented as `dict` in JSON). """ + + self.subunit = None + """ Index of linear sequences of nucleic acids in order of decreasing + length. Sequences of the same length will be ordered by molecular + weight. Subunits that have identical sequences will be repeated and + have sequential subscripts. + Type `int`. """ + + self.sugar = None + """ 5.3.6.8.1 Sugar ID (Mandatory). + List of `SubstanceNucleicAcidSubunitSugar` items (represented as `dict` in JSON). """ + + self.threePrime = None + """ The nucleotide present at the 3’ terminal shall be specified based + on a controlled vocabulary. Since the sequence is represented from + the 5' to the 3' end, the 5’ prime nucleotide is the letter at the + last position in the sequence. A separate representation would be + redundant. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceNucleicAcidSubunit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceNucleicAcidSubunit, self).elementProperties() + js.extend([ + ("fivePrime", "fivePrime", codeableconcept.CodeableConcept, False, None, False), + ("length", "length", int, False, None, False), + ("linkage", "linkage", SubstanceNucleicAcidSubunitLinkage, True, None, False), + ("sequence", "sequence", str, False, None, False), + ("sequenceAttachment", "sequenceAttachment", attachment.Attachment, False, None, False), + ("subunit", "subunit", int, False, None, False), + ("sugar", "sugar", SubstanceNucleicAcidSubunitSugar, True, None, False), + ("threePrime", "threePrime", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceNucleicAcidSubunitLinkage(backboneelement.BackboneElement): + """ The linkages between sugar residues will also be captured. + """ + + resource_type = "SubstanceNucleicAcidSubunitLinkage" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.connectivity = None + """ The entity that links the sugar residues together should also be + captured for nearly all naturally occurring nucleic acid the + linkage is a phosphate group. For many synthetic oligonucleotides + phosphorothioate linkages are often seen. Linkage connectivity is + assumed to be 3’-5’. If the linkage is either 3’-3’ or 5’-5’ this + should be specified. + Type `str`. """ + + self.identifier = None + """ Each linkage will be registered as a fragment and have an ID. + Type `Identifier` (represented as `dict` in JSON). """ + + self.name = None + """ Each linkage will be registered as a fragment and have at least one + name. A single name shall be assigned to each linkage. + Type `str`. """ + + self.residueSite = None + """ Residues shall be captured as described in 5.3.6.8.3. + Type `str`. """ + + super(SubstanceNucleicAcidSubunitLinkage, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceNucleicAcidSubunitLinkage, self).elementProperties() + js.extend([ + ("connectivity", "connectivity", str, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("name", "name", str, False, None, False), + ("residueSite", "residueSite", str, False, None, False), + ]) + return js + + +class SubstanceNucleicAcidSubunitSugar(backboneelement.BackboneElement): + """ 5.3.6.8.1 Sugar ID (Mandatory). + """ + + resource_type = "SubstanceNucleicAcidSubunitSugar" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.identifier = None + """ The Substance ID of the sugar or sugar-like component that make up + the nucleotide. + Type `Identifier` (represented as `dict` in JSON). """ + + self.name = None + """ The name of the sugar or sugar-like component that make up the + nucleotide. + Type `str`. """ + + self.residueSite = None + """ The residues that contain a given sugar will be captured. The order + of given residues will be captured in the 5‘-3‘direction consistent + with the base sequences listed above. + Type `str`. """ + + super(SubstanceNucleicAcidSubunitSugar, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceNucleicAcidSubunitSugar, self).elementProperties() + js.extend([ + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("name", "name", str, False, None, False), + ("residueSite", "residueSite", str, False, None, False), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/substancepolymer.py b/fhirclient/models/substancepolymer.py new file mode 100644 index 000000000..da3ddbe65 --- /dev/null +++ b/fhirclient/models/substancepolymer.py @@ -0,0 +1,315 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstancePolymer) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class SubstancePolymer(domainresource.DomainResource): + """ Todo. + """ + + resource_type = "SubstancePolymer" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.class_fhir = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.copolymerConnectivity = None + """ Todo. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.geometry = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.modification = None + """ Todo. + List of `str` items. """ + + self.monomerSet = None + """ Todo. + List of `SubstancePolymerMonomerSet` items (represented as `dict` in JSON). """ + + self.repeat = None + """ Todo. + List of `SubstancePolymerRepeat` items (represented as `dict` in JSON). """ + + super(SubstancePolymer, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstancePolymer, self).elementProperties() + js.extend([ + ("class_fhir", "class", codeableconcept.CodeableConcept, False, None, False), + ("copolymerConnectivity", "copolymerConnectivity", codeableconcept.CodeableConcept, True, None, False), + ("geometry", "geometry", codeableconcept.CodeableConcept, False, None, False), + ("modification", "modification", str, True, None, False), + ("monomerSet", "monomerSet", SubstancePolymerMonomerSet, True, None, False), + ("repeat", "repeat", SubstancePolymerRepeat, True, None, False), + ]) + return js + + +from . import backboneelement + +class SubstancePolymerMonomerSet(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstancePolymerMonomerSet" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.ratioType = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.startingMaterial = None + """ Todo. + List of `SubstancePolymerMonomerSetStartingMaterial` items (represented as `dict` in JSON). """ + + super(SubstancePolymerMonomerSet, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstancePolymerMonomerSet, self).elementProperties() + js.extend([ + ("ratioType", "ratioType", codeableconcept.CodeableConcept, False, None, False), + ("startingMaterial", "startingMaterial", SubstancePolymerMonomerSetStartingMaterial, True, None, False), + ]) + return js + + +class SubstancePolymerMonomerSetStartingMaterial(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstancePolymerMonomerSetStartingMaterial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Todo. + Type `SubstanceAmount` (represented as `dict` in JSON). """ + + self.isDefining = None + """ Todo. + Type `bool`. """ + + self.material = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstancePolymerMonomerSetStartingMaterial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstancePolymerMonomerSetStartingMaterial, self).elementProperties() + js.extend([ + ("amount", "amount", substanceamount.SubstanceAmount, False, None, False), + ("isDefining", "isDefining", bool, False, None, False), + ("material", "material", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstancePolymerRepeat(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstancePolymerRepeat" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.averageMolecularFormula = None + """ Todo. + Type `str`. """ + + self.numberOfUnits = None + """ Todo. + Type `int`. """ + + self.repeatUnit = None + """ Todo. + List of `SubstancePolymerRepeatRepeatUnit` items (represented as `dict` in JSON). """ + + self.repeatUnitAmountType = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstancePolymerRepeat, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstancePolymerRepeat, self).elementProperties() + js.extend([ + ("averageMolecularFormula", "averageMolecularFormula", str, False, None, False), + ("numberOfUnits", "numberOfUnits", int, False, None, False), + ("repeatUnit", "repeatUnit", SubstancePolymerRepeatRepeatUnit, True, None, False), + ("repeatUnitAmountType", "repeatUnitAmountType", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstancePolymerRepeatRepeatUnit(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstancePolymerRepeatRepeatUnit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Todo. + Type `SubstanceAmount` (represented as `dict` in JSON). """ + + self.degreeOfPolymerisation = None + """ Todo. + List of `SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation` items (represented as `dict` in JSON). """ + + self.orientationOfPolymerisation = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.repeatUnit = None + """ Todo. + Type `str`. """ + + self.structuralRepresentation = None + """ Todo. + List of `SubstancePolymerRepeatRepeatUnitStructuralRepresentation` items (represented as `dict` in JSON). """ + + super(SubstancePolymerRepeatRepeatUnit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstancePolymerRepeatRepeatUnit, self).elementProperties() + js.extend([ + ("amount", "amount", substanceamount.SubstanceAmount, False, None, False), + ("degreeOfPolymerisation", "degreeOfPolymerisation", SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation, True, None, False), + ("orientationOfPolymerisation", "orientationOfPolymerisation", codeableconcept.CodeableConcept, False, None, False), + ("repeatUnit", "repeatUnit", str, False, None, False), + ("structuralRepresentation", "structuralRepresentation", SubstancePolymerRepeatRepeatUnitStructuralRepresentation, True, None, False), + ]) + return js + + +class SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Todo. + Type `SubstanceAmount` (represented as `dict` in JSON). """ + + self.degree = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation, self).elementProperties() + js.extend([ + ("amount", "amount", substanceamount.SubstanceAmount, False, None, False), + ("degree", "degree", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstancePolymerRepeatRepeatUnitStructuralRepresentation(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstancePolymerRepeatRepeatUnitStructuralRepresentation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.attachment = None + """ Todo. + Type `Attachment` (represented as `dict` in JSON). """ + + self.representation = None + """ Todo. + Type `str`. """ + + self.type = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstancePolymerRepeatRepeatUnitStructuralRepresentation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstancePolymerRepeatRepeatUnitStructuralRepresentation, self).elementProperties() + js.extend([ + ("attachment", "attachment", attachment.Attachment, False, None, False), + ("representation", "representation", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import substanceamount +except ImportError: + substanceamount = sys.modules[__package__ + '.substanceamount'] diff --git a/fhirclient/models/substanceprotein.py b/fhirclient/models/substanceprotein.py new file mode 100644 index 000000000..4770bc693 --- /dev/null +++ b/fhirclient/models/substanceprotein.py @@ -0,0 +1,183 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceProtein) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class SubstanceProtein(domainresource.DomainResource): + """ A SubstanceProtein is defined as a single unit of a linear amino acid + sequence, or a combination of subunits that are either covalently linked or + have a defined invariant stoichiometric relationship. This includes all + synthetic, recombinant and purified SubstanceProteins of defined sequence, + whether the use is therapeutic or prophylactic. This set of elements will + be used to describe albumins, coagulation factors, cytokines, growth + factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, + recombinant vaccines, and immunomodulators. + """ + + resource_type = "SubstanceProtein" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.disulfideLinkage = None + """ The disulphide bond between two cysteine residues either on the + same subunit or on two different subunits shall be described. The + position of the disulfide bonds in the SubstanceProtein shall be + listed in increasing order of subunit number and position within + subunit followed by the abbreviation of the amino acids involved. + The disulfide linkage positions shall actually contain the amino + acid Cysteine at the respective positions. + List of `str` items. """ + + self.numberOfSubunits = None + """ Number of linear sequences of amino acids linked through peptide + bonds. The number of subunits constituting the SubstanceProtein + shall be described. It is possible that the number of subunits can + be variable. + Type `int`. """ + + self.sequenceType = None + """ The SubstanceProtein descriptive elements will only be used when a + complete or partial amino acid sequence is available or derivable + from a nucleic acid sequence. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.subunit = None + """ This subclause refers to the description of each subunit + constituting the SubstanceProtein. A subunit is a linear sequence + of amino acids linked through peptide bonds. The Subunit + information shall be provided when the finished SubstanceProtein is + a complex of multiple sequences; subunits are not used to delineate + domains within a single sequence. Subunits are listed in order of + decreasing length; sequences of the same length will be ordered by + decreasing molecular weight; subunits that have identical sequences + will be repeated multiple times. + List of `SubstanceProteinSubunit` items (represented as `dict` in JSON). """ + + super(SubstanceProtein, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceProtein, self).elementProperties() + js.extend([ + ("disulfideLinkage", "disulfideLinkage", str, True, None, False), + ("numberOfSubunits", "numberOfSubunits", int, False, None, False), + ("sequenceType", "sequenceType", codeableconcept.CodeableConcept, False, None, False), + ("subunit", "subunit", SubstanceProteinSubunit, True, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceProteinSubunit(backboneelement.BackboneElement): + """ This subclause refers to the description of each subunit constituting the + SubstanceProtein. A subunit is a linear sequence of amino acids linked + through peptide bonds. The Subunit information shall be provided when the + finished SubstanceProtein is a complex of multiple sequences; subunits are + not used to delineate domains within a single sequence. Subunits are listed + in order of decreasing length; sequences of the same length will be ordered + by decreasing molecular weight; subunits that have identical sequences will + be repeated multiple times. + """ + + resource_type = "SubstanceProteinSubunit" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.cTerminalModification = None + """ The modification at the C-terminal shall be specified. + Type `str`. """ + + self.cTerminalModificationId = None + """ Unique identifier for molecular fragment modification based on the + ISO 11238 Substance ID. + Type `Identifier` (represented as `dict` in JSON). """ + + self.length = None + """ Length of linear sequences of amino acids contained in the subunit. + Type `int`. """ + + self.nTerminalModification = None + """ The name of the fragment modified at the N-terminal of the + SubstanceProtein shall be specified. + Type `str`. """ + + self.nTerminalModificationId = None + """ Unique identifier for molecular fragment modification based on the + ISO 11238 Substance ID. + Type `Identifier` (represented as `dict` in JSON). """ + + self.sequence = None + """ The sequence information shall be provided enumerating the amino + acids from N- to C-terminal end using standard single-letter amino + acid codes. Uppercase shall be used for L-amino acids and lowercase + for D-amino acids. Transcribed SubstanceProteins will always be + described using the translated sequence; for synthetic peptide + containing amino acids that are not represented with a single + letter code an X should be used within the sequence. The modified + amino acids will be distinguished by their position in the sequence. + Type `str`. """ + + self.sequenceAttachment = None + """ The sequence information shall be provided enumerating the amino + acids from N- to C-terminal end using standard single-letter amino + acid codes. Uppercase shall be used for L-amino acids and lowercase + for D-amino acids. Transcribed SubstanceProteins will always be + described using the translated sequence; for synthetic peptide + containing amino acids that are not represented with a single + letter code an X should be used within the sequence. The modified + amino acids will be distinguished by their position in the sequence. + Type `Attachment` (represented as `dict` in JSON). """ + + self.subunit = None + """ Index of primary sequences of amino acids linked through peptide + bonds in order of decreasing length. Sequences of the same length + will be ordered by molecular weight. Subunits that have identical + sequences will be repeated and have sequential subscripts. + Type `int`. """ + + super(SubstanceProteinSubunit, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceProteinSubunit, self).elementProperties() + js.extend([ + ("cTerminalModification", "cTerminalModification", str, False, None, False), + ("cTerminalModificationId", "cTerminalModificationId", identifier.Identifier, False, None, False), + ("length", "length", int, False, None, False), + ("nTerminalModification", "nTerminalModification", str, False, None, False), + ("nTerminalModificationId", "nTerminalModificationId", identifier.Identifier, False, None, False), + ("sequence", "sequence", str, False, None, False), + ("sequenceAttachment", "sequenceAttachment", attachment.Attachment, False, None, False), + ("subunit", "subunit", int, False, None, False), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/substancereferenceinformation.py b/fhirclient/models/substancereferenceinformation.py new file mode 100644 index 000000000..2f6fac14b --- /dev/null +++ b/fhirclient/models/substancereferenceinformation.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class SubstanceReferenceInformation(domainresource.DomainResource): + """ Todo. + """ + + resource_type = "SubstanceReferenceInformation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.classification = None + """ Todo. + List of `SubstanceReferenceInformationClassification` items (represented as `dict` in JSON). """ + + self.comment = None + """ Todo. + Type `str`. """ + + self.gene = None + """ Todo. + List of `SubstanceReferenceInformationGene` items (represented as `dict` in JSON). """ + + self.geneElement = None + """ Todo. + List of `SubstanceReferenceInformationGeneElement` items (represented as `dict` in JSON). """ + + self.target = None + """ Todo. + List of `SubstanceReferenceInformationTarget` items (represented as `dict` in JSON). """ + + super(SubstanceReferenceInformation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceReferenceInformation, self).elementProperties() + js.extend([ + ("classification", "classification", SubstanceReferenceInformationClassification, True, None, False), + ("comment", "comment", str, False, None, False), + ("gene", "gene", SubstanceReferenceInformationGene, True, None, False), + ("geneElement", "geneElement", SubstanceReferenceInformationGeneElement, True, None, False), + ("target", "target", SubstanceReferenceInformationTarget, True, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceReferenceInformationClassification(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstanceReferenceInformationClassification" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.classification = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.domain = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.source = None + """ Todo. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.subtype = None + """ Todo. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + super(SubstanceReferenceInformationClassification, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceReferenceInformationClassification, self).elementProperties() + js.extend([ + ("classification", "classification", codeableconcept.CodeableConcept, False, None, False), + ("domain", "domain", codeableconcept.CodeableConcept, False, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("subtype", "subtype", codeableconcept.CodeableConcept, True, None, False), + ]) + return js + + +class SubstanceReferenceInformationGene(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstanceReferenceInformationGene" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.gene = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.geneSequenceOrigin = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.source = None + """ Todo. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + super(SubstanceReferenceInformationGene, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceReferenceInformationGene, self).elementProperties() + js.extend([ + ("gene", "gene", codeableconcept.CodeableConcept, False, None, False), + ("geneSequenceOrigin", "geneSequenceOrigin", codeableconcept.CodeableConcept, False, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ]) + return js + + +class SubstanceReferenceInformationGeneElement(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstanceReferenceInformationGeneElement" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.element = None + """ Todo. + Type `Identifier` (represented as `dict` in JSON). """ + + self.source = None + """ Todo. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.type = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceReferenceInformationGeneElement, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceReferenceInformationGeneElement, self).elementProperties() + js.extend([ + ("element", "element", identifier.Identifier, False, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceReferenceInformationTarget(backboneelement.BackboneElement): + """ Todo. + """ + + resource_type = "SubstanceReferenceInformationTarget" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amountQuantity = None + """ Todo. + Type `Quantity` (represented as `dict` in JSON). """ + + self.amountRange = None + """ Todo. + Type `Range` (represented as `dict` in JSON). """ + + self.amountString = None + """ Todo. + Type `str`. """ + + self.amountType = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.interaction = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.organism = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.organismType = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.source = None + """ Todo. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.target = None + """ Todo. + Type `Identifier` (represented as `dict` in JSON). """ + + self.type = None + """ Todo. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceReferenceInformationTarget, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceReferenceInformationTarget, self).elementProperties() + js.extend([ + ("amountQuantity", "amountQuantity", quantity.Quantity, False, "amount", False), + ("amountRange", "amountRange", range.Range, False, "amount", False), + ("amountString", "amountString", str, False, "amount", False), + ("amountType", "amountType", codeableconcept.CodeableConcept, False, None, False), + ("interaction", "interaction", codeableconcept.CodeableConcept, False, None, False), + ("organism", "organism", codeableconcept.CodeableConcept, False, None, False), + ("organismType", "organismType", codeableconcept.CodeableConcept, False, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("target", "target", identifier.Identifier, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] diff --git a/fhirclient/models/substancesourcematerial.py b/fhirclient/models/substancesourcematerial.py new file mode 100644 index 000000000..45c346b76 --- /dev/null +++ b/fhirclient/models/substancesourcematerial.py @@ -0,0 +1,439 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceSourceMaterial) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class SubstanceSourceMaterial(domainresource.DomainResource): + """ Source material shall capture information on the taxonomic and anatomical + origins as well as the fraction of a material that can result in or can be + modified to form a substance. This set of data elements shall be used to + define polymer substances isolated from biological matrices. Taxonomic and + anatomical origins shall be described using a controlled vocabulary as + required. This information is captured for naturally derived polymers ( . + starch) and structurally diverse substances. For Organisms belonging to the + Kingdom Plantae the Substance level defines the fresh material of a single + species or infraspecies, the Herbal Drug and the Herbal preparation. For + Herbal preparations, the fraction information will be captured at the + Substance information level and additional information for herbal extracts + will be captured at the Specified Substance Group 1 information level. See + for further explanation the Substance Class: Structurally Diverse and the + herbal annex. + """ + + resource_type = "SubstanceSourceMaterial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.countryOfOrigin = None + """ The country where the plant material is harvested or the countries + where the plasma is sourced from as laid down in accordance with + the Plasma Master File. For “Plasma-derived substances” the + attribute country of origin provides information about the + countries used for the manufacturing of the Cryopoor plama or + Crioprecipitate. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.developmentStage = None + """ Stage of life for animals, plants, insects and microorganisms. This + information shall be provided only when the substance is + significantly different in these stages (e.g. foetal bovine serum). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.fractionDescription = None + """ Many complex materials are fractions of parts of plants, animals, + or minerals. Fraction elements are often necessary to define both + Substances and Specified Group 1 Substances. For substances derived + from Plants, fraction information will be captured at the Substance + information level ( . Oils, Juices and Exudates). Additional + information for Extracts, such as extraction solvent composition, + will be captured at the Specified Substance Group 1 information + level. For plasma-derived products fraction information will be + captured at the Substance and the Specified Substance Group 1 + levels. + List of `SubstanceSourceMaterialFractionDescription` items (represented as `dict` in JSON). """ + + self.geographicalLocation = None + """ The place/region where the plant is harvested or the places/regions + where the animal source material has its habitat. + List of `str` items. """ + + self.organism = None + """ This subclause describes the organism which the substance is + derived from. For vaccines, the parent organism shall be specified + based on these subclause elements. As an example, full taxonomy + will be described for the Substance Name: ., Leaf. + Type `SubstanceSourceMaterialOrganism` (represented as `dict` in JSON). """ + + self.organismId = None + """ The unique identifier associated with the source material parent + organism shall be specified. + Type `Identifier` (represented as `dict` in JSON). """ + + self.organismName = None + """ The organism accepted Scientific name shall be provided based on + the organism taxonomy. + Type `str`. """ + + self.parentSubstanceId = None + """ The parent of the herbal drug Ginkgo biloba, Leaf is the substance + ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. + (Whole plant). + List of `Identifier` items (represented as `dict` in JSON). """ + + self.parentSubstanceName = None + """ The parent substance of the Herbal Drug, or Herbal preparation. + List of `str` items. """ + + self.partDescription = None + """ To do. + List of `SubstanceSourceMaterialPartDescription` items (represented as `dict` in JSON). """ + + self.sourceMaterialClass = None + """ General high level classification of the source material specific + to the origin of the material. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sourceMaterialState = None + """ The state of the source material when extracted. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.sourceMaterialType = None + """ The type of the source material shall be specified based on a + controlled vocabulary. For vaccines, this subclause refers to the + class of infectious agent. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSourceMaterial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSourceMaterial, self).elementProperties() + js.extend([ + ("countryOfOrigin", "countryOfOrigin", codeableconcept.CodeableConcept, True, None, False), + ("developmentStage", "developmentStage", codeableconcept.CodeableConcept, False, None, False), + ("fractionDescription", "fractionDescription", SubstanceSourceMaterialFractionDescription, True, None, False), + ("geographicalLocation", "geographicalLocation", str, True, None, False), + ("organism", "organism", SubstanceSourceMaterialOrganism, False, None, False), + ("organismId", "organismId", identifier.Identifier, False, None, False), + ("organismName", "organismName", str, False, None, False), + ("parentSubstanceId", "parentSubstanceId", identifier.Identifier, True, None, False), + ("parentSubstanceName", "parentSubstanceName", str, True, None, False), + ("partDescription", "partDescription", SubstanceSourceMaterialPartDescription, True, None, False), + ("sourceMaterialClass", "sourceMaterialClass", codeableconcept.CodeableConcept, False, None, False), + ("sourceMaterialState", "sourceMaterialState", codeableconcept.CodeableConcept, False, None, False), + ("sourceMaterialType", "sourceMaterialType", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceSourceMaterialFractionDescription(backboneelement.BackboneElement): + """ Many complex materials are fractions of parts of plants, animals, or + minerals. Fraction elements are often necessary to define both Substances + and Specified Group 1 Substances. For substances derived from Plants, + fraction information will be captured at the Substance information level ( + . Oils, Juices and Exudates). Additional information for Extracts, such as + extraction solvent composition, will be captured at the Specified Substance + Group 1 information level. For plasma-derived products fraction information + will be captured at the Substance and the Specified Substance Group 1 + levels. + """ + + resource_type = "SubstanceSourceMaterialFractionDescription" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.fraction = None + """ This element is capturing information about the fraction of a plant + part, or human plasma for fractionation. + Type `str`. """ + + self.materialType = None + """ The specific type of the material constituting the component. For + Herbal preparations the particulars of the extracts (liquid/dry) is + described in Specified Substance Group 1. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSourceMaterialFractionDescription, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSourceMaterialFractionDescription, self).elementProperties() + js.extend([ + ("fraction", "fraction", str, False, None, False), + ("materialType", "materialType", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSourceMaterialOrganism(backboneelement.BackboneElement): + """ This subclause describes the organism which the substance is derived from. + For vaccines, the parent organism shall be specified based on these + subclause elements. As an example, full taxonomy will be described for the + Substance Name: ., Leaf. + """ + + resource_type = "SubstanceSourceMaterialOrganism" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.author = None + """ 4.9.13.6.1 Author type (Conditional). + List of `SubstanceSourceMaterialOrganismAuthor` items (represented as `dict` in JSON). """ + + self.family = None + """ The family of an organism shall be specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.genus = None + """ The genus of an organism shall be specified; refers to the Latin + epithet of the genus element of the plant/animal scientific name; + it is present in names for genera, species and infraspecies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.hybrid = None + """ 4.9.13.8.1 Hybrid species maternal organism ID (Optional). + Type `SubstanceSourceMaterialOrganismHybrid` (represented as `dict` in JSON). """ + + self.intraspecificDescription = None + """ The intraspecific description of an organism shall be specified + based on a controlled vocabulary. For Influenza Vaccine, the + intraspecific description shall contain the syntax of the antigen + in line with the WHO convention. + Type `str`. """ + + self.intraspecificType = None + """ The Intraspecific type of an organism shall be specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.organismGeneral = None + """ 4.9.13.7.1 Kingdom (Conditional). + Type `SubstanceSourceMaterialOrganismOrganismGeneral` (represented as `dict` in JSON). """ + + self.species = None + """ The species of an organism shall be specified; refers to the Latin + epithet of the species of the plant/animal; it is present in names + for species and infraspecies. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSourceMaterialOrganism, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSourceMaterialOrganism, self).elementProperties() + js.extend([ + ("author", "author", SubstanceSourceMaterialOrganismAuthor, True, None, False), + ("family", "family", codeableconcept.CodeableConcept, False, None, False), + ("genus", "genus", codeableconcept.CodeableConcept, False, None, False), + ("hybrid", "hybrid", SubstanceSourceMaterialOrganismHybrid, False, None, False), + ("intraspecificDescription", "intraspecificDescription", str, False, None, False), + ("intraspecificType", "intraspecificType", codeableconcept.CodeableConcept, False, None, False), + ("organismGeneral", "organismGeneral", SubstanceSourceMaterialOrganismOrganismGeneral, False, None, False), + ("species", "species", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSourceMaterialOrganismAuthor(backboneelement.BackboneElement): + """ 4.9.13.6.1 Author type (Conditional). + """ + + resource_type = "SubstanceSourceMaterialOrganismAuthor" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authorDescription = None + """ The author of an organism species shall be specified. The author + year of an organism shall also be specified when applicable; refers + to the year in which the first author(s) published the + infraspecific plant/animal name (of any rank). + Type `str`. """ + + self.authorType = None + """ The type of author of an organism species shall be specified. The + parenthetical author of an organism species refers to the first + author who published the plant/animal name (of any rank). The + primary author of an organism species refers to the first + author(s), who validly published the plant/animal name. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSourceMaterialOrganismAuthor, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSourceMaterialOrganismAuthor, self).elementProperties() + js.extend([ + ("authorDescription", "authorDescription", str, False, None, False), + ("authorType", "authorType", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSourceMaterialOrganismHybrid(backboneelement.BackboneElement): + """ 4.9.13.8.1 Hybrid species maternal organism ID (Optional). + """ + + resource_type = "SubstanceSourceMaterialOrganismHybrid" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.hybridType = None + """ The hybrid type of an organism shall be specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.maternalOrganismId = None + """ The identifier of the maternal species constituting the hybrid + organism shall be specified based on a controlled vocabulary. For + plants, the parents aren’t always known, and it is unlikely that it + will be known which is maternal and which is paternal. + Type `str`. """ + + self.maternalOrganismName = None + """ The name of the maternal species constituting the hybrid organism + shall be specified. For plants, the parents aren’t always known, + and it is unlikely that it will be known which is maternal and + which is paternal. + Type `str`. """ + + self.paternalOrganismId = None + """ The identifier of the paternal species constituting the hybrid + organism shall be specified based on a controlled vocabulary. + Type `str`. """ + + self.paternalOrganismName = None + """ The name of the paternal species constituting the hybrid organism + shall be specified. + Type `str`. """ + + super(SubstanceSourceMaterialOrganismHybrid, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSourceMaterialOrganismHybrid, self).elementProperties() + js.extend([ + ("hybridType", "hybridType", codeableconcept.CodeableConcept, False, None, False), + ("maternalOrganismId", "maternalOrganismId", str, False, None, False), + ("maternalOrganismName", "maternalOrganismName", str, False, None, False), + ("paternalOrganismId", "paternalOrganismId", str, False, None, False), + ("paternalOrganismName", "paternalOrganismName", str, False, None, False), + ]) + return js + + +class SubstanceSourceMaterialOrganismOrganismGeneral(backboneelement.BackboneElement): + """ 4.9.13.7.1 Kingdom (Conditional). + """ + + resource_type = "SubstanceSourceMaterialOrganismOrganismGeneral" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.class_fhir = None + """ The class of an organism shall be specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.kingdom = None + """ The kingdom of an organism shall be specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.order = None + """ The order of an organism shall be specified,. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.phylum = None + """ The phylum of an organism shall be specified. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSourceMaterialOrganismOrganismGeneral, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSourceMaterialOrganismOrganismGeneral, self).elementProperties() + js.extend([ + ("class_fhir", "class", codeableconcept.CodeableConcept, False, None, False), + ("kingdom", "kingdom", codeableconcept.CodeableConcept, False, None, False), + ("order", "order", codeableconcept.CodeableConcept, False, None, False), + ("phylum", "phylum", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSourceMaterialPartDescription(backboneelement.BackboneElement): + """ To do. + """ + + resource_type = "SubstanceSourceMaterialPartDescription" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.part = None + """ Entity of anatomical origin of source material within an organism. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.partLocation = None + """ The detailed anatomic location when the part can be extracted from + different anatomical locations of the organism. Multiple + alternative locations may apply. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSourceMaterialPartDescription, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSourceMaterialPartDescription, self).elementProperties() + js.extend([ + ("part", "part", codeableconcept.CodeableConcept, False, None, False), + ("partLocation", "partLocation", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] diff --git a/fhirclient/models/substancespecification.py b/fhirclient/models/substancespecification.py new file mode 100644 index 000000000..aa9a14eae --- /dev/null +++ b/fhirclient/models/substancespecification.py @@ -0,0 +1,746 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SubstanceSpecification) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class SubstanceSpecification(domainresource.DomainResource): + """ The detailed description of a substance, typically at a level beyond what + is used for prescribing. + """ + + resource_type = "SubstanceSpecification" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Codes associated with the substance. + List of `SubstanceSpecificationstr` items (represented as `dict` in JSON). """ + + self.comment = None + """ Textual comment about this record of a substance. + Type `str`. """ + + self.description = None + """ Textual description of the substance. + Type `str`. """ + + self.domain = None + """ If the substance applies to only human or veterinary use. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.identifier = None + """ Identifier by which this substance is known. + Type `Identifier` (represented as `dict` in JSON). """ + + self.moiety = None + """ Moiety, for structural modifications. + List of `SubstanceSpecificationMoiety` items (represented as `dict` in JSON). """ + + self.molecularWeight = None + """ The molecular weight or weight range (for proteins, polymers or + nucleic acids). + List of `SubstanceSpecificationStructureIsotopeMolecularWeight` items (represented as `dict` in JSON). """ + + self.name = None + """ Names applicable to this substance. + List of `SubstanceSpecificationName` items (represented as `dict` in JSON). """ + + self.nucleicAcid = None + """ Data items specific to nucleic acids. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.polymer = None + """ Data items specific to polymers. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.property = None + """ General specifications for this substance, including how it is + related to other substances. + List of `SubstanceSpecificationProperty` items (represented as `dict` in JSON). """ + + self.protein = None + """ Data items specific to proteins. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.referenceInformation = None + """ General information detailing this substance. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.relationship = None + """ A link between this substance and another, with details of the + relationship. + List of `SubstanceSpecificationRelationship` items (represented as `dict` in JSON). """ + + self.source = None + """ Supporting literature. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.sourceMaterial = None + """ Material or taxonomic/anatomical source for the substance. + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.status = None + """ Status of substance within the catalogue e.g. approved. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.structure = None + """ Structural information. + Type `SubstanceSpecificationStructure` (represented as `dict` in JSON). """ + + self.type = None + """ High level categorization, e.g. polymer or nucleic acid. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecification, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecification, self).elementProperties() + js.extend([ + ("code", "code", SubstanceSpecificationstr, True, None, False), + ("comment", "comment", str, False, None, False), + ("description", "description", str, False, None, False), + ("domain", "domain", codeableconcept.CodeableConcept, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("moiety", "moiety", SubstanceSpecificationMoiety, True, None, False), + ("molecularWeight", "molecularWeight", SubstanceSpecificationStructureIsotopeMolecularWeight, True, None, False), + ("name", "name", SubstanceSpecificationName, True, None, False), + ("nucleicAcid", "nucleicAcid", fhirreference.FHIRReference, False, None, False), + ("polymer", "polymer", fhirreference.FHIRReference, False, None, False), + ("property", "property", SubstanceSpecificationProperty, True, None, False), + ("protein", "protein", fhirreference.FHIRReference, False, None, False), + ("referenceInformation", "referenceInformation", fhirreference.FHIRReference, False, None, False), + ("relationship", "relationship", SubstanceSpecificationRelationship, True, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("sourceMaterial", "sourceMaterial", fhirreference.FHIRReference, False, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, False), + ("structure", "structure", SubstanceSpecificationStructure, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +from . import backboneelement + +class SubstanceSpecificationMoiety(backboneelement.BackboneElement): + """ Moiety, for structural modifications. + """ + + resource_type = "SubstanceSpecificationMoiety" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amountQuantity = None + """ Quantitative value for this moiety. + Type `Quantity` (represented as `dict` in JSON). """ + + self.amountString = None + """ Quantitative value for this moiety. + Type `str`. """ + + self.identifier = None + """ Identifier by which this moiety substance is known. + Type `Identifier` (represented as `dict` in JSON). """ + + self.molecularFormula = None + """ Molecular formula. + Type `str`. """ + + self.name = None + """ Textual name for this moiety substance. + Type `str`. """ + + self.opticalActivity = None + """ Optical activity type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.role = None + """ Role that the moiety is playing. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.stereochemistry = None + """ Stereochemistry type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationMoiety, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationMoiety, self).elementProperties() + js.extend([ + ("amountQuantity", "amountQuantity", quantity.Quantity, False, "amount", False), + ("amountString", "amountString", str, False, "amount", False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("molecularFormula", "molecularFormula", str, False, None, False), + ("name", "name", str, False, None, False), + ("opticalActivity", "opticalActivity", codeableconcept.CodeableConcept, False, None, False), + ("role", "role", codeableconcept.CodeableConcept, False, None, False), + ("stereochemistry", "stereochemistry", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSpecificationName(backboneelement.BackboneElement): + """ Names applicable to this substance. + """ + + resource_type = "SubstanceSpecificationName" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.domain = None + """ The use context of this name for example if there is a different + name a drug active ingredient as opposed to a food colour additive. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ The jurisdiction where this name applies. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.language = None + """ Language of the name. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.name = None + """ The actual name. + Type `str`. """ + + self.official = None + """ Details of the official nature of this name. + List of `SubstanceSpecificationNameOfficial` items (represented as `dict` in JSON). """ + + self.preferred = None + """ If this is the preferred name for this substance. + Type `bool`. """ + + self.source = None + """ Supporting literature. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ The status of the name. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.synonym = None + """ A synonym of this name. + List of `SubstanceSpecificationName` items (represented as `dict` in JSON). """ + + self.translation = None + """ A translation for this name. + List of `SubstanceSpecificationName` items (represented as `dict` in JSON). """ + + self.type = None + """ Name type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationName, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationName, self).elementProperties() + js.extend([ + ("domain", "domain", codeableconcept.CodeableConcept, True, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("language", "language", codeableconcept.CodeableConcept, True, None, False), + ("name", "name", str, False, None, True), + ("official", "official", SubstanceSpecificationNameOfficial, True, None, False), + ("preferred", "preferred", bool, False, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, False), + ("synonym", "synonym", SubstanceSpecificationName, True, None, False), + ("translation", "translation", SubstanceSpecificationName, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSpecificationNameOfficial(backboneelement.BackboneElement): + """ Details of the official nature of this name. + """ + + resource_type = "SubstanceSpecificationNameOfficial" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.authority = None + """ Which authority uses this official name. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.date = None + """ Date of official name change. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.status = None + """ The status of the official name. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationNameOfficial, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationNameOfficial, self).elementProperties() + js.extend([ + ("authority", "authority", codeableconcept.CodeableConcept, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSpecificationProperty(backboneelement.BackboneElement): + """ General specifications for this substance, including how it is related to + other substances. + """ + + resource_type = "SubstanceSpecificationProperty" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amountQuantity = None + """ Quantitative value for this property. + Type `Quantity` (represented as `dict` in JSON). """ + + self.amountString = None + """ Quantitative value for this property. + Type `str`. """ + + self.category = None + """ A category for this property, e.g. Physical, Chemical, Enzymatic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.code = None + """ Property type e.g. viscosity, pH, isoelectric point. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.definingSubstanceCodeableConcept = None + """ A substance upon which a defining property depends (e.g. for + solubility: in water, in alcohol). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.definingSubstanceReference = None + """ A substance upon which a defining property depends (e.g. for + solubility: in water, in alcohol). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.parameters = None + """ Parameters that were used in the measurement of a property (e.g. + for viscosity: measured at 20C with a pH of 7.1). + Type `str`. """ + + super(SubstanceSpecificationProperty, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationProperty, self).elementProperties() + js.extend([ + ("amountQuantity", "amountQuantity", quantity.Quantity, False, "amount", False), + ("amountString", "amountString", str, False, "amount", False), + ("category", "category", codeableconcept.CodeableConcept, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("definingSubstanceCodeableConcept", "definingSubstanceCodeableConcept", codeableconcept.CodeableConcept, False, "definingSubstance", False), + ("definingSubstanceReference", "definingSubstanceReference", fhirreference.FHIRReference, False, "definingSubstance", False), + ("parameters", "parameters", str, False, None, False), + ]) + return js + + +class SubstanceSpecificationRelationship(backboneelement.BackboneElement): + """ A link between this substance and another, with details of the relationship. + """ + + resource_type = "SubstanceSpecificationRelationship" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amountQuantity = None + """ A numeric factor for the relationship, for instance to express that + the salt of a substance has some percentage of the active substance + in relation to some other. + Type `Quantity` (represented as `dict` in JSON). """ + + self.amountRange = None + """ A numeric factor for the relationship, for instance to express that + the salt of a substance has some percentage of the active substance + in relation to some other. + Type `Range` (represented as `dict` in JSON). """ + + self.amountRatio = None + """ A numeric factor for the relationship, for instance to express that + the salt of a substance has some percentage of the active substance + in relation to some other. + Type `Ratio` (represented as `dict` in JSON). """ + + self.amountRatioLowLimit = None + """ For use when the numeric. + Type `Ratio` (represented as `dict` in JSON). """ + + self.amountString = None + """ A numeric factor for the relationship, for instance to express that + the salt of a substance has some percentage of the active substance + in relation to some other. + Type `str`. """ + + self.amountType = None + """ An operator for the amount, for example "average", "approximately", + "less than". + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.isDefining = None + """ For example where an enzyme strongly bonds with a particular + substance, this is a defining relationship for that enzyme, out of + several possible substance relationships. + Type `bool`. """ + + self.relationship = None + """ For example "salt to parent", "active moiety", "starting material". + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.source = None + """ Supporting literature. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.substanceCodeableConcept = None + """ A pointer to another substance, as a resource or just a + representational code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.substanceReference = None + """ A pointer to another substance, as a resource or just a + representational code. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationRelationship, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationRelationship, self).elementProperties() + js.extend([ + ("amountQuantity", "amountQuantity", quantity.Quantity, False, "amount", False), + ("amountRange", "amountRange", range.Range, False, "amount", False), + ("amountRatio", "amountRatio", ratio.Ratio, False, "amount", False), + ("amountRatioLowLimit", "amountRatioLowLimit", ratio.Ratio, False, None, False), + ("amountString", "amountString", str, False, "amount", False), + ("amountType", "amountType", codeableconcept.CodeableConcept, False, None, False), + ("isDefining", "isDefining", bool, False, None, False), + ("relationship", "relationship", codeableconcept.CodeableConcept, False, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("substanceCodeableConcept", "substanceCodeableConcept", codeableconcept.CodeableConcept, False, "substance", False), + ("substanceReference", "substanceReference", fhirreference.FHIRReference, False, "substance", False), + ]) + return js + + +class SubstanceSpecificationStructure(backboneelement.BackboneElement): + """ Structural information. + """ + + resource_type = "SubstanceSpecificationStructure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.isotope = None + """ Applicable for single substances that contain a radionuclide or a + non-natural isotopic ratio. + List of `SubstanceSpecificationStructureIsotope` items (represented as `dict` in JSON). """ + + self.molecularFormula = None + """ Molecular formula. + Type `str`. """ + + self.molecularFormulaByMoiety = None + """ Specified per moiety according to the Hill system, i.e. first C, + then H, then alphabetical, each moiety separated by a dot. + Type `str`. """ + + self.molecularWeight = None + """ The molecular weight or weight range (for proteins, polymers or + nucleic acids). + Type `SubstanceSpecificationStructureIsotopeMolecularWeight` (represented as `dict` in JSON). """ + + self.opticalActivity = None + """ Optical activity type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.representation = None + """ Molecular structural representation. + List of `SubstanceSpecificationStructureRepresentation` items (represented as `dict` in JSON). """ + + self.source = None + """ Supporting literature. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.stereochemistry = None + """ Stereochemistry type. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationStructure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationStructure, self).elementProperties() + js.extend([ + ("isotope", "isotope", SubstanceSpecificationStructureIsotope, True, None, False), + ("molecularFormula", "molecularFormula", str, False, None, False), + ("molecularFormulaByMoiety", "molecularFormulaByMoiety", str, False, None, False), + ("molecularWeight", "molecularWeight", SubstanceSpecificationStructureIsotopeMolecularWeight, False, None, False), + ("opticalActivity", "opticalActivity", codeableconcept.CodeableConcept, False, None, False), + ("representation", "representation", SubstanceSpecificationStructureRepresentation, True, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("stereochemistry", "stereochemistry", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSpecificationStructureIsotope(backboneelement.BackboneElement): + """ Applicable for single substances that contain a radionuclide or a non- + natural isotopic ratio. + """ + + resource_type = "SubstanceSpecificationStructureIsotope" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.halfLife = None + """ Half life - for a non-natural nuclide. + Type `Quantity` (represented as `dict` in JSON). """ + + self.identifier = None + """ Substance identifier for each non-natural or radioisotope. + Type `Identifier` (represented as `dict` in JSON). """ + + self.molecularWeight = None + """ The molecular weight or weight range (for proteins, polymers or + nucleic acids). + Type `SubstanceSpecificationStructureIsotopeMolecularWeight` (represented as `dict` in JSON). """ + + self.name = None + """ Substance name for each non-natural or radioisotope. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.substitution = None + """ The type of isotopic substitution present in a single substance. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationStructureIsotope, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationStructureIsotope, self).elementProperties() + js.extend([ + ("halfLife", "halfLife", quantity.Quantity, False, None, False), + ("identifier", "identifier", identifier.Identifier, False, None, False), + ("molecularWeight", "molecularWeight", SubstanceSpecificationStructureIsotopeMolecularWeight, False, None, False), + ("name", "name", codeableconcept.CodeableConcept, False, None, False), + ("substitution", "substitution", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSpecificationStructureIsotopeMolecularWeight(backboneelement.BackboneElement): + """ The molecular weight or weight range (for proteins, polymers or nucleic + acids). + """ + + resource_type = "SubstanceSpecificationStructureIsotopeMolecularWeight" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Used to capture quantitative values for a variety of elements. If + only limits are given, the arithmetic mean would be the average. If + only a single definite value for a given element is given, it would + be captured in this field. + Type `Quantity` (represented as `dict` in JSON). """ + + self.method = None + """ The method by which the molecular weight was determined. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.type = None + """ Type of molecular weight such as exact, average (also known as. + number average), weight average. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationStructureIsotopeMolecularWeight, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationStructureIsotopeMolecularWeight, self).elementProperties() + js.extend([ + ("amount", "amount", quantity.Quantity, False, None, False), + ("method", "method", codeableconcept.CodeableConcept, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSpecificationStructureRepresentation(backboneelement.BackboneElement): + """ Molecular structural representation. + """ + + resource_type = "SubstanceSpecificationStructureRepresentation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.attachment = None + """ An attached file with the structural representation. + Type `Attachment` (represented as `dict` in JSON). """ + + self.representation = None + """ The structural representation as text string in a format e.g. + InChI, SMILES, MOLFILE, CDX. + Type `str`. """ + + self.type = None + """ The type of structure (e.g. Full, Partial, Representative). + Type `CodeableConcept` (represented as `dict` in JSON). """ + + super(SubstanceSpecificationStructureRepresentation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationStructureRepresentation, self).elementProperties() + js.extend([ + ("attachment", "attachment", attachment.Attachment, False, None, False), + ("representation", "representation", str, False, None, False), + ("type", "type", codeableconcept.CodeableConcept, False, None, False), + ]) + return js + + +class SubstanceSpecificationstr(backboneelement.BackboneElement): + """ Codes associated with the substance. + """ + + resource_type = "SubstanceSpecificationstr" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ The specific code. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.comment = None + """ Any comment can be provided in this field, if necessary. + Type `str`. """ + + self.source = None + """ Supporting literature. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.status = None + """ Status of the code assignment. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.statusDate = None + """ The date at which the code status is changed as part of the + terminology maintenance. + Type `FHIRDate` (represented as `str` in JSON). """ + + super(SubstanceSpecificationstr, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(SubstanceSpecificationstr, self).elementProperties() + js.extend([ + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("comment", "comment", str, False, None, False), + ("source", "source", fhirreference.FHIRReference, True, None, False), + ("status", "status", codeableconcept.CodeableConcept, False, None, False), + ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), + ]) + return js + + +import sys +try: + from . import attachment +except ImportError: + attachment = sys.modules[__package__ + '.attachment'] +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import identifier +except ImportError: + identifier = sys.modules[__package__ + '.identifier'] +try: + from . import quantity +except ImportError: + quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] +try: + from . import ratio +except ImportError: + ratio = sys.modules[__package__ + '.ratio'] diff --git a/fhirclient/models/substancespecification_tests.py b/fhirclient/models/substancespecification_tests.py new file mode 100644 index 000000000..64454c84e --- /dev/null +++ b/fhirclient/models/substancespecification_tests.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import substancespecification +from .fhirdate import FHIRDate + + +class SubstanceSpecificationTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("SubstanceSpecification", js["resourceType"]) + return substancespecification.SubstanceSpecification(js) + + def testSubstanceSpecification1(self): + inst = self.instantiate_from("substancesourcematerial-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SubstanceSpecification instance") + self.implSubstanceSpecification1(inst) + + js = inst.as_json() + self.assertEqual("SubstanceSpecification", js["resourceType"]) + inst2 = substancespecification.SubstanceSpecification(js) + self.implSubstanceSpecification1(inst2) + + def implSubstanceSpecification1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

") + self.assertEqual(inst.text.status, "generated") + + def testSubstanceSpecification2(self): + inst = self.instantiate_from("substanceprotein-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SubstanceSpecification instance") + self.implSubstanceSpecification2(inst) + + js = inst.as_json() + self.assertEqual("SubstanceSpecification", js["resourceType"]) + inst2 = substancespecification.SubstanceSpecification(js) + self.implSubstanceSpecification2(inst2) + + def implSubstanceSpecification2(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

") + self.assertEqual(inst.text.status, "generated") + + def testSubstanceSpecification3(self): + inst = self.instantiate_from("substancepolymer-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SubstanceSpecification instance") + self.implSubstanceSpecification3(inst) + + js = inst.as_json() + self.assertEqual("SubstanceSpecification", js["resourceType"]) + inst2 = substancespecification.SubstanceSpecification(js) + self.implSubstanceSpecification3(inst2) + + def implSubstanceSpecification3(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

") + self.assertEqual(inst.text.status, "generated") + + def testSubstanceSpecification4(self): + inst = self.instantiate_from("substancespecification-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SubstanceSpecification instance") + self.implSubstanceSpecification4(inst) + + js = inst.as_json() + self.assertEqual("SubstanceSpecification", js["resourceType"]) + inst2 = substancespecification.SubstanceSpecification(js) + self.implSubstanceSpecification4(inst2) + + def implSubstanceSpecification4(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

") + self.assertEqual(inst.text.status, "generated") + + def testSubstanceSpecification5(self): + inst = self.instantiate_from("substancereferenceinformation-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SubstanceSpecification instance") + self.implSubstanceSpecification5(inst) + + js = inst.as_json() + self.assertEqual("SubstanceSpecification", js["resourceType"]) + inst2 = substancespecification.SubstanceSpecification(js) + self.implSubstanceSpecification5(inst2) + + def implSubstanceSpecification5(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

") + self.assertEqual(inst.text.status, "generated") + + def testSubstanceSpecification6(self): + inst = self.instantiate_from("substancenucleicacid-example.json") + self.assertIsNotNone(inst, "Must have instantiated a SubstanceSpecification instance") + self.implSubstanceSpecification6(inst) + + js = inst.as_json() + self.assertEqual("SubstanceSpecification", js["resourceType"]) + inst2 = substancespecification.SubstanceSpecification(js) + self.implSubstanceSpecification6(inst2) + + def implSubstanceSpecification6(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/supplydelivery.py b/fhirclient/models/supplydelivery.py index 16ffc274e..1d9ef8407 100644 --- a/fhirclient/models/supplydelivery.py +++ b/fhirclient/models/supplydelivery.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -25,15 +25,15 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Fulfills plan, proposal or order. - List of `FHIRReference` items referencing `SupplyRequest` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.destination = None """ Where the Supply was sent. - Type `FHIRReference` referencing `Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None """ External identifier. - Type `Identifier` (represented as `dict` in JSON). """ + List of `Identifier` items (represented as `dict` in JSON). """ self.occurrenceDateTime = None """ When event occurred. @@ -49,15 +49,15 @@ def __init__(self, jsondict=None, strict=True): self.partOf = None """ Part of referenced event. - List of `FHIRReference` items referencing `SupplyDelivery, Contract` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.patient = None """ Patient for whom the item is supplied. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.receiver = None """ Who collected the Supply. - List of `FHIRReference` items referencing `Practitioner` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.status = None """ in-progress | completed | abandoned | entered-in-error. @@ -69,7 +69,7 @@ def __init__(self, jsondict=None, strict=True): self.supplier = None """ Dispenser. - Type `FHIRReference` referencing `Practitioner, Organization` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.type = None """ Category of dispense event. @@ -82,7 +82,7 @@ def elementProperties(self): js.extend([ ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("destination", "destination", fhirreference.FHIRReference, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), @@ -121,7 +121,7 @@ def __init__(self, jsondict=None, strict=True): self.itemReference = None """ Medication, Substance, or Device supplied. - Type `FHIRReference` referencing `Medication, Substance, Device` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.quantity = None """ Amount dispensed. diff --git a/fhirclient/models/supplydelivery_tests.py b/fhirclient/models/supplydelivery_tests.py index b67391fd6..85fb29c16 100644 --- a/fhirclient/models/supplydelivery_tests.py +++ b/fhirclient/models/supplydelivery_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return supplydelivery.SupplyDelivery(js) def testSupplyDelivery1(self): - inst = self.instantiate_from("supplydelivery-example-pumpdelivery.json") + inst = self.instantiate_from("supplydelivery-example.json") self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") self.implSupplyDelivery1(inst) @@ -32,14 +32,24 @@ def testSupplyDelivery1(self): self.implSupplyDelivery1(inst2) def implSupplyDelivery1(self, inst): - self.assertEqual(inst.id, "pumpdelivery") - self.assertEqual(inst.identifier.value, "98398459409") - self.assertEqual(inst.status, "in-progress") - self.assertEqual(inst.text.div, "
[Put rendering here]
") + self.assertEqual(inst.id, "simpledelivery") + self.assertEqual(inst.identifier[0].value, "Order10284") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2016-12-31").date) + self.assertEqual(inst.occurrenceDateTime.as_json(), "2016-12-31") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.suppliedItem.itemCodeableConcept.coding[0].code, "BlueTubes") + self.assertEqual(inst.suppliedItem.itemCodeableConcept.coding[0].display, "Blood collect tubes blue cap") + self.assertEqual(inst.suppliedItem.quantity.value, 10) self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.type.coding[0].code, "device") + self.assertEqual(inst.type.coding[0].system, "http://terminology.hl7.org/CodeSystem/supply-item-type") + self.assertEqual(inst.type.text, "Blood collect tubes blue cap") def testSupplyDelivery2(self): - inst = self.instantiate_from("supplydelivery-example.json") + inst = self.instantiate_from("supplydelivery-example-pumpdelivery.json") self.assertIsNotNone(inst, "Must have instantiated a SupplyDelivery instance") self.implSupplyDelivery2(inst) @@ -49,16 +59,12 @@ def testSupplyDelivery2(self): self.implSupplyDelivery2(inst2) def implSupplyDelivery2(self, inst): - self.assertEqual(inst.id, "simpledelivery") - self.assertEqual(inst.identifier.value, "Order10284") - self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2016-12-31").date) - self.assertEqual(inst.occurrenceDateTime.as_json(), "2016-12-31") - self.assertEqual(inst.status, "completed") - self.assertEqual(inst.suppliedItem.itemCodeableConcept.coding[0].code, "BlueTubes") - self.assertEqual(inst.suppliedItem.itemCodeableConcept.coding[0].display, "Blood collect tubes blue cap") - self.assertEqual(inst.suppliedItem.quantity.value, 10) + self.assertEqual(inst.id, "pumpdelivery") + self.assertEqual(inst.identifier[0].value, "98398459409") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "in-progress") + self.assertEqual(inst.text.div, "
[Put rendering here]
") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.type.coding[0].code, "device") - self.assertEqual(inst.type.coding[0].system, "http://hl7.org/fhir/supply-item-type") - self.assertEqual(inst.type.text, "Blood collect tubes blue cap") diff --git a/fhirclient/models/supplyrequest.py b/fhirclient/models/supplyrequest.py index a604908f4..35983ab2e 100644 --- a/fhirclient/models/supplyrequest.py +++ b/fhirclient/models/supplyrequest.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -34,15 +34,23 @@ def __init__(self, jsondict=None, strict=True): self.deliverFrom = None """ The origin of the supply. - Type `FHIRReference` referencing `Organization, Location` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.deliverTo = None """ The destination of the supply. - Type `FHIRReference` referencing `Organization, Location, Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None - """ Unique identifier. - Type `Identifier` (represented as `dict` in JSON). """ + """ Business Identifier for SupplyRequest. + List of `Identifier` items (represented as `dict` in JSON). """ + + self.itemCodeableConcept = None + """ Medication, Substance, or Device requested to be supplied. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.itemReference = None + """ Medication, Substance, or Device requested to be supplied. + Type `FHIRReference` (represented as `dict` in JSON). """ self.occurrenceDateTime = None """ When the request should be fulfilled. @@ -56,25 +64,29 @@ def __init__(self, jsondict=None, strict=True): """ When the request should be fulfilled. Type `Timing` (represented as `dict` in JSON). """ - self.orderedItem = None - """ The item being requested. - Type `SupplyRequestOrderedItem` (represented as `dict` in JSON). """ + self.parameter = None + """ Ordered item details. + List of `SupplyRequestParameter` items (represented as `dict` in JSON). """ self.priority = None """ routine | urgent | asap | stat. Type `str`. """ - self.reasonCodeableConcept = None - """ Why the supply item was requested. - Type `CodeableConcept` (represented as `dict` in JSON). """ + self.quantity = None + """ The requested amount of the item indicated. + Type `Quantity` (represented as `dict` in JSON). """ + + self.reasonCode = None + """ The reason why the supply item was requested. + List of `CodeableConcept` items (represented as `dict` in JSON). """ self.reasonReference = None - """ Why the supply item was requested. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + """ The reason why the supply item was requested. + List of `FHIRReference` items (represented as `dict` in JSON). """ self.requester = None - """ Who/what is requesting service. - Type `SupplyRequestRequester` (represented as `dict` in JSON). """ + """ Individual making the request. + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ draft | active | suspended +. @@ -82,7 +94,7 @@ def __init__(self, jsondict=None, strict=True): self.supplier = None """ Who is intended to fulfill the request. - List of `FHIRReference` items referencing `Organization` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ super(SupplyRequest, self).__init__(jsondict=jsondict, strict=strict) @@ -93,15 +105,18 @@ def elementProperties(self): ("category", "category", codeableconcept.CodeableConcept, False, None, False), ("deliverFrom", "deliverFrom", fhirreference.FHIRReference, False, None, False), ("deliverTo", "deliverTo", fhirreference.FHIRReference, False, None, False), - ("identifier", "identifier", identifier.Identifier, False, None, False), + ("identifier", "identifier", identifier.Identifier, True, None, False), + ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", True), + ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", True), ("occurrenceDateTime", "occurrenceDateTime", fhirdate.FHIRDate, False, "occurrence", False), ("occurrencePeriod", "occurrencePeriod", period.Period, False, "occurrence", False), ("occurrenceTiming", "occurrenceTiming", timing.Timing, False, "occurrence", False), - ("orderedItem", "orderedItem", SupplyRequestOrderedItem, False, None, False), + ("parameter", "parameter", SupplyRequestParameter, True, None, False), ("priority", "priority", str, False, None, False), - ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), - ("requester", "requester", SupplyRequestRequester, False, None, False), + ("quantity", "quantity", quantity.Quantity, False, None, True), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, True, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, True, None, False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), ("status", "status", str, False, None, False), ("supplier", "supplier", fhirreference.FHIRReference, True, None, False), ]) @@ -110,11 +125,14 @@ def elementProperties(self): from . import backboneelement -class SupplyRequestOrderedItem(backboneelement.BackboneElement): - """ The item being requested. +class SupplyRequestParameter(backboneelement.BackboneElement): + """ Ordered item details. + + Specific parameters for the ordered item. For example, the size of the + indicated item. """ - resource_type = "SupplyRequestOrderedItem" + resource_type = "SupplyRequestParameter" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -124,62 +142,36 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.itemCodeableConcept = None - """ Medication, Substance, or Device requested to be supplied. + self.code = None + """ Item detail. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.itemReference = None - """ Medication, Substance, or Device requested to be supplied. - Type `FHIRReference` referencing `Medication, Substance, Device` (represented as `dict` in JSON). """ - - self.quantity = None - """ The requested amount of the item indicated. - Type `Quantity` (represented as `dict` in JSON). """ + self.valueBoolean = None + """ Value of detail. + Type `bool`. """ - super(SupplyRequestOrderedItem, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(SupplyRequestOrderedItem, self).elementProperties() - js.extend([ - ("itemCodeableConcept", "itemCodeableConcept", codeableconcept.CodeableConcept, False, "item", False), - ("itemReference", "itemReference", fhirreference.FHIRReference, False, "item", False), - ("quantity", "quantity", quantity.Quantity, False, None, True), - ]) - return js - - -class SupplyRequestRequester(backboneelement.BackboneElement): - """ Who/what is requesting service. - - The individual who initiated the request and has responsibility for its - activation. - """ - - resource_type = "SupplyRequestRequester" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ + self.valueCodeableConcept = None + """ Value of detail. + Type `CodeableConcept` (represented as `dict` in JSON). """ - self.agent = None - """ Individual making the request. - Type `FHIRReference` referencing `Practitioner, Organization, Patient, RelatedPerson, Device` (represented as `dict` in JSON). """ + self.valueQuantity = None + """ Value of detail. + Type `Quantity` (represented as `dict` in JSON). """ - self.onBehalfOf = None - """ Organization agent is acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ + self.valueRange = None + """ Value of detail. + Type `Range` (represented as `dict` in JSON). """ - super(SupplyRequestRequester, self).__init__(jsondict=jsondict, strict=strict) + super(SupplyRequestParameter, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(SupplyRequestRequester, self).elementProperties() + js = super(SupplyRequestParameter, self).elementProperties() js.extend([ - ("agent", "agent", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("code", "code", codeableconcept.CodeableConcept, False, None, False), + ("valueBoolean", "valueBoolean", bool, False, "value", False), + ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", False), + ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", False), + ("valueRange", "valueRange", range.Range, False, "value", False), ]) return js @@ -209,6 +201,10 @@ def elementProperties(self): from . import quantity except ImportError: quantity = sys.modules[__package__ + '.quantity'] +try: + from . import range +except ImportError: + range = sys.modules[__package__ + '.range'] try: from . import timing except ImportError: diff --git a/fhirclient/models/supplyrequest_tests.py b/fhirclient/models/supplyrequest_tests.py index c53fd7146..f9203489d 100644 --- a/fhirclient/models/supplyrequest_tests.py +++ b/fhirclient/models/supplyrequest_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,15 +37,18 @@ def implSupplyRequest1(self, inst): self.assertEqual(inst.category.coding[0].code, "central") self.assertEqual(inst.category.coding[0].display, "Central Stock Resupply") self.assertEqual(inst.id, "simpleorder") - self.assertEqual(inst.identifier.value, "Order10284") + self.assertEqual(inst.identifier[0].value, "Order10284") + self.assertEqual(inst.itemCodeableConcept.coding[0].code, "BlueTubes") + self.assertEqual(inst.itemCodeableConcept.coding[0].display, "Blood collect tubes blue cap") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.occurrenceDateTime.date, FHIRDate("2016-12-31").date) self.assertEqual(inst.occurrenceDateTime.as_json(), "2016-12-31") - self.assertEqual(inst.orderedItem.itemCodeableConcept.coding[0].code, "BlueTubes") - self.assertEqual(inst.orderedItem.itemCodeableConcept.coding[0].display, "Blood collect tubes blue cap") - self.assertEqual(inst.orderedItem.quantity.value, 10) self.assertEqual(inst.priority, "asap") - self.assertEqual(inst.reasonCodeableConcept.coding[0].code, "stock_low") - self.assertEqual(inst.reasonCodeableConcept.coding[0].display, "Refill due to low stock") + self.assertEqual(inst.quantity.value, 10) + self.assertEqual(inst.reasonCode[0].coding[0].code, "stock_low") + self.assertEqual(inst.reasonCode[0].coding[0].display, "Refill due to low stock") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/task.py b/fhirclient/models/task.py index 8197963f0..c3bc04454 100644 --- a/fhirclient/models/task.py +++ b/fhirclient/models/task.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Task) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Task) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -27,7 +27,7 @@ def __init__(self, jsondict=None, strict=True): self.basedOn = None """ Request fulfilled by this task. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.businessStatus = None """ E.g. "Specimen collected", "IV prepped". @@ -37,33 +37,25 @@ def __init__(self, jsondict=None, strict=True): """ Task Type. Type `CodeableConcept` (represented as `dict` in JSON). """ - self.context = None - """ Healthcare event during which this task originated. - Type `FHIRReference` referencing `Encounter, EpisodeOfCare` (represented as `dict` in JSON). """ - - self.definitionReference = None - """ Formal definition of task. - Type `FHIRReference` referencing `ActivityDefinition` (represented as `dict` in JSON). """ - - self.definitionUri = None - """ Formal definition of task. - Type `str`. """ - self.description = None """ Human-readable explanation of task. Type `str`. """ + self.encounter = None + """ Healthcare event during which this task originated. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.executionPeriod = None """ Start and end time of execution. Type `Period` (represented as `dict` in JSON). """ self.focus = None """ What task is acting on. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.for_fhir = None """ Beneficiary of the Task. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.groupIdentifier = None """ Requisition or grouper id. @@ -77,14 +69,31 @@ def __init__(self, jsondict=None, strict=True): """ Information used to perform task. List of `TaskInput` items (represented as `dict` in JSON). """ + self.instantiatesCanonical = None + """ Formal definition of task. + Type `str`. """ + + self.instantiatesUri = None + """ Formal definition of task. + Type `str`. """ + + self.insurance = None + """ Associated insurance coverage. + List of `FHIRReference` items (represented as `dict` in JSON). """ + self.intent = None - """ proposal | plan | order +. + """ unknown | proposal | plan | order | original-order | reflex-order | + filler-order | instance-order | option. Type `str`. """ self.lastModified = None """ Task Last Modified Date. Type `FHIRDate` (represented as `str` in JSON). """ + self.location = None + """ Where task occurs. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.note = None """ Comments made about the task. List of `Annotation` items (represented as `dict` in JSON). """ @@ -95,32 +104,35 @@ def __init__(self, jsondict=None, strict=True): self.owner = None """ Responsible individual. - Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.partOf = None """ Composite task. - List of `FHIRReference` items referencing `Task` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.performerType = None - """ requester | dispatcher | scheduler | performer | monitor | manager - | acquirer | reviewer. + """ Requested performer. List of `CodeableConcept` items (represented as `dict` in JSON). """ self.priority = None - """ normal | urgent | asap | stat. + """ routine | urgent | asap | stat. Type `str`. """ - self.reason = None + self.reasonCode = None """ Why task is needed. Type `CodeableConcept` (represented as `dict` in JSON). """ + self.reasonReference = None + """ Why task is needed. + Type `FHIRReference` (represented as `dict` in JSON). """ + self.relevantHistory = None """ Key events in history of the Task. - List of `FHIRReference` items referencing `Provenance` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.requester = None """ Who is asking for task to be done. - Type `TaskRequester` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.restriction = None """ Constraints on fulfillment tasks. @@ -143,27 +155,30 @@ def elementProperties(self): ("basedOn", "basedOn", fhirreference.FHIRReference, True, None, False), ("businessStatus", "businessStatus", codeableconcept.CodeableConcept, False, None, False), ("code", "code", codeableconcept.CodeableConcept, False, None, False), - ("context", "context", fhirreference.FHIRReference, False, None, False), - ("definitionReference", "definitionReference", fhirreference.FHIRReference, False, "definition", False), - ("definitionUri", "definitionUri", str, False, "definition", False), ("description", "description", str, False, None, False), + ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("executionPeriod", "executionPeriod", period.Period, False, None, False), ("focus", "focus", fhirreference.FHIRReference, False, None, False), ("for_fhir", "for", fhirreference.FHIRReference, False, None, False), ("groupIdentifier", "groupIdentifier", identifier.Identifier, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("input", "input", TaskInput, True, None, False), + ("instantiatesCanonical", "instantiatesCanonical", str, False, None, False), + ("instantiatesUri", "instantiatesUri", str, False, None, False), + ("insurance", "insurance", fhirreference.FHIRReference, True, None, False), ("intent", "intent", str, False, None, True), ("lastModified", "lastModified", fhirdate.FHIRDate, False, None, False), + ("location", "location", fhirreference.FHIRReference, False, None, False), ("note", "note", annotation.Annotation, True, None, False), ("output", "output", TaskOutput, True, None, False), ("owner", "owner", fhirreference.FHIRReference, False, None, False), ("partOf", "partOf", fhirreference.FHIRReference, True, None, False), ("performerType", "performerType", codeableconcept.CodeableConcept, True, None, False), ("priority", "priority", str, False, None, False), - ("reason", "reason", codeableconcept.CodeableConcept, False, None, False), + ("reasonCode", "reasonCode", codeableconcept.CodeableConcept, False, None, False), + ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, None, False), ("relevantHistory", "relevantHistory", fhirreference.FHIRReference, True, None, False), - ("requester", "requester", TaskRequester, False, None, False), + ("requester", "requester", fhirreference.FHIRReference, False, None, False), ("restriction", "restriction", TaskRestriction, False, None, False), ("status", "status", str, False, None, True), ("statusReason", "statusReason", codeableconcept.CodeableConcept, False, None, False), @@ -217,6 +232,10 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `bool`. """ + self.valueCanonical = None + """ Content to use in performing the task. + Type `str`. """ + self.valueCode = None """ Content to use in performing the task. Type `str`. """ @@ -229,14 +248,26 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `Coding` (represented as `dict` in JSON). """ + self.valueContactDetail = None + """ Content to use in performing the task. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.valueContactPoint = None """ Content to use in performing the task. Type `ContactPoint` (represented as `dict` in JSON). """ + self.valueContributor = None + """ Content to use in performing the task. + Type `Contributor` (represented as `dict` in JSON). """ + self.valueCount = None """ Content to use in performing the task. Type `Count` (represented as `dict` in JSON). """ + self.valueDataRequirement = None + """ Content to use in performing the task. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.valueDate = None """ Content to use in performing the task. Type `FHIRDate` (represented as `str` in JSON). """ @@ -253,10 +284,18 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `Distance` (represented as `dict` in JSON). """ + self.valueDosage = None + """ Content to use in performing the task. + Type `Dosage` (represented as `dict` in JSON). """ + self.valueDuration = None """ Content to use in performing the task. Type `Duration` (represented as `dict` in JSON). """ + self.valueExpression = None + """ Content to use in performing the task. + Type `Expression` (represented as `dict` in JSON). """ + self.valueHumanName = None """ Content to use in performing the task. Type `HumanName` (represented as `dict` in JSON). """ @@ -281,10 +320,6 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `str`. """ - self.valueMeta = None - """ Content to use in performing the task. - Type `Meta` (represented as `dict` in JSON). """ - self.valueMoney = None """ Content to use in performing the task. Type `Money` (represented as `dict` in JSON). """ @@ -293,6 +328,10 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `str`. """ + self.valueParameterDefinition = None + """ Content to use in performing the task. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.valuePeriod = None """ Content to use in performing the task. Type `Period` (represented as `dict` in JSON). """ @@ -317,6 +356,10 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `FHIRReference` (represented as `dict` in JSON). """ + self.valueRelatedArtifact = None + """ Content to use in performing the task. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.valueSampledData = None """ Content to use in performing the task. Type `SampledData` (represented as `dict` in JSON). """ @@ -337,6 +380,10 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `Timing` (represented as `dict` in JSON). """ + self.valueTriggerDefinition = None + """ Content to use in performing the task. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.valueUnsignedInt = None """ Content to use in performing the task. Type `int`. """ @@ -345,6 +392,18 @@ def __init__(self, jsondict=None, strict=True): """ Content to use in performing the task. Type `str`. """ + self.valueUrl = None + """ Content to use in performing the task. + Type `str`. """ + + self.valueUsageContext = None + """ Content to use in performing the task. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.valueUuid = None + """ Content to use in performing the task. + Type `str`. """ + super(TaskInput, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -357,38 +416,49 @@ def elementProperties(self): ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCanonical", "valueCanonical", str, False, "value", True), ("valueCode", "valueCode", str, False, "value", True), ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueContactDetail", "valueContactDetail", contactdetail.ContactDetail, False, "value", True), ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", True), + ("valueContributor", "valueContributor", contributor.Contributor, False, "value", True), ("valueCount", "valueCount", count.Count, False, "value", True), + ("valueDataRequirement", "valueDataRequirement", datarequirement.DataRequirement, False, "value", True), ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", True), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", True), ("valueDecimal", "valueDecimal", float, False, "value", True), ("valueDistance", "valueDistance", distance.Distance, False, "value", True), + ("valueDosage", "valueDosage", dosage.Dosage, False, "value", True), ("valueDuration", "valueDuration", duration.Duration, False, "value", True), + ("valueExpression", "valueExpression", expression.Expression, False, "value", True), ("valueHumanName", "valueHumanName", humanname.HumanName, False, "value", True), ("valueId", "valueId", str, False, "value", True), ("valueIdentifier", "valueIdentifier", identifier.Identifier, False, "value", True), ("valueInstant", "valueInstant", fhirdate.FHIRDate, False, "value", True), ("valueInteger", "valueInteger", int, False, "value", True), ("valueMarkdown", "valueMarkdown", str, False, "value", True), - ("valueMeta", "valueMeta", meta.Meta, False, "value", True), ("valueMoney", "valueMoney", money.Money, False, "value", True), ("valueOid", "valueOid", str, False, "value", True), + ("valueParameterDefinition", "valueParameterDefinition", parameterdefinition.ParameterDefinition, False, "value", True), ("valuePeriod", "valuePeriod", period.Period, False, "value", True), ("valuePositiveInt", "valuePositiveInt", int, False, "value", True), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), ("valueRange", "valueRange", range.Range, False, "value", True), ("valueRatio", "valueRatio", ratio.Ratio, False, "value", True), ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), + ("valueRelatedArtifact", "valueRelatedArtifact", relatedartifact.RelatedArtifact, False, "value", True), ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", True), ("valueSignature", "valueSignature", signature.Signature, False, "value", True), ("valueString", "valueString", str, False, "value", True), ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", True), ("valueTiming", "valueTiming", timing.Timing, False, "value", True), + ("valueTriggerDefinition", "valueTriggerDefinition", triggerdefinition.TriggerDefinition, False, "value", True), ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", True), ("valueUri", "valueUri", str, False, "value", True), + ("valueUrl", "valueUrl", str, False, "value", True), + ("valueUsageContext", "valueUsageContext", usagecontext.UsageContext, False, "value", True), + ("valueUuid", "valueUuid", str, False, "value", True), ]) return js @@ -437,6 +507,10 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `bool`. """ + self.valueCanonical = None + """ Result of output. + Type `str`. """ + self.valueCode = None """ Result of output. Type `str`. """ @@ -449,14 +523,26 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `Coding` (represented as `dict` in JSON). """ + self.valueContactDetail = None + """ Result of output. + Type `ContactDetail` (represented as `dict` in JSON). """ + self.valueContactPoint = None """ Result of output. Type `ContactPoint` (represented as `dict` in JSON). """ + self.valueContributor = None + """ Result of output. + Type `Contributor` (represented as `dict` in JSON). """ + self.valueCount = None """ Result of output. Type `Count` (represented as `dict` in JSON). """ + self.valueDataRequirement = None + """ Result of output. + Type `DataRequirement` (represented as `dict` in JSON). """ + self.valueDate = None """ Result of output. Type `FHIRDate` (represented as `str` in JSON). """ @@ -473,10 +559,18 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `Distance` (represented as `dict` in JSON). """ + self.valueDosage = None + """ Result of output. + Type `Dosage` (represented as `dict` in JSON). """ + self.valueDuration = None """ Result of output. Type `Duration` (represented as `dict` in JSON). """ + self.valueExpression = None + """ Result of output. + Type `Expression` (represented as `dict` in JSON). """ + self.valueHumanName = None """ Result of output. Type `HumanName` (represented as `dict` in JSON). """ @@ -501,10 +595,6 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `str`. """ - self.valueMeta = None - """ Result of output. - Type `Meta` (represented as `dict` in JSON). """ - self.valueMoney = None """ Result of output. Type `Money` (represented as `dict` in JSON). """ @@ -513,6 +603,10 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `str`. """ + self.valueParameterDefinition = None + """ Result of output. + Type `ParameterDefinition` (represented as `dict` in JSON). """ + self.valuePeriod = None """ Result of output. Type `Period` (represented as `dict` in JSON). """ @@ -537,6 +631,10 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `FHIRReference` (represented as `dict` in JSON). """ + self.valueRelatedArtifact = None + """ Result of output. + Type `RelatedArtifact` (represented as `dict` in JSON). """ + self.valueSampledData = None """ Result of output. Type `SampledData` (represented as `dict` in JSON). """ @@ -557,6 +655,10 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `Timing` (represented as `dict` in JSON). """ + self.valueTriggerDefinition = None + """ Result of output. + Type `TriggerDefinition` (represented as `dict` in JSON). """ + self.valueUnsignedInt = None """ Result of output. Type `int`. """ @@ -565,6 +667,18 @@ def __init__(self, jsondict=None, strict=True): """ Result of output. Type `str`. """ + self.valueUrl = None + """ Result of output. + Type `str`. """ + + self.valueUsageContext = None + """ Result of output. + Type `UsageContext` (represented as `dict` in JSON). """ + + self.valueUuid = None + """ Result of output. + Type `str`. """ + super(TaskOutput, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -577,73 +691,49 @@ def elementProperties(self): ("valueAttachment", "valueAttachment", attachment.Attachment, False, "value", True), ("valueBase64Binary", "valueBase64Binary", str, False, "value", True), ("valueBoolean", "valueBoolean", bool, False, "value", True), + ("valueCanonical", "valueCanonical", str, False, "value", True), ("valueCode", "valueCode", str, False, "value", True), ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), ("valueCoding", "valueCoding", coding.Coding, False, "value", True), + ("valueContactDetail", "valueContactDetail", contactdetail.ContactDetail, False, "value", True), ("valueContactPoint", "valueContactPoint", contactpoint.ContactPoint, False, "value", True), + ("valueContributor", "valueContributor", contributor.Contributor, False, "value", True), ("valueCount", "valueCount", count.Count, False, "value", True), + ("valueDataRequirement", "valueDataRequirement", datarequirement.DataRequirement, False, "value", True), ("valueDate", "valueDate", fhirdate.FHIRDate, False, "value", True), ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", True), ("valueDecimal", "valueDecimal", float, False, "value", True), ("valueDistance", "valueDistance", distance.Distance, False, "value", True), + ("valueDosage", "valueDosage", dosage.Dosage, False, "value", True), ("valueDuration", "valueDuration", duration.Duration, False, "value", True), + ("valueExpression", "valueExpression", expression.Expression, False, "value", True), ("valueHumanName", "valueHumanName", humanname.HumanName, False, "value", True), ("valueId", "valueId", str, False, "value", True), ("valueIdentifier", "valueIdentifier", identifier.Identifier, False, "value", True), ("valueInstant", "valueInstant", fhirdate.FHIRDate, False, "value", True), ("valueInteger", "valueInteger", int, False, "value", True), ("valueMarkdown", "valueMarkdown", str, False, "value", True), - ("valueMeta", "valueMeta", meta.Meta, False, "value", True), ("valueMoney", "valueMoney", money.Money, False, "value", True), ("valueOid", "valueOid", str, False, "value", True), + ("valueParameterDefinition", "valueParameterDefinition", parameterdefinition.ParameterDefinition, False, "value", True), ("valuePeriod", "valuePeriod", period.Period, False, "value", True), ("valuePositiveInt", "valuePositiveInt", int, False, "value", True), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), ("valueRange", "valueRange", range.Range, False, "value", True), ("valueRatio", "valueRatio", ratio.Ratio, False, "value", True), ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), + ("valueRelatedArtifact", "valueRelatedArtifact", relatedartifact.RelatedArtifact, False, "value", True), ("valueSampledData", "valueSampledData", sampleddata.SampledData, False, "value", True), ("valueSignature", "valueSignature", signature.Signature, False, "value", True), ("valueString", "valueString", str, False, "value", True), ("valueTime", "valueTime", fhirdate.FHIRDate, False, "value", True), ("valueTiming", "valueTiming", timing.Timing, False, "value", True), + ("valueTriggerDefinition", "valueTriggerDefinition", triggerdefinition.TriggerDefinition, False, "value", True), ("valueUnsignedInt", "valueUnsignedInt", int, False, "value", True), ("valueUri", "valueUri", str, False, "value", True), - ]) - return js - - -class TaskRequester(backboneelement.BackboneElement): - """ Who is asking for task to be done. - - The creator of the task. - """ - - resource_type = "TaskRequester" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.agent = None - """ Individual asking for task. - Type `FHIRReference` referencing `Device, Organization, Patient, Practitioner, RelatedPerson` (represented as `dict` in JSON). """ - - self.onBehalfOf = None - """ Organization individual is acting for. - Type `FHIRReference` referencing `Organization` (represented as `dict` in JSON). """ - - super(TaskRequester, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TaskRequester, self).elementProperties() - js.extend([ - ("agent", "agent", fhirreference.FHIRReference, False, None, True), - ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("valueUrl", "valueUrl", str, False, "value", True), + ("valueUsageContext", "valueUsageContext", usagecontext.UsageContext, False, "value", True), + ("valueUuid", "valueUuid", str, False, "value", True), ]) return js @@ -652,8 +742,8 @@ class TaskRestriction(backboneelement.BackboneElement): """ Constraints on fulfillment tasks. If the Task.focus is a request resource and the task is seeking fulfillment - (i.e is asking for the request to be actioned), this element identifies any - limitations on what parts of the referenced request should be actioned. + (i.e. is asking for the request to be actioned), this element identifies + any limitations on what parts of the referenced request should be actioned. """ resource_type = "TaskRestriction" @@ -672,7 +762,7 @@ def __init__(self, jsondict=None, strict=True): self.recipient = None """ For whom is fulfillment sought?. - List of `FHIRReference` items referencing `Patient, Practitioner, RelatedPerson, Group, Organization` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.repetitions = None """ How many times to repeat. @@ -715,22 +805,42 @@ def elementProperties(self): from . import coding except ImportError: coding = sys.modules[__package__ + '.coding'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] try: from . import contactpoint except ImportError: contactpoint = sys.modules[__package__ + '.contactpoint'] +try: + from . import contributor +except ImportError: + contributor = sys.modules[__package__ + '.contributor'] try: from . import count except ImportError: count = sys.modules[__package__ + '.count'] +try: + from . import datarequirement +except ImportError: + datarequirement = sys.modules[__package__ + '.datarequirement'] try: from . import distance except ImportError: distance = sys.modules[__package__ + '.distance'] +try: + from . import dosage +except ImportError: + dosage = sys.modules[__package__ + '.dosage'] try: from . import duration except ImportError: duration = sys.modules[__package__ + '.duration'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: @@ -747,14 +857,14 @@ def elementProperties(self): from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] -try: - from . import meta -except ImportError: - meta = sys.modules[__package__ + '.meta'] try: from . import money except ImportError: money = sys.modules[__package__ + '.money'] +try: + from . import parameterdefinition +except ImportError: + parameterdefinition = sys.modules[__package__ + '.parameterdefinition'] try: from . import period except ImportError: @@ -771,6 +881,10 @@ def elementProperties(self): from . import ratio except ImportError: ratio = sys.modules[__package__ + '.ratio'] +try: + from . import relatedartifact +except ImportError: + relatedartifact = sys.modules[__package__ + '.relatedartifact'] try: from . import sampleddata except ImportError: @@ -783,3 +897,11 @@ def elementProperties(self): from . import timing except ImportError: timing = sys.modules[__package__ + '.timing'] +try: + from . import triggerdefinition +except ImportError: + triggerdefinition = sys.modules[__package__ + '.triggerdefinition'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/task_tests.py b/fhirclient/models/task_tests.py index f2db2e317..380c4737d 100644 --- a/fhirclient/models/task_tests.py +++ b/fhirclient/models/task_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return task.Task(js) def testTask1(self): - inst = self.instantiate_from("task-example1.json") + inst = self.instantiate_from("task-example6.json") self.assertIsNotNone(inst, "Must have instantiated a Task instance") self.implTask1(inst) @@ -34,36 +34,42 @@ def testTask1(self): def implTask1(self, inst): self.assertEqual(inst.authoredOn.date, FHIRDate("2016-10-31T08:25:05+10:00").date) self.assertEqual(inst.authoredOn.as_json(), "2016-10-31T08:25:05+10:00") - self.assertEqual(inst.businessStatus.text, "waiting for specimen") + self.assertEqual(inst.businessStatus.text, "test completed and posted") self.assertEqual(inst.code.text, "Lipid Panel") - self.assertEqual(inst.contained[0].id, "signature") self.assertEqual(inst.description, "Create order for getting specimen, Set up inhouse testing, generate order for any sendouts and submit with specimen") + self.assertEqual(inst.executionPeriod.end.date, FHIRDate("2016-10-31T18:45:05+10:00").date) + self.assertEqual(inst.executionPeriod.end.as_json(), "2016-10-31T18:45:05+10:00") self.assertEqual(inst.executionPeriod.start.date, FHIRDate("2016-10-31T08:25:05+10:00").date) self.assertEqual(inst.executionPeriod.start.as_json(), "2016-10-31T08:25:05+10:00") self.assertEqual(inst.groupIdentifier.system, "http:/goodhealth.org/accession/identifiers") self.assertEqual(inst.groupIdentifier.use, "official") self.assertEqual(inst.groupIdentifier.value, "G20170201-001") - self.assertEqual(inst.id, "example1") + self.assertEqual(inst.id, "example6") self.assertEqual(inst.identifier[0].system, "http:/goodhealth.org/identifiers") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "20170201-001") self.assertEqual(inst.intent, "order") - self.assertEqual(inst.lastModified.date, FHIRDate("2016-10-31T09:45:05+10:00").date) - self.assertEqual(inst.lastModified.as_json(), "2016-10-31T09:45:05+10:00") + self.assertEqual(inst.lastModified.date, FHIRDate("2016-10-31T18:45:05+10:00").date) + self.assertEqual(inst.lastModified.as_json(), "2016-10-31T18:45:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.output[0].type.text, "DiagnosticReport generated") + self.assertEqual(inst.output[1].type.text, "collected specimen") self.assertEqual(inst.performerType[0].coding[0].code, "performer") self.assertEqual(inst.performerType[0].coding[0].display, "Performer") - self.assertEqual(inst.performerType[0].coding[0].system, "http://hl7.org/fhir/task-performer-type") + self.assertEqual(inst.performerType[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/task-performer-type") self.assertEqual(inst.performerType[0].text, "Performer") self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.reason.text, "The Task.reason should only be included if there is no Task.focus or if it differs from the reason indicated on the focus") + self.assertEqual(inst.reasonCode.text, "The Task.reason should only be included if there is no Task.focus or if it differs from the reason indicated on the focus") self.assertEqual(inst.restriction.period.end.date, FHIRDate("2016-11-02T09:45:05+10:00").date) self.assertEqual(inst.restriction.period.end.as_json(), "2016-11-02T09:45:05+10:00") self.assertEqual(inst.restriction.repetitions, 1) - self.assertEqual(inst.status, "in-progress") + self.assertEqual(inst.status, "completed") self.assertEqual(inst.text.status, "generated") def testTask2(self): - inst = self.instantiate_from("task-example2.json") + inst = self.instantiate_from("task-example-fm-poll.json") self.assertIsNotNone(inst, "Must have instantiated a Task instance") self.implTask2(inst) @@ -73,44 +79,128 @@ def testTask2(self): self.implTask2(inst2) def implTask2(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2016-10-31T08:45:05+10:00").date) - self.assertEqual(inst.authoredOn.as_json(), "2016-10-31T08:45:05+10:00") - self.assertEqual(inst.businessStatus.text, "waiting for patient") - self.assertEqual(inst.code.text, "Specimen Collection") - self.assertEqual(inst.executionPeriod.start.date, FHIRDate("2016-10-31T08:45:05+10:00").date) - self.assertEqual(inst.executionPeriod.start.as_json(), "2016-10-31T08:45:05+10:00") + self.assertEqual(inst.authoredOn.date, FHIRDate("2018-10-12T08:25:05+10:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2018-10-12T08:25:05+10:00") + self.assertEqual(inst.code.coding[0].code, "poll") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskcode") + self.assertEqual(inst.id, "fm-example2") + self.assertEqual(inst.identifier[0].system, "http:/happyvalley.com/task") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "20181012-005") + self.assertEqual(inst.input[0].type.coding[0].code, "include") + self.assertEqual(inst.input[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskinputtype") + self.assertEqual(inst.input[0].valueCode, "ClaimResponse") + self.assertEqual(inst.input[1].type.coding[0].code, "period") + self.assertEqual(inst.input[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskinputtype") + self.assertEqual(inst.input[1].valuePeriod.end.date, FHIRDate("2018-10-12").date) + self.assertEqual(inst.input[1].valuePeriod.end.as_json(), "2018-10-12") + self.assertEqual(inst.input[1].valuePeriod.start.date, FHIRDate("2018-10-01").date) + self.assertEqual(inst.input[1].valuePeriod.start.as_json(), "2018-10-01") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.lastModified.date, FHIRDate("2018-10-12T08:25:05+10:00").date) + self.assertEqual(inst.lastModified.as_json(), "2018-10-12T08:25:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority, "stat") + self.assertEqual(inst.status, "requested") + self.assertEqual(inst.text.status, "generated") + + def testTask3(self): + inst = self.instantiate_from("task-example1.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask3(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask3(inst2) + + def implTask3(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2016-10-31T08:25:05+10:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2016-10-31T08:25:05+10:00") + self.assertEqual(inst.businessStatus.text, "waiting for specimen") + self.assertEqual(inst.code.text, "Lipid Panel") + self.assertEqual(inst.contained[0].id, "signature") + self.assertEqual(inst.description, "Create order for getting specimen, Set up inhouse testing, generate order for any sendouts and submit with specimen") + self.assertEqual(inst.executionPeriod.start.date, FHIRDate("2016-10-31T08:25:05+10:00").date) + self.assertEqual(inst.executionPeriod.start.as_json(), "2016-10-31T08:25:05+10:00") self.assertEqual(inst.groupIdentifier.system, "http:/goodhealth.org/accession/identifiers") self.assertEqual(inst.groupIdentifier.use, "official") self.assertEqual(inst.groupIdentifier.value, "G20170201-001") - self.assertEqual(inst.id, "example2") + self.assertEqual(inst.id, "example1") self.assertEqual(inst.identifier[0].system, "http:/goodhealth.org/identifiers") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "20170201-002") - self.assertEqual(inst.intent, "filler-order") + self.assertEqual(inst.identifier[0].value, "20170201-001") + self.assertEqual(inst.intent, "order") self.assertEqual(inst.lastModified.date, FHIRDate("2016-10-31T09:45:05+10:00").date) self.assertEqual(inst.lastModified.as_json(), "2016-10-31T09:45:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.performerType[0].coding[0].code, "performer") self.assertEqual(inst.performerType[0].coding[0].display, "Performer") - self.assertEqual(inst.performerType[0].coding[0].system, "http://hl7.org/fhir/task-performer-type") + self.assertEqual(inst.performerType[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/task-performer-type") self.assertEqual(inst.performerType[0].text, "Performer") self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.restriction.period.end.date, FHIRDate("2016-11-01T09:45:05+10:00").date) - self.assertEqual(inst.restriction.period.end.as_json(), "2016-11-01T09:45:05+10:00") + self.assertEqual(inst.reasonCode.text, "The Task.reason should only be included if there is no Task.focus or if it differs from the reason indicated on the focus") + self.assertEqual(inst.restriction.period.end.date, FHIRDate("2016-11-02T09:45:05+10:00").date) + self.assertEqual(inst.restriction.period.end.as_json(), "2016-11-02T09:45:05+10:00") self.assertEqual(inst.restriction.repetitions, 1) - self.assertEqual(inst.status, "accepted") + self.assertEqual(inst.status, "in-progress") self.assertEqual(inst.text.status, "generated") - def testTask3(self): + def testTask4(self): + inst = self.instantiate_from("task-example-fm-reprocess.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask4(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask4(inst2) + + def implTask4(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.code.coding[0].code, "reprocess") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskcode") + self.assertEqual(inst.id, "fm-example4") + self.assertEqual(inst.identifier[0].system, "http:/happyvalley.com/task") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "20181012-006") + self.assertEqual(inst.input[0].type.coding[0].code, "origresponse") + self.assertEqual(inst.input[0].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskinputtype") + self.assertEqual(inst.input[1].type.coding[0].code, "reference") + self.assertEqual(inst.input[1].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskinputtype") + self.assertEqual(inst.input[1].valueString, "BR12345") + self.assertEqual(inst.input[2].type.coding[0].code, "item") + self.assertEqual(inst.input[2].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskinputtype") + self.assertEqual(inst.input[2].valuePositiveInt, 2) + self.assertEqual(inst.input[3].type.coding[0].code, "item") + self.assertEqual(inst.input[3].type.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskinputtype") + self.assertEqual(inst.input[3].valuePositiveInt, 3) + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.lastModified.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.lastModified.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority, "stat") + self.assertEqual(inst.status, "requested") + self.assertEqual(inst.text.status, "generated") + + def testTask5(self): inst = self.instantiate_from("task-example3.json") self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask3(inst) + self.implTask5(inst) js = inst.as_json() self.assertEqual("Task", js["resourceType"]) inst2 = task.Task(js) - self.implTask3(inst2) + self.implTask5(inst2) - def implTask3(self, inst): + def implTask5(self, inst): self.assertEqual(inst.authoredOn.date, FHIRDate("2016-03-10T22:39:32-04:00").date) self.assertEqual(inst.authoredOn.as_json(), "2016-03-10T22:39:32-04:00") self.assertEqual(inst.code.text, "Refill Request") @@ -118,131 +208,189 @@ def implTask3(self, inst): self.assertEqual(inst.intent, "order") self.assertEqual(inst.lastModified.date, FHIRDate("2016-03-10T22:39:32-04:00").date) self.assertEqual(inst.lastModified.as_json(), "2016-03-10T22:39:32-04:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") - def testTask4(self): - inst = self.instantiate_from("task-example4.json") + def testTask6(self): + inst = self.instantiate_from("task-example-fm-status-resp.json") self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask4(inst) + self.implTask6(inst) js = inst.as_json() self.assertEqual("Task", js["resourceType"]) inst2 = task.Task(js) - self.implTask4(inst2) + self.implTask6(inst2) - def implTask4(self, inst): + def implTask6(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.code.coding[0].code, "status") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskcode") + self.assertEqual(inst.id, "fm-example6") + self.assertEqual(inst.identifier[0].system, "http:/happyvalley.com/task") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "20181012-001") + self.assertEqual(inst.identifier[1].system, "http://nationalinsurers.com/identifiers/12345") + self.assertEqual(inst.identifier[1].use, "official") + self.assertEqual(inst.identifier[1].value, "123GB5674") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.lastModified.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.lastModified.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.output[0].type.coding[0].code, "status") + self.assertEqual(inst.output[0].type.coding[0].system, "http://hl7.org/financial-taskoutputtype") + self.assertEqual(inst.output[0].valueCode, "complete") + self.assertEqual(inst.priority, "stat") + self.assertEqual(inst.status, "completed") + self.assertEqual(inst.text.status, "generated") + + def testTask7(self): + inst = self.instantiate_from("task-example2.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask7(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask7(inst2) + + def implTask7(self, inst): self.assertEqual(inst.authoredOn.date, FHIRDate("2016-10-31T08:45:05+10:00").date) self.assertEqual(inst.authoredOn.as_json(), "2016-10-31T08:45:05+10:00") + self.assertEqual(inst.businessStatus.text, "waiting for patient") self.assertEqual(inst.code.text, "Specimen Collection") - self.assertEqual(inst.executionPeriod.end.date, FHIRDate("2016-10-31T14:45:05+10:00").date) - self.assertEqual(inst.executionPeriod.end.as_json(), "2016-10-31T14:45:05+10:00") self.assertEqual(inst.executionPeriod.start.date, FHIRDate("2016-10-31T08:45:05+10:00").date) self.assertEqual(inst.executionPeriod.start.as_json(), "2016-10-31T08:45:05+10:00") self.assertEqual(inst.groupIdentifier.system, "http:/goodhealth.org/accession/identifiers") self.assertEqual(inst.groupIdentifier.use, "official") self.assertEqual(inst.groupIdentifier.value, "G20170201-001") - self.assertEqual(inst.id, "example4") + self.assertEqual(inst.id, "example2") self.assertEqual(inst.identifier[0].system, "http:/goodhealth.org/identifiers") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "20170201-002") self.assertEqual(inst.intent, "filler-order") self.assertEqual(inst.lastModified.date, FHIRDate("2016-10-31T09:45:05+10:00").date) self.assertEqual(inst.lastModified.as_json(), "2016-10-31T09:45:05+10:00") - self.assertEqual(inst.output[0].type.text, "collected specimen") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.performerType[0].coding[0].code, "performer") self.assertEqual(inst.performerType[0].coding[0].display, "Performer") - self.assertEqual(inst.performerType[0].coding[0].system, "http://hl7.org/fhir/task-performer-type") + self.assertEqual(inst.performerType[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/task-performer-type") self.assertEqual(inst.performerType[0].text, "Performer") self.assertEqual(inst.priority, "routine") self.assertEqual(inst.restriction.period.end.date, FHIRDate("2016-11-01T09:45:05+10:00").date) self.assertEqual(inst.restriction.period.end.as_json(), "2016-11-01T09:45:05+10:00") self.assertEqual(inst.restriction.repetitions, 1) - self.assertEqual(inst.status, "completed") + self.assertEqual(inst.status, "accepted") self.assertEqual(inst.text.status, "generated") - def testTask5(self): - inst = self.instantiate_from("task-example5.json") + def testTask8(self): + inst = self.instantiate_from("task-example-fm-release.json") self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask5(inst) + self.implTask8(inst) js = inst.as_json() self.assertEqual("Task", js["resourceType"]) inst2 = task.Task(js) - self.implTask5(inst2) + self.implTask8(inst2) - def implTask5(self, inst): - self.assertEqual(inst.authoredOn.date, FHIRDate("2016-10-31T08:25:05+10:00").date) - self.assertEqual(inst.authoredOn.as_json(), "2016-10-31T08:25:05+10:00") - self.assertEqual(inst.businessStatus.text, "specimen received, test in progress") - self.assertEqual(inst.code.text, "Lipid Panel") - self.assertEqual(inst.description, "Create order for getting specimen, Set up inhouse testing, generate order for any sendouts and submit with specimen") - self.assertEqual(inst.executionPeriod.start.date, FHIRDate("2016-10-31T08:25:05+10:00").date) - self.assertEqual(inst.executionPeriod.start.as_json(), "2016-10-31T08:25:05+10:00") - self.assertEqual(inst.groupIdentifier.system, "http:/goodhealth.org/accession/identifiers") - self.assertEqual(inst.groupIdentifier.use, "official") - self.assertEqual(inst.groupIdentifier.value, "G20170201-001") - self.assertEqual(inst.id, "example5") - self.assertEqual(inst.identifier[0].system, "http:/goodhealth.org/identifiers") + def implTask8(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.code.coding[0].code, "release") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskcode") + self.assertEqual(inst.id, "fm-example3") + self.assertEqual(inst.identifier[0].system, "http:/happyvalley.com/task") self.assertEqual(inst.identifier[0].use, "official") - self.assertEqual(inst.identifier[0].value, "20170201-001") + self.assertEqual(inst.identifier[0].value, "20181012-001") + self.assertEqual(inst.input[0].type.coding[0].code, "origresponse") + self.assertEqual(inst.input[0].type.coding[0].system, "http://hl7.org/financial-taskinputtype") self.assertEqual(inst.intent, "order") - self.assertEqual(inst.lastModified.date, FHIRDate("2016-10-31T16:45:05+10:00").date) - self.assertEqual(inst.lastModified.as_json(), "2016-10-31T16:45:05+10:00") - self.assertEqual(inst.output[0].type.text, "collected specimen") - self.assertEqual(inst.performerType[0].coding[0].code, "performer") - self.assertEqual(inst.performerType[0].coding[0].display, "Performer") - self.assertEqual(inst.performerType[0].coding[0].system, "http://hl7.org/fhir/task-performer-type") - self.assertEqual(inst.performerType[0].text, "Performer") - self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.reason.text, "The Task.reason should only be included if there is no Task.focus or if it differs from the reason indicated on the focus") - self.assertEqual(inst.restriction.period.end.date, FHIRDate("2016-11-02T09:45:05+10:00").date) - self.assertEqual(inst.restriction.period.end.as_json(), "2016-11-02T09:45:05+10:00") - self.assertEqual(inst.restriction.repetitions, 1) - self.assertEqual(inst.status, "in-progress") + self.assertEqual(inst.lastModified.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.lastModified.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority, "stat") + self.assertEqual(inst.status, "requested") self.assertEqual(inst.text.status, "generated") - def testTask6(self): - inst = self.instantiate_from("task-example6.json") + def testTask9(self): + inst = self.instantiate_from("task-example-fm-cancel.json") self.assertIsNotNone(inst, "Must have instantiated a Task instance") - self.implTask6(inst) + self.implTask9(inst) js = inst.as_json() self.assertEqual("Task", js["resourceType"]) inst2 = task.Task(js) - self.implTask6(inst2) + self.implTask9(inst2) - def implTask6(self, inst): + def implTask9(self, inst): + self.assertEqual(inst.authoredOn.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.authoredOn.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.code.coding[0].code, "cancel") + self.assertEqual(inst.code.coding[0].system, "http://terminology.hl7.org/CodeSystem/financialtaskcode") + self.assertEqual(inst.id, "fm-example1") + self.assertEqual(inst.identifier[0].system, "http:/happyvalley.com/task") + self.assertEqual(inst.identifier[0].use, "official") + self.assertEqual(inst.identifier[0].value, "20181012-001") + self.assertEqual(inst.intent, "order") + self.assertEqual(inst.lastModified.date, FHIRDate("2018-10-04T08:25:05+10:00").date) + self.assertEqual(inst.lastModified.as_json(), "2018-10-04T08:25:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.priority, "stat") + self.assertEqual(inst.status, "requested") + self.assertEqual(inst.text.status, "generated") + + def testTask10(self): + inst = self.instantiate_from("task-example5.json") + self.assertIsNotNone(inst, "Must have instantiated a Task instance") + self.implTask10(inst) + + js = inst.as_json() + self.assertEqual("Task", js["resourceType"]) + inst2 = task.Task(js) + self.implTask10(inst2) + + def implTask10(self, inst): self.assertEqual(inst.authoredOn.date, FHIRDate("2016-10-31T08:25:05+10:00").date) self.assertEqual(inst.authoredOn.as_json(), "2016-10-31T08:25:05+10:00") - self.assertEqual(inst.businessStatus.text, "test completed and posted") + self.assertEqual(inst.businessStatus.text, "specimen received, test in progress") self.assertEqual(inst.code.text, "Lipid Panel") self.assertEqual(inst.description, "Create order for getting specimen, Set up inhouse testing, generate order for any sendouts and submit with specimen") - self.assertEqual(inst.executionPeriod.end.date, FHIRDate("2016-10-31T18:45:05+10:00").date) - self.assertEqual(inst.executionPeriod.end.as_json(), "2016-10-31T18:45:05+10:00") self.assertEqual(inst.executionPeriod.start.date, FHIRDate("2016-10-31T08:25:05+10:00").date) self.assertEqual(inst.executionPeriod.start.as_json(), "2016-10-31T08:25:05+10:00") self.assertEqual(inst.groupIdentifier.system, "http:/goodhealth.org/accession/identifiers") self.assertEqual(inst.groupIdentifier.use, "official") self.assertEqual(inst.groupIdentifier.value, "G20170201-001") - self.assertEqual(inst.id, "example6") + self.assertEqual(inst.id, "example5") self.assertEqual(inst.identifier[0].system, "http:/goodhealth.org/identifiers") self.assertEqual(inst.identifier[0].use, "official") self.assertEqual(inst.identifier[0].value, "20170201-001") self.assertEqual(inst.intent, "order") - self.assertEqual(inst.lastModified.date, FHIRDate("2016-10-31T18:45:05+10:00").date) - self.assertEqual(inst.lastModified.as_json(), "2016-10-31T18:45:05+10:00") - self.assertEqual(inst.output[0].type.text, "DiagnosticReport generated") - self.assertEqual(inst.output[1].type.text, "collected specimen") + self.assertEqual(inst.lastModified.date, FHIRDate("2016-10-31T16:45:05+10:00").date) + self.assertEqual(inst.lastModified.as_json(), "2016-10-31T16:45:05+10:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.output[0].type.text, "collected specimen") self.assertEqual(inst.performerType[0].coding[0].code, "performer") self.assertEqual(inst.performerType[0].coding[0].display, "Performer") - self.assertEqual(inst.performerType[0].coding[0].system, "http://hl7.org/fhir/task-performer-type") + self.assertEqual(inst.performerType[0].coding[0].system, "http://terminology.hl7.org/CodeSystem/task-performer-type") self.assertEqual(inst.performerType[0].text, "Performer") self.assertEqual(inst.priority, "routine") - self.assertEqual(inst.reason.text, "The Task.reason should only be included if there is no Task.focus or if it differs from the reason indicated on the focus") + self.assertEqual(inst.reasonCode.text, "The Task.reason should only be included if there is no Task.focus or if it differs from the reason indicated on the focus") self.assertEqual(inst.restriction.period.end.date, FHIRDate("2016-11-02T09:45:05+10:00").date) self.assertEqual(inst.restriction.period.end.as_json(), "2016-11-02T09:45:05+10:00") self.assertEqual(inst.restriction.repetitions, 1) - self.assertEqual(inst.status, "completed") + self.assertEqual(inst.status, "in-progress") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/models/terminologycapabilities.py b/fhirclient/models/terminologycapabilities.py new file mode 100644 index 000000000..e18e3dc8a --- /dev/null +++ b/fhirclient/models/terminologycapabilities.py @@ -0,0 +1,556 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TerminologyCapabilities) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class TerminologyCapabilities(domainresource.DomainResource): + """ A statement of system capabilities. + + A TerminologyCapabilities resource documents a set of capabilities + (behaviors) of a FHIR Terminology Server that may be used as a statement of + actual server functionality or a statement of required or desired server + implementation. + """ + + resource_type = "TerminologyCapabilities" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.closure = None + """ Information about the [ConceptMap/$closure](conceptmap-operation- + closure.html) operation. + Type `TerminologyCapabilitiesClosure` (represented as `dict` in JSON). """ + + self.codeSearch = None + """ explicit | all. + Type `str`. """ + + self.codeSystem = None + """ A code system supported by the server. + List of `TerminologyCapabilitiesCodeSystem` items (represented as `dict` in JSON). """ + + self.contact = None + """ Contact details for the publisher. + List of `ContactDetail` items (represented as `dict` in JSON). """ + + self.copyright = None + """ Use and/or publishing restrictions. + Type `str`. """ + + self.date = None + """ Date last changed. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.description = None + """ Natural language description of the terminology capabilities. + Type `str`. """ + + self.expansion = None + """ Information about the [ValueSet/$expand](valueset-operation- + expand.html) operation. + Type `TerminologyCapabilitiesExpansion` (represented as `dict` in JSON). """ + + self.experimental = None + """ For testing purposes, not real usage. + Type `bool`. """ + + self.implementation = None + """ If this describes a specific instance. + Type `TerminologyCapabilitiesImplementation` (represented as `dict` in JSON). """ + + self.jurisdiction = None + """ Intended jurisdiction for terminology capabilities (if applicable). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.kind = None + """ instance | capability | requirements. + Type `str`. """ + + self.lockedDate = None + """ Whether lockedDate is supported. + Type `bool`. """ + + self.name = None + """ Name for this terminology capabilities (computer friendly). + Type `str`. """ + + self.publisher = None + """ Name of the publisher (organization or individual). + Type `str`. """ + + self.purpose = None + """ Why this terminology capabilities is defined. + Type `str`. """ + + self.software = None + """ Software that is covered by this terminology capability statement. + Type `TerminologyCapabilitiesSoftware` (represented as `dict` in JSON). """ + + self.status = None + """ draft | active | retired | unknown. + Type `str`. """ + + self.title = None + """ Name for this terminology capabilities (human friendly). + Type `str`. """ + + self.translation = None + """ Information about the [ConceptMap/$translate](conceptmap-operation- + translate.html) operation. + Type `TerminologyCapabilitiesTranslation` (represented as `dict` in JSON). """ + + self.url = None + """ Canonical identifier for this terminology capabilities, represented + as a URI (globally unique). + Type `str`. """ + + self.useContext = None + """ The context that the content is intended to support. + List of `UsageContext` items (represented as `dict` in JSON). """ + + self.validateCode = None + """ Information about the [ValueSet/$validate-code](valueset-operation- + validate-code.html) operation. + Type `TerminologyCapabilitiesValidateCode` (represented as `dict` in JSON). """ + + self.version = None + """ Business version of the terminology capabilities. + Type `str`. """ + + super(TerminologyCapabilities, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilities, self).elementProperties() + js.extend([ + ("closure", "closure", TerminologyCapabilitiesClosure, False, None, False), + ("codeSearch", "codeSearch", str, False, None, False), + ("codeSystem", "codeSystem", TerminologyCapabilitiesCodeSystem, True, None, False), + ("contact", "contact", contactdetail.ContactDetail, True, None, False), + ("copyright", "copyright", str, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, True), + ("description", "description", str, False, None, False), + ("expansion", "expansion", TerminologyCapabilitiesExpansion, False, None, False), + ("experimental", "experimental", bool, False, None, False), + ("implementation", "implementation", TerminologyCapabilitiesImplementation, False, None, False), + ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), + ("kind", "kind", str, False, None, True), + ("lockedDate", "lockedDate", bool, False, None, False), + ("name", "name", str, False, None, False), + ("publisher", "publisher", str, False, None, False), + ("purpose", "purpose", str, False, None, False), + ("software", "software", TerminologyCapabilitiesSoftware, False, None, False), + ("status", "status", str, False, None, True), + ("title", "title", str, False, None, False), + ("translation", "translation", TerminologyCapabilitiesTranslation, False, None, False), + ("url", "url", str, False, None, False), + ("useContext", "useContext", usagecontext.UsageContext, True, None, False), + ("validateCode", "validateCode", TerminologyCapabilitiesValidateCode, False, None, False), + ("version", "version", str, False, None, False), + ]) + return js + + +from . import backboneelement + +class TerminologyCapabilitiesClosure(backboneelement.BackboneElement): + """ Information about the [ConceptMap/$closure](conceptmap-operation- + closure.html) operation. + + Whether the $closure operation is supported. + """ + + resource_type = "TerminologyCapabilitiesClosure" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.translation = None + """ If cross-system closure is supported. + Type `bool`. """ + + super(TerminologyCapabilitiesClosure, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesClosure, self).elementProperties() + js.extend([ + ("translation", "translation", bool, False, None, False), + ]) + return js + + +class TerminologyCapabilitiesCodeSystem(backboneelement.BackboneElement): + """ A code system supported by the server. + + Identifies a code system that is supported by the server. If there is a no + code system URL, then this declares the general assumptions a client can + make about support for any CodeSystem resource. + """ + + resource_type = "TerminologyCapabilitiesCodeSystem" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.subsumption = None + """ Whether subsumption is supported. + Type `bool`. """ + + self.uri = None + """ URI for the Code System. + Type `str`. """ + + self.version = None + """ Version of Code System supported. + List of `TerminologyCapabilitiesCodeSystemVersion` items (represented as `dict` in JSON). """ + + super(TerminologyCapabilitiesCodeSystem, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesCodeSystem, self).elementProperties() + js.extend([ + ("subsumption", "subsumption", bool, False, None, False), + ("uri", "uri", str, False, None, False), + ("version", "version", TerminologyCapabilitiesCodeSystemVersion, True, None, False), + ]) + return js + + +class TerminologyCapabilitiesCodeSystemVersion(backboneelement.BackboneElement): + """ Version of Code System supported. + + For the code system, a list of versions that are supported by the server. + """ + + resource_type = "TerminologyCapabilitiesCodeSystemVersion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Version identifier for this version. + Type `str`. """ + + self.compositional = None + """ If compositional grammar is supported. + Type `bool`. """ + + self.filter = None + """ Filter Properties supported. + List of `TerminologyCapabilitiesCodeSystemVersionFilter` items (represented as `dict` in JSON). """ + + self.isDefault = None + """ If this is the default version for this code system. + Type `bool`. """ + + self.language = None + """ Language Displays supported. + List of `str` items. """ + + self.property = None + """ Properties supported for $lookup. + List of `str` items. """ + + super(TerminologyCapabilitiesCodeSystemVersion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesCodeSystemVersion, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, False), + ("compositional", "compositional", bool, False, None, False), + ("filter", "filter", TerminologyCapabilitiesCodeSystemVersionFilter, True, None, False), + ("isDefault", "isDefault", bool, False, None, False), + ("language", "language", str, True, None, False), + ("property", "property", str, True, None, False), + ]) + return js + + +class TerminologyCapabilitiesCodeSystemVersionFilter(backboneelement.BackboneElement): + """ Filter Properties supported. + """ + + resource_type = "TerminologyCapabilitiesCodeSystemVersionFilter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.code = None + """ Code of the property supported. + Type `str`. """ + + self.op = None + """ Operations supported for the property. + List of `str` items. """ + + super(TerminologyCapabilitiesCodeSystemVersionFilter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesCodeSystemVersionFilter, self).elementProperties() + js.extend([ + ("code", "code", str, False, None, True), + ("op", "op", str, True, None, True), + ]) + return js + + +class TerminologyCapabilitiesExpansion(backboneelement.BackboneElement): + """ Information about the [ValueSet/$expand](valueset-operation-expand.html) + operation. + """ + + resource_type = "TerminologyCapabilitiesExpansion" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.hierarchical = None + """ Whether the server can return nested value sets. + Type `bool`. """ + + self.incomplete = None + """ Allow request for incomplete expansions?. + Type `bool`. """ + + self.paging = None + """ Whether the server supports paging on expansion. + Type `bool`. """ + + self.parameter = None + """ Supported expansion parameter. + List of `TerminologyCapabilitiesExpansionParameter` items (represented as `dict` in JSON). """ + + self.textFilter = None + """ Documentation about text searching works. + Type `str`. """ + + super(TerminologyCapabilitiesExpansion, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesExpansion, self).elementProperties() + js.extend([ + ("hierarchical", "hierarchical", bool, False, None, False), + ("incomplete", "incomplete", bool, False, None, False), + ("paging", "paging", bool, False, None, False), + ("parameter", "parameter", TerminologyCapabilitiesExpansionParameter, True, None, False), + ("textFilter", "textFilter", str, False, None, False), + ]) + return js + + +class TerminologyCapabilitiesExpansionParameter(backboneelement.BackboneElement): + """ Supported expansion parameter. + """ + + resource_type = "TerminologyCapabilitiesExpansionParameter" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.documentation = None + """ Description of support for parameter. + Type `str`. """ + + self.name = None + """ Expansion Parameter name. + Type `str`. """ + + super(TerminologyCapabilitiesExpansionParameter, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesExpansionParameter, self).elementProperties() + js.extend([ + ("documentation", "documentation", str, False, None, False), + ("name", "name", str, False, None, True), + ]) + return js + + +class TerminologyCapabilitiesImplementation(backboneelement.BackboneElement): + """ If this describes a specific instance. + + Identifies a specific implementation instance that is described by the + terminology capability statement - i.e. a particular installation, rather + than the capabilities of a software program. + """ + + resource_type = "TerminologyCapabilitiesImplementation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.description = None + """ Describes this specific instance. + Type `str`. """ + + self.url = None + """ Base URL for the implementation. + Type `str`. """ + + super(TerminologyCapabilitiesImplementation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesImplementation, self).elementProperties() + js.extend([ + ("description", "description", str, False, None, True), + ("url", "url", str, False, None, False), + ]) + return js + + +class TerminologyCapabilitiesSoftware(backboneelement.BackboneElement): + """ Software that is covered by this terminology capability statement. + + Software that is covered by this terminology capability statement. It is + used when the statement describes the capabilities of a particular software + version, independent of an installation. + """ + + resource_type = "TerminologyCapabilitiesSoftware" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.name = None + """ A name the software is known by. + Type `str`. """ + + self.version = None + """ Version covered by this statement. + Type `str`. """ + + super(TerminologyCapabilitiesSoftware, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesSoftware, self).elementProperties() + js.extend([ + ("name", "name", str, False, None, True), + ("version", "version", str, False, None, False), + ]) + return js + + +class TerminologyCapabilitiesTranslation(backboneelement.BackboneElement): + """ Information about the [ConceptMap/$translate](conceptmap-operation- + translate.html) operation. + """ + + resource_type = "TerminologyCapabilitiesTranslation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.needsMap = None + """ Whether the client must identify the map. + Type `bool`. """ + + super(TerminologyCapabilitiesTranslation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesTranslation, self).elementProperties() + js.extend([ + ("needsMap", "needsMap", bool, False, None, True), + ]) + return js + + +class TerminologyCapabilitiesValidateCode(backboneelement.BackboneElement): + """ Information about the [ValueSet/$validate-code](valueset-operation- + validate-code.html) operation. + """ + + resource_type = "TerminologyCapabilitiesValidateCode" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.translations = None + """ Whether translations are validated. + Type `bool`. """ + + super(TerminologyCapabilitiesValidateCode, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(TerminologyCapabilitiesValidateCode, self).elementProperties() + js.extend([ + ("translations", "translations", bool, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import contactdetail +except ImportError: + contactdetail = sys.modules[__package__ + '.contactdetail'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import usagecontext +except ImportError: + usagecontext = sys.modules[__package__ + '.usagecontext'] diff --git a/fhirclient/models/terminologycapabilities_tests.py b/fhirclient/models/terminologycapabilities_tests.py new file mode 100644 index 000000000..c4558073f --- /dev/null +++ b/fhirclient/models/terminologycapabilities_tests.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import terminologycapabilities +from .fhirdate import FHIRDate + + +class TerminologyCapabilitiesTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("TerminologyCapabilities", js["resourceType"]) + return terminologycapabilities.TerminologyCapabilities(js) + + def testTerminologyCapabilities1(self): + inst = self.instantiate_from("terminologycapabilities-example.json") + self.assertIsNotNone(inst, "Must have instantiated a TerminologyCapabilities instance") + self.implTerminologyCapabilities1(inst) + + js = inst.as_json() + self.assertEqual("TerminologyCapabilities", js["resourceType"]) + inst2 = terminologycapabilities.TerminologyCapabilities(js) + self.implTerminologyCapabilities1(inst2) + + def implTerminologyCapabilities1(self, inst): + self.assertEqual(inst.codeSearch, "explicit") + self.assertEqual(inst.contact[0].name, "System Administrator") + self.assertEqual(inst.contact[0].telecom[0].system, "email") + self.assertEqual(inst.contact[0].telecom[0].value, "wile@acme.org") + self.assertEqual(inst.date.date, FHIRDate("2012-01-04").date) + self.assertEqual(inst.date.as_json(), "2012-01-04") + self.assertEqual(inst.description, "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example") + self.assertEqual(inst.implementation.description, "Acme Terminology Server") + self.assertEqual(inst.implementation.url, "http://example.org/tx") + self.assertEqual(inst.kind, "instance") + self.assertEqual(inst.name, "ACME-EHR") + self.assertEqual(inst.publisher, "ACME Corporation") + self.assertEqual(inst.software.name, "TxServer") + self.assertEqual(inst.software.version, "0.1.2") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "ACME EHR capability statement") + self.assertEqual(inst.url, "urn:uuid:68D043B5-9ECF-4559-A57A-396E0D452311") + self.assertEqual(inst.version, "20130510") + diff --git a/fhirclient/models/testreport.py b/fhirclient/models/testreport.py index 0077d3526..14ea7085c 100644 --- a/fhirclient/models/testreport.py +++ b/fhirclient/models/testreport.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/TestReport) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TestReport) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -69,7 +69,7 @@ def __init__(self, jsondict=None, strict=True): self.testScript = None """ Reference to the version-specific TestScript that was executed to produce this TestReport. - Type `FHIRReference` referencing `TestScript` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.tester = None """ Name of the tester producing this report (Organization or @@ -285,8 +285,8 @@ def elementProperties(self): class TestReportTeardown(backboneelement.BackboneElement): """ The results of running the series of required clean up steps. - The results of the series of operations required to clean up after the all - the tests were executed (successfully or otherwise). + The results of the series of operations required to clean up after all the + tests were executed (successfully or otherwise). """ resource_type = "TestReportTeardown" diff --git a/fhirclient/models/testreport_tests.py b/fhirclient/models/testreport_tests.py index eb317f470..9108e005e 100644 --- a/fhirclient/models/testreport_tests.py +++ b/fhirclient/models/testreport_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -37,6 +37,9 @@ def implTestReport1(self, inst): self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9878") self.assertEqual(inst.issued.date, FHIRDate("2016-10-07T08:25:34-05:00").date) self.assertEqual(inst.issued.as_json(), "2016-10-07T08:25:34-05:00") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.name, "TestReport Example for TestScript Example") self.assertEqual(inst.participant[0].display, "Crucible") self.assertEqual(inst.participant[0].type, "test-engine") diff --git a/fhirclient/models/testscript.py b/fhirclient/models/testscript.py index 7cd332771..f85d0ad7f 100644 --- a/fhirclient/models/testscript.py +++ b/fhirclient/models/testscript.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TestScript) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,8 +10,8 @@ class TestScript(domainresource.DomainResource): """ Describes a set of tests. - A structured set of tests against a FHIR server implementation to determine - compliance against the FHIR specification. + A structured set of tests against a FHIR server or client implementation to + determine compliance against the FHIR specification. """ resource_type = "TestScript" @@ -33,7 +33,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -77,7 +77,7 @@ def __init__(self, jsondict=None, strict=True): self.profile = None """ Reference of the validation profile. - List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ + List of `FHIRReference` items (represented as `dict` in JSON). """ self.publisher = None """ Name of the publisher (organization or individual). @@ -87,14 +87,6 @@ def __init__(self, jsondict=None, strict=True): """ Why this test script is defined. Type `str`. """ - self.rule = None - """ Assert rule used within the test script. - List of `TestScriptRule` items (represented as `dict` in JSON). """ - - self.ruleset = None - """ Assert ruleset used within the test script. - List of `TestScriptRuleset` items (represented as `dict` in JSON). """ - self.setup = None """ A series of required setup operations before tests are executed. Type `TestScriptSetup` (represented as `dict` in JSON). """ @@ -116,11 +108,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this test script (globally unique). + """ Canonical identifier for this test script, represented as a URI + (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.variable = None @@ -151,8 +144,6 @@ def elementProperties(self): ("profile", "profile", fhirreference.FHIRReference, True, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), - ("rule", "rule", TestScriptRule, True, None, False), - ("ruleset", "ruleset", TestScriptRuleset, True, None, False), ("setup", "setup", TestScriptSetup, False, None, False), ("status", "status", str, False, None, True), ("teardown", "teardown", TestScriptTeardown, False, None, False), @@ -233,15 +224,15 @@ def __init__(self, jsondict=None, strict=True): self.resource = None """ Reference of the resource. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ super(TestScriptFixture, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptFixture, self).elementProperties() js.extend([ - ("autocreate", "autocreate", bool, False, None, False), - ("autodelete", "autodelete", bool, False, None, False), + ("autocreate", "autocreate", bool, False, None, True), + ("autodelete", "autodelete", bool, False, None, True), ("resource", "resource", fhirreference.FHIRReference, False, None, False), ]) return js @@ -305,7 +296,7 @@ def __init__(self, jsondict=None, strict=True): self.capabilities = None """ Required Capability Statement. - Type `FHIRReference` referencing `CapabilityStatement` (represented as `dict` in JSON). """ + Type `str`. """ self.description = None """ The expected capabilities of the server. @@ -336,13 +327,13 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(TestScriptMetadataCapability, self).elementProperties() js.extend([ - ("capabilities", "capabilities", fhirreference.FHIRReference, False, None, True), + ("capabilities", "capabilities", str, False, None, True), ("description", "description", str, False, None, False), ("destination", "destination", int, False, None, False), ("link", "link", str, True, None, False), ("origin", "origin", int, True, None, False), - ("required", "required", bool, False, None, False), - ("validated", "validated", bool, False, None, False), + ("required", "required", bool, False, None, True), + ("validated", "validated", bool, False, None, True), ]) return js @@ -418,182 +409,6 @@ def elementProperties(self): return js -class TestScriptRule(backboneelement.BackboneElement): - """ Assert rule used within the test script. - - Assert rule to be used in one or more asserts within the test script. - """ - - resource_type = "TestScriptRule" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.param = None - """ Rule parameter template. - List of `TestScriptRuleParam` items (represented as `dict` in JSON). """ - - self.resource = None - """ Assert rule resource reference. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - super(TestScriptRule, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptRule, self).elementProperties() - js.extend([ - ("param", "param", TestScriptRuleParam, True, None, False), - ("resource", "resource", fhirreference.FHIRReference, False, None, True), - ]) - return js - - -class TestScriptRuleParam(backboneelement.BackboneElement): - """ Rule parameter template. - - Each rule template can take one or more parameters for rule evaluation. - """ - - resource_type = "TestScriptRuleParam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.name = None - """ Parameter name matching external assert rule parameter. - Type `str`. """ - - self.value = None - """ Parameter value defined either explicitly or dynamically. - Type `str`. """ - - super(TestScriptRuleParam, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptRuleParam, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, True), - ("value", "value", str, False, None, False), - ]) - return js - - -class TestScriptRuleset(backboneelement.BackboneElement): - """ Assert ruleset used within the test script. - - Contains one or more rules. Offers a way to group rules so assertions - could reference the group of rules and have them all applied. - """ - - resource_type = "TestScriptRuleset" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.resource = None - """ Assert ruleset resource reference. - Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ - - self.rule = None - """ The referenced rule within the ruleset. - List of `TestScriptRulesetRule` items (represented as `dict` in JSON). """ - - super(TestScriptRuleset, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptRuleset, self).elementProperties() - js.extend([ - ("resource", "resource", fhirreference.FHIRReference, False, None, True), - ("rule", "rule", TestScriptRulesetRule, True, None, True), - ]) - return js - - -class TestScriptRulesetRule(backboneelement.BackboneElement): - """ The referenced rule within the ruleset. - - The referenced rule within the external ruleset template. - """ - - resource_type = "TestScriptRulesetRule" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.param = None - """ Ruleset rule parameter template. - List of `TestScriptRulesetRuleParam` items (represented as `dict` in JSON). """ - - self.ruleId = None - """ Id of referenced rule within the ruleset. - Type `str`. """ - - super(TestScriptRulesetRule, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptRulesetRule, self).elementProperties() - js.extend([ - ("param", "param", TestScriptRulesetRuleParam, True, None, False), - ("ruleId", "ruleId", str, False, None, True), - ]) - return js - - -class TestScriptRulesetRuleParam(backboneelement.BackboneElement): - """ Ruleset rule parameter template. - - Each rule template can take one or more parameters for rule evaluation. - """ - - resource_type = "TestScriptRulesetRuleParam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.name = None - """ Parameter name matching external assert ruleset rule parameter. - Type `str`. """ - - self.value = None - """ Parameter value defined either explicitly or dynamically. - Type `str`. """ - - super(TestScriptRulesetRuleParam, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptRulesetRuleParam, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, True), - ("value", "value", str, False, None, False), - ]) - return js - - class TestScriptSetup(backboneelement.BackboneElement): """ A series of required setup operations before tests are executed. """ @@ -675,7 +490,7 @@ def __init__(self, jsondict=None, strict=True): """ self.compareToSourceExpression = None - """ The fluentpath expression to evaluate against the source fixture. + """ The FHIRPath expression to evaluate against the source fixture. Type `str`. """ self.compareToSourceId = None @@ -687,7 +502,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.contentType = None - """ xml | json | ttl | none. + """ Mime type to compare against the 'Content-Type' header. Type `str`. """ self.description = None @@ -699,7 +514,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.expression = None - """ The fluentpath expression to be evaluated. + """ The FHIRPath expression to be evaluated. Type `str`. """ self.headerField = None @@ -728,7 +543,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.requestMethod = None - """ delete | get | options | patch | post | put. + """ delete | get | options | patch | post | put | head. Type `str`. """ self.requestURL = None @@ -749,14 +564,6 @@ def __init__(self, jsondict=None, strict=True): """ HTTP response code to test. Type `str`. """ - self.rule = None - """ The reference to a TestScript.rule. - Type `TestScriptSetupActionAssertRule` (represented as `dict` in JSON). """ - - self.ruleset = None - """ The reference to a TestScript.ruleset. - Type `TestScriptSetupActionAssertRuleset` (represented as `dict` in JSON). """ - self.sourceId = None """ Fixture Id of source expression or headerField. Type `str`. """ @@ -796,187 +603,10 @@ def elementProperties(self): ("resource", "resource", str, False, None, False), ("response", "response", str, False, None, False), ("responseCode", "responseCode", str, False, None, False), - ("rule", "rule", TestScriptSetupActionAssertRule, False, None, False), - ("ruleset", "ruleset", TestScriptSetupActionAssertRuleset, False, None, False), ("sourceId", "sourceId", str, False, None, False), ("validateProfileId", "validateProfileId", str, False, None, False), ("value", "value", str, False, None, False), - ("warningOnly", "warningOnly", bool, False, None, False), - ]) - return js - - -class TestScriptSetupActionAssertRule(backboneelement.BackboneElement): - """ The reference to a TestScript.rule. - - The TestScript.rule this assert will evaluate. - """ - - resource_type = "TestScriptSetupActionAssertRule" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.param = None - """ Rule parameter template. - List of `TestScriptSetupActionAssertRuleParam` items (represented as `dict` in JSON). """ - - self.ruleId = None - """ Id of the TestScript.rule. - Type `str`. """ - - super(TestScriptSetupActionAssertRule, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionAssertRule, self).elementProperties() - js.extend([ - ("param", "param", TestScriptSetupActionAssertRuleParam, True, None, False), - ("ruleId", "ruleId", str, False, None, True), - ]) - return js - - -class TestScriptSetupActionAssertRuleParam(backboneelement.BackboneElement): - """ Rule parameter template. - - Each rule template can take one or more parameters for rule evaluation. - """ - - resource_type = "TestScriptSetupActionAssertRuleParam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.name = None - """ Parameter name matching external assert rule parameter. - Type `str`. """ - - self.value = None - """ Parameter value defined either explicitly or dynamically. - Type `str`. """ - - super(TestScriptSetupActionAssertRuleParam, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionAssertRuleParam, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, True), - ("value", "value", str, False, None, True), - ]) - return js - - -class TestScriptSetupActionAssertRuleset(backboneelement.BackboneElement): - """ The reference to a TestScript.ruleset. - - The TestScript.ruleset this assert will evaluate. - """ - - resource_type = "TestScriptSetupActionAssertRuleset" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.rule = None - """ The referenced rule within the ruleset. - List of `TestScriptSetupActionAssertRulesetRule` items (represented as `dict` in JSON). """ - - self.rulesetId = None - """ Id of the TestScript.ruleset. - Type `str`. """ - - super(TestScriptSetupActionAssertRuleset, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionAssertRuleset, self).elementProperties() - js.extend([ - ("rule", "rule", TestScriptSetupActionAssertRulesetRule, True, None, False), - ("rulesetId", "rulesetId", str, False, None, True), - ]) - return js - - -class TestScriptSetupActionAssertRulesetRule(backboneelement.BackboneElement): - """ The referenced rule within the ruleset. - - The referenced rule within the external ruleset template. - """ - - resource_type = "TestScriptSetupActionAssertRulesetRule" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.param = None - """ Rule parameter template. - List of `TestScriptSetupActionAssertRulesetRuleParam` items (represented as `dict` in JSON). """ - - self.ruleId = None - """ Id of referenced rule within the ruleset. - Type `str`. """ - - super(TestScriptSetupActionAssertRulesetRule, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionAssertRulesetRule, self).elementProperties() - js.extend([ - ("param", "param", TestScriptSetupActionAssertRulesetRuleParam, True, None, False), - ("ruleId", "ruleId", str, False, None, True), - ]) - return js - - -class TestScriptSetupActionAssertRulesetRuleParam(backboneelement.BackboneElement): - """ Rule parameter template. - - Each rule template can take one or more parameters for rule evaluation. - """ - - resource_type = "TestScriptSetupActionAssertRulesetRuleParam" - - def __init__(self, jsondict=None, strict=True): - """ Initialize all valid properties. - - :raises: FHIRValidationError on validation errors, unless strict is False - :param dict jsondict: A JSON dictionary to use for initialization - :param bool strict: If True (the default), invalid variables will raise a TypeError - """ - - self.name = None - """ Parameter name matching external assert ruleset rule parameter. - Type `str`. """ - - self.value = None - """ Parameter value defined either explicitly or dynamically. - Type `str`. """ - - super(TestScriptSetupActionAssertRulesetRuleParam, self).__init__(jsondict=jsondict, strict=strict) - - def elementProperties(self): - js = super(TestScriptSetupActionAssertRulesetRuleParam, self).elementProperties() - js.extend([ - ("name", "name", str, False, None, True), - ("value", "value", str, False, None, True), + ("warningOnly", "warningOnly", bool, False, None, True), ]) return js @@ -998,11 +628,12 @@ def __init__(self, jsondict=None, strict=True): """ self.accept = None - """ xml | json | ttl | none. + """ Mime type to accept in the payload of the response, with charset + etc.. Type `str`. """ self.contentType = None - """ xml | json | ttl | none. + """ Mime type of the request payload contents, with charset etc.. Type `str`. """ self.description = None @@ -1021,6 +652,10 @@ def __init__(self, jsondict=None, strict=True): """ Tracking/logging operation label. Type `str`. """ + self.method = None + """ delete | get | options | patch | post | put | head. + Type `str`. """ + self.origin = None """ Server initiating the request. Type `int`. """ @@ -1071,8 +706,9 @@ def elementProperties(self): ("contentType", "contentType", str, False, None, False), ("description", "description", str, False, None, False), ("destination", "destination", int, False, None, False), - ("encodeRequestUrl", "encodeRequestUrl", bool, False, None, False), + ("encodeRequestUrl", "encodeRequestUrl", bool, False, None, True), ("label", "label", str, False, None, False), + ("method", "method", str, False, None, False), ("origin", "origin", int, False, None, False), ("params", "params", str, False, None, False), ("requestHeader", "requestHeader", TestScriptSetupActionOperationRequestHeader, True, None, False), @@ -1125,7 +761,7 @@ def elementProperties(self): class TestScriptTeardown(backboneelement.BackboneElement): """ A series of required clean up steps. - A series of operations required to clean up after the all the tests are + A series of operations required to clean up after all the tests are executed (successfully or otherwise). """ @@ -1282,7 +918,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.expression = None - """ The fluentpath expression against the fixture body. + """ The FHIRPath expression against the fixture body. Type `str`. """ self.headerField = None diff --git a/fhirclient/models/testscript_tests.py b/fhirclient/models/testscript_tests.py index f6a711ab9..5f1f74adf 100644 --- a/fhirclient/models/testscript_tests.py +++ b/fhirclient/models/testscript_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return testscript.TestScript(js) def testTestScript1(self): - inst = self.instantiate_from("testscript-example-history.json") + inst = self.instantiate_from("testscript-example-multisystem.json") self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") self.implTestScript1(inst) @@ -32,111 +32,6 @@ def testTestScript1(self): self.implTestScript1(inst2) def implTestScript1(self, inst): - self.assertEqual(inst.contact[0].name, "Support") - self.assertEqual(inst.contact[0].telecom[0].system, "email") - self.assertEqual(inst.contact[0].telecom[0].use, "work") - self.assertEqual(inst.contact[0].telecom[0].value, "support@HL7.org") - self.assertEqual(inst.copyright, "© HL7.org 2011+") - self.assertEqual(inst.date.date, FHIRDate("2017-01-18").date) - self.assertEqual(inst.date.as_json(), "2017-01-18") - self.assertTrue(inst.experimental) - self.assertFalse(inst.fixture[0].autocreate) - self.assertFalse(inst.fixture[0].autodelete) - self.assertEqual(inst.fixture[0].id, "fixture-patient-create") - self.assertFalse(inst.fixture[1].autocreate) - self.assertFalse(inst.fixture[1].autodelete) - self.assertEqual(inst.fixture[1].id, "fixture-patient-update") - self.assertEqual(inst.id, "testscript-example-history") - self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9877") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") - self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.metadata.capability[0].description, "Patient Update, Delete and History (Instance) Operations") - self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#update") - self.assertEqual(inst.metadata.capability[0].link[1], "http://hl7.org/fhir/http.html#delete") - self.assertEqual(inst.metadata.capability[0].link[2], "http://hl7.org/fhir/http.html#history") - self.assertTrue(inst.metadata.capability[0].required) - self.assertEqual(inst.metadata.link[0].description, "Demographics and other administrative information about an individual or animal receiving care or other health-related services.") - self.assertEqual(inst.metadata.link[0].url, "http://hl7.org/fhir/patient.html") - self.assertEqual(inst.name, "TestScript Example History") - self.assertEqual(inst.publisher, "HL7") - self.assertEqual(inst.purpose, "Patient (Conditional) Create, Update, Delete and History (Instance) Operations") - self.assertEqual(inst.setup.action[0].operation.accept, "json") - self.assertEqual(inst.setup.action[0].operation.description, "Execute a delete operation to insure the patient does not exist on the server.") - self.assertEqual(inst.setup.action[0].operation.label, "SetupDeletePatient") - self.assertEqual(inst.setup.action[0].operation.params, "/${createResourceId}") - self.assertEqual(inst.setup.action[0].operation.resource, "Patient") - self.assertEqual(inst.setup.action[0].operation.type.code, "delete") - self.assertEqual(inst.setup.action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.setup.action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK) or 204(No Content).") - self.assertEqual(inst.setup.action[1].assert_fhir.direction, "response") - self.assertEqual(inst.setup.action[1].assert_fhir.operator, "in") - self.assertEqual(inst.setup.action[1].assert_fhir.responseCode, "200,204") - self.assertEqual(inst.setup.action[2].operation.accept, "json") - self.assertEqual(inst.setup.action[2].operation.contentType, "json") - self.assertEqual(inst.setup.action[2].operation.description, "Create patient resource on test server using the contents of fixture-patient-create") - self.assertEqual(inst.setup.action[2].operation.label, "SetupCreatePatient") - self.assertEqual(inst.setup.action[2].operation.params, "/${createResourceId}") - self.assertEqual(inst.setup.action[2].operation.resource, "Patient") - self.assertEqual(inst.setup.action[2].operation.sourceId, "fixture-patient-create") - self.assertEqual(inst.setup.action[2].operation.type.code, "update") - self.assertEqual(inst.setup.action[2].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.setup.action[3].assert_fhir.description, "Confirm that the returned HTTP status is 201(Created).") - self.assertEqual(inst.setup.action[3].assert_fhir.direction, "response") - self.assertEqual(inst.setup.action[3].assert_fhir.responseCode, "201") - self.assertEqual(inst.setup.action[4].operation.accept, "json") - self.assertEqual(inst.setup.action[4].operation.contentType, "json") - self.assertEqual(inst.setup.action[4].operation.description, "Update patient resource on test server using the contents of fixture-patient-update") - self.assertEqual(inst.setup.action[4].operation.label, "SetupUpdatePatient") - self.assertEqual(inst.setup.action[4].operation.params, "/${createResourceId}") - self.assertEqual(inst.setup.action[4].operation.resource, "Patient") - self.assertEqual(inst.setup.action[4].operation.sourceId, "fixture-patient-update") - self.assertEqual(inst.setup.action[4].operation.type.code, "update") - self.assertEqual(inst.setup.action[4].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.setup.action[5].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") - self.assertEqual(inst.setup.action[5].assert_fhir.direction, "response") - self.assertEqual(inst.setup.action[5].assert_fhir.responseCode, "200") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.test[0].action[0].operation.accept, "json") - self.assertEqual(inst.test[0].action[0].operation.contentType, "json") - self.assertEqual(inst.test[0].action[0].operation.description, "Get the Patient history on the test server using the id from fixture-patient-create.") - self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") - self.assertEqual(inst.test[0].action[0].operation.targetId, "fixture-patient-create") - self.assertEqual(inst.test[0].action[0].operation.type.code, "history") - self.assertEqual(inst.test[0].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") - self.assertEqual(inst.test[0].action[1].assert_fhir.direction, "response") - self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") - self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned resource type is Bundle.") - self.assertEqual(inst.test[0].action[2].assert_fhir.resource, "Bundle") - self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned Bundle conforms to the base FHIR specification.") - self.assertEqual(inst.test[0].action[3].assert_fhir.validateProfileId, "bundle-profile") - self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned Bundle type equals 'history'.") - self.assertEqual(inst.test[0].action[4].assert_fhir.operator, "equals") - self.assertEqual(inst.test[0].action[4].assert_fhir.path, "fhir:Bundle/fhir:type/@value") - self.assertEqual(inst.test[0].action[4].assert_fhir.value, "history") - self.assertEqual(inst.test[0].description, "Get the history for a known Patient and validate response.") - self.assertEqual(inst.test[0].id, "01-HistoryPatient") - self.assertEqual(inst.test[0].name, "History Patient") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-history") - self.assertEqual(inst.variable[0].name, "createResourceId") - self.assertEqual(inst.variable[0].path, "Patient/id") - self.assertEqual(inst.variable[0].sourceId, "fixture-patient-create") - self.assertEqual(inst.version, "1.0") - - def testTestScript2(self): - inst = self.instantiate_from("testscript-example-multisystem.json") - self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript2(inst) - - js = inst.as_json() - self.assertEqual("TestScript", js["resourceType"]) - inst2 = testscript.TestScript(js) - self.implTestScript2(inst2) - - def implTestScript2(self, inst): self.assertEqual(inst.contact[0].name, "Support") self.assertEqual(inst.contact[0].telecom[0].system, "email") self.assertEqual(inst.contact[0].telecom[0].use, "work") @@ -155,12 +50,14 @@ def implTestScript2(self, inst): self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.metadata.capability[0].capabilities, "CapabilityStatement/example") self.assertEqual(inst.metadata.capability[0].description, "Patient Read Operation") self.assertEqual(inst.metadata.capability[0].destination, 1) self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#read") self.assertEqual(inst.metadata.capability[0].origin[0], 1) self.assertTrue(inst.metadata.capability[0].required) self.assertFalse(inst.metadata.capability[0].validated) + self.assertEqual(inst.metadata.capability[1].capabilities, "CapabilityStatement/example") self.assertEqual(inst.metadata.capability[1].description, "Patient Read Operation") self.assertEqual(inst.metadata.capability[1].destination, 2) self.assertEqual(inst.metadata.capability[1].link[0], "http://hl7.org/fhir/http.html#read") @@ -179,28 +76,34 @@ def implTestScript2(self, inst): self.assertEqual(inst.test[0].action[0].operation.contentType, "xml") self.assertEqual(inst.test[0].action[0].operation.description, "Read a Patient from the first destination test system and perform basic validation.") self.assertEqual(inst.test[0].action[0].operation.destination, 1) + self.assertTrue(inst.test[0].action[0].operation.encodeRequestUrl) self.assertEqual(inst.test[0].action[0].operation.origin, 1) self.assertEqual(inst.test[0].action[0].operation.params, "/${Dest1PatientResourceId}") self.assertEqual(inst.test[0].action[0].operation.requestId, "request-read-patient-01") self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") self.assertEqual(inst.test[0].action[0].operation.type.code, "read") - self.assertEqual(inst.test[0].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[0].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the request method GET was sent by the client system under test.") self.assertEqual(inst.test[0].action[1].assert_fhir.requestMethod, "get") + self.assertFalse(inst.test[0].action[1].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the client requested an Accept of xml.") self.assertEqual(inst.test[0].action[2].assert_fhir.direction, "request") self.assertEqual(inst.test[0].action[2].assert_fhir.headerField, "Accept") self.assertEqual(inst.test[0].action[2].assert_fhir.operator, "contains") self.assertEqual(inst.test[0].action[2].assert_fhir.value, "xml") + self.assertFalse(inst.test[0].action[2].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") self.assertEqual(inst.test[0].action[3].assert_fhir.direction, "response") self.assertEqual(inst.test[0].action[3].assert_fhir.response, "okay") + self.assertFalse(inst.test[0].action[3].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[4].assert_fhir.contentType, "xml") self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned format is XML.") self.assertEqual(inst.test[0].action[4].assert_fhir.direction, "response") + self.assertFalse(inst.test[0].action[4].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[5].assert_fhir.description, "Confirm that the returned resource type is Patient.") self.assertEqual(inst.test[0].action[5].assert_fhir.direction, "response") self.assertEqual(inst.test[0].action[5].assert_fhir.resource, "Patient") + self.assertFalse(inst.test[0].action[5].assert_fhir.warningOnly) self.assertEqual(inst.test[0].description, "Read a Patient from the first destination test system using the user defined dynamic variable ${Dest1PatientResourceId}. Perform basic validation.") self.assertEqual(inst.test[0].id, "01-ReadPatient-Destination1") self.assertEqual(inst.test[0].name, "ReadPatient-Destination1") @@ -208,27 +111,32 @@ def implTestScript2(self, inst): self.assertEqual(inst.test[1].action[0].operation.contentType, "xml") self.assertEqual(inst.test[1].action[0].operation.description, "Read a Patient from the second destination test system and perform basic validation.") self.assertEqual(inst.test[1].action[0].operation.destination, 2) + self.assertTrue(inst.test[1].action[0].operation.encodeRequestUrl) self.assertEqual(inst.test[1].action[0].operation.origin, 1) self.assertEqual(inst.test[1].action[0].operation.params, "/${Dest2PatientResourceId}") self.assertEqual(inst.test[1].action[0].operation.requestHeader[0].field, "Accept-Charset") self.assertEqual(inst.test[1].action[0].operation.requestHeader[0].value, "utf-8") self.assertEqual(inst.test[1].action[0].operation.resource, "Patient") self.assertEqual(inst.test[1].action[0].operation.type.code, "read") - self.assertEqual(inst.test[1].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[1].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[1].action[1].assert_fhir.description, "Confirm that the client requested an Accept of xml.") self.assertEqual(inst.test[1].action[1].assert_fhir.direction, "request") self.assertEqual(inst.test[1].action[1].assert_fhir.headerField, "Accept") self.assertEqual(inst.test[1].action[1].assert_fhir.operator, "contains") self.assertEqual(inst.test[1].action[1].assert_fhir.value, "xml") + self.assertFalse(inst.test[1].action[1].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[2].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") self.assertEqual(inst.test[1].action[2].assert_fhir.direction, "response") self.assertEqual(inst.test[1].action[2].assert_fhir.response, "okay") + self.assertFalse(inst.test[1].action[2].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[3].assert_fhir.contentType, "xml") self.assertEqual(inst.test[1].action[3].assert_fhir.description, "Confirm that the returned format is XML.") self.assertEqual(inst.test[1].action[3].assert_fhir.direction, "response") + self.assertFalse(inst.test[1].action[3].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[4].assert_fhir.description, "Confirm that the returned resource type is Patient.") self.assertEqual(inst.test[1].action[4].assert_fhir.direction, "response") self.assertEqual(inst.test[1].action[4].assert_fhir.resource, "Patient") + self.assertFalse(inst.test[1].action[4].assert_fhir.warningOnly) self.assertEqual(inst.test[1].description, "Read a Patient from the second destination test system using the user defined dynamic variable ${Dest2PatientResourceId}. Perform basic validation.") self.assertEqual(inst.test[1].id, "02-ReadPatient-Destination2") self.assertEqual(inst.test[1].name, "ReadPatient-Destination2") @@ -241,17 +149,17 @@ def implTestScript2(self, inst): self.assertEqual(inst.variable[1].name, "Dest2PatientResourceId") self.assertEqual(inst.version, "1.0") - def testTestScript3(self): - inst = self.instantiate_from("testscript-example-readtest.json") + def testTestScript2(self): + inst = self.instantiate_from("testscript-example-history.json") self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript3(inst) + self.implTestScript2(inst) js = inst.as_json() self.assertEqual("TestScript", js["resourceType"]) inst2 = testscript.TestScript(js) - self.implTestScript3(inst2) + self.implTestScript2(inst2) - def implTestScript3(self, inst): + def implTestScript2(self, inst): self.assertEqual(inst.contact[0].name, "Support") self.assertEqual(inst.contact[0].telecom[0].system, "email") self.assertEqual(inst.contact[0].telecom[0].use, "work") @@ -259,95 +167,117 @@ def implTestScript3(self, inst): self.assertEqual(inst.copyright, "© HL7.org 2011+") self.assertEqual(inst.date.date, FHIRDate("2017-01-18").date) self.assertEqual(inst.date.as_json(), "2017-01-18") - self.assertEqual(inst.description, "TestScript example resource with ported Sprinkler basic read tests R001, R002, R003, R004. The read tests will utilize user defined dynamic variables that will hold the Patient resource id values.") self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "testscript-example-readtest") + self.assertFalse(inst.fixture[0].autocreate) + self.assertFalse(inst.fixture[0].autodelete) + self.assertEqual(inst.fixture[0].id, "fixture-patient-create") + self.assertFalse(inst.fixture[1].autocreate) + self.assertFalse(inst.fixture[1].autodelete) + self.assertEqual(inst.fixture[1].id, "fixture-patient-update") + self.assertEqual(inst.id, "testscript-example-history") self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9879") + self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9877") self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.metadata.capability[0].description, "Patient Read Operation") - self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#read") + self.assertEqual(inst.metadata.capability[0].capabilities, "CapabilityStatement/example") + self.assertEqual(inst.metadata.capability[0].description, "Patient Update, Delete and History (Instance) Operations") + self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#update") + self.assertEqual(inst.metadata.capability[0].link[1], "http://hl7.org/fhir/http.html#delete") + self.assertEqual(inst.metadata.capability[0].link[2], "http://hl7.org/fhir/http.html#history") self.assertTrue(inst.metadata.capability[0].required) + self.assertFalse(inst.metadata.capability[0].validated) self.assertEqual(inst.metadata.link[0].description, "Demographics and other administrative information about an individual or animal receiving care or other health-related services.") self.assertEqual(inst.metadata.link[0].url, "http://hl7.org/fhir/patient.html") - self.assertEqual(inst.name, "TestScript Example Read Test") + self.assertEqual(inst.name, "TestScript Example History") self.assertEqual(inst.publisher, "HL7") - self.assertEqual(inst.purpose, "Patient Read Operation") + self.assertEqual(inst.purpose, "Patient (Conditional) Create, Update, Delete and History (Instance) Operations") + self.assertEqual(inst.setup.action[0].operation.accept, "json") + self.assertEqual(inst.setup.action[0].operation.description, "Execute a delete operation to insure the patient does not exist on the server.") + self.assertTrue(inst.setup.action[0].operation.encodeRequestUrl) + self.assertEqual(inst.setup.action[0].operation.label, "SetupDeletePatient") + self.assertEqual(inst.setup.action[0].operation.params, "/${createResourceId}") + self.assertEqual(inst.setup.action[0].operation.resource, "Patient") + self.assertEqual(inst.setup.action[0].operation.type.code, "delete") + self.assertEqual(inst.setup.action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") + self.assertEqual(inst.setup.action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK) or 204(No Content).") + self.assertEqual(inst.setup.action[1].assert_fhir.direction, "response") + self.assertEqual(inst.setup.action[1].assert_fhir.operator, "in") + self.assertEqual(inst.setup.action[1].assert_fhir.responseCode, "200,204") + self.assertFalse(inst.setup.action[1].assert_fhir.warningOnly) + self.assertEqual(inst.setup.action[2].operation.accept, "json") + self.assertEqual(inst.setup.action[2].operation.contentType, "json") + self.assertEqual(inst.setup.action[2].operation.description, "Create patient resource on test server using the contents of fixture-patient-create") + self.assertTrue(inst.setup.action[2].operation.encodeRequestUrl) + self.assertEqual(inst.setup.action[2].operation.label, "SetupCreatePatient") + self.assertEqual(inst.setup.action[2].operation.params, "/${createResourceId}") + self.assertEqual(inst.setup.action[2].operation.resource, "Patient") + self.assertEqual(inst.setup.action[2].operation.sourceId, "fixture-patient-create") + self.assertEqual(inst.setup.action[2].operation.type.code, "update") + self.assertEqual(inst.setup.action[2].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") + self.assertEqual(inst.setup.action[3].assert_fhir.description, "Confirm that the returned HTTP status is 201(Created).") + self.assertEqual(inst.setup.action[3].assert_fhir.direction, "response") + self.assertEqual(inst.setup.action[3].assert_fhir.responseCode, "201") + self.assertFalse(inst.setup.action[3].assert_fhir.warningOnly) + self.assertEqual(inst.setup.action[4].operation.accept, "json") + self.assertEqual(inst.setup.action[4].operation.contentType, "json") + self.assertEqual(inst.setup.action[4].operation.description, "Update patient resource on test server using the contents of fixture-patient-update") + self.assertTrue(inst.setup.action[4].operation.encodeRequestUrl) + self.assertEqual(inst.setup.action[4].operation.label, "SetupUpdatePatient") + self.assertEqual(inst.setup.action[4].operation.params, "/${createResourceId}") + self.assertEqual(inst.setup.action[4].operation.resource, "Patient") + self.assertEqual(inst.setup.action[4].operation.sourceId, "fixture-patient-update") + self.assertEqual(inst.setup.action[4].operation.type.code, "update") + self.assertEqual(inst.setup.action[4].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") + self.assertEqual(inst.setup.action[5].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") + self.assertEqual(inst.setup.action[5].assert_fhir.direction, "response") + self.assertEqual(inst.setup.action[5].assert_fhir.responseCode, "200") + self.assertFalse(inst.setup.action[5].assert_fhir.warningOnly) self.assertEqual(inst.status, "draft") - self.assertEqual(inst.test[0].action[0].operation.accept, "xml") - self.assertEqual(inst.test[0].action[0].operation.description, "Read the known Patient resource on the destination test system using the user defined dynamic variable ${KnownPatientResourceId}.") - self.assertEqual(inst.test[0].action[0].operation.params, "/${KnownPatientResourceId}") + self.assertEqual(inst.test[0].action[0].operation.accept, "json") + self.assertEqual(inst.test[0].action[0].operation.contentType, "json") + self.assertEqual(inst.test[0].action[0].operation.description, "Get the Patient history on the test server using the id from fixture-patient-create.") + self.assertTrue(inst.test[0].action[0].operation.encodeRequestUrl) self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") - self.assertEqual(inst.test[0].action[0].operation.type.code, "read") - self.assertEqual(inst.test[0].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[0].action[0].operation.targetId, "fixture-patient-create") + self.assertEqual(inst.test[0].action[0].operation.type.code, "history") + self.assertEqual(inst.test[0].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") + self.assertEqual(inst.test[0].action[1].assert_fhir.direction, "response") self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") - self.assertEqual(inst.test[0].action[2].assert_fhir.contentType, "xml") - self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned format is XML.") - self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server may not support versioning.") - self.assertEqual(inst.test[0].action[3].assert_fhir.headerField, "Last-Modified") - self.assertEqual(inst.test[0].action[3].assert_fhir.operator, "notEmpty") - self.assertTrue(inst.test[0].action[3].assert_fhir.warningOnly) - self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned resource type is Patient.") - self.assertEqual(inst.test[0].action[4].assert_fhir.resource, "Patient") - self.assertEqual(inst.test[0].action[5].assert_fhir.description, "Confirm that the returned Patient conforms to the base FHIR specification.") - self.assertEqual(inst.test[0].action[5].assert_fhir.validateProfileId, "patient-profile") - self.assertEqual(inst.test[0].description, "Read a known Patient and validate response.") - self.assertEqual(inst.test[0].id, "R001") - self.assertEqual(inst.test[0].name, "Sprinkler Read Test R001") - self.assertEqual(inst.test[1].action[0].operation.accept, "xml") - self.assertEqual(inst.test[1].action[0].operation.params, "/1") - self.assertEqual(inst.test[1].action[0].operation.resource, "Patient") - self.assertEqual(inst.test[1].action[0].operation.type.code, "read") - self.assertEqual(inst.test[1].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.test[1].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 404(Not Found).") - self.assertEqual(inst.test[1].action[1].assert_fhir.response, "notFound") - self.assertEqual(inst.test[1].description, "Read an unknown Resource Type and validate response.") - self.assertEqual(inst.test[1].id, "R002") - self.assertEqual(inst.test[1].name, "Sprinkler Read Test R002") - self.assertEqual(inst.test[2].action[0].operation.accept, "xml") - self.assertEqual(inst.test[2].action[0].operation.description, "Attempt to read the non-existing Patient resource on the destination test system using the user defined dynamic variable ${NonExistsPatientResourceId}.") - self.assertEqual(inst.test[2].action[0].operation.params, "/${NonExistsPatientResourceId}") - self.assertEqual(inst.test[2].action[0].operation.resource, "Patient") - self.assertEqual(inst.test[2].action[0].operation.type.code, "read") - self.assertEqual(inst.test[2].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.test[2].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 404(Not Found).") - self.assertEqual(inst.test[2].action[1].assert_fhir.response, "notFound") - self.assertEqual(inst.test[2].description, "Read a known, non-existing Patient and validate response.") - self.assertEqual(inst.test[2].id, "R003") - self.assertEqual(inst.test[2].name, "Sprinkler Read Test R003") - self.assertEqual(inst.test[3].action[0].operation.accept, "xml") - self.assertEqual(inst.test[3].action[0].operation.description, "Attempt to read a Patient resource on the destination test system using known bad formatted resource id.") - self.assertEqual(inst.test[3].action[0].operation.params, "/ID-may-not-contain-CAPITALS") - self.assertEqual(inst.test[3].action[0].operation.resource, "Patient") - self.assertEqual(inst.test[3].action[0].operation.type.code, "read") - self.assertEqual(inst.test[3].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.test[3].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 400(Bad Request).") - self.assertEqual(inst.test[3].action[1].assert_fhir.response, "bad") - self.assertEqual(inst.test[3].description, "Read a Patient using a known bad formatted resource id and validate response.") - self.assertEqual(inst.test[3].id, "R004") - self.assertEqual(inst.test[3].name, "Sprinkler Read Test R004") + self.assertFalse(inst.test[0].action[1].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned resource type is Bundle.") + self.assertEqual(inst.test[0].action[2].assert_fhir.resource, "Bundle") + self.assertFalse(inst.test[0].action[2].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned Bundle conforms to the base FHIR specification.") + self.assertEqual(inst.test[0].action[3].assert_fhir.validateProfileId, "bundle-profile") + self.assertFalse(inst.test[0].action[3].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned Bundle type equals 'history'.") + self.assertEqual(inst.test[0].action[4].assert_fhir.operator, "equals") + self.assertEqual(inst.test[0].action[4].assert_fhir.path, "fhir:Bundle/fhir:type/@value") + self.assertEqual(inst.test[0].action[4].assert_fhir.value, "history") + self.assertFalse(inst.test[0].action[4].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].description, "Get the history for a known Patient and validate response.") + self.assertEqual(inst.test[0].id, "01-HistoryPatient") + self.assertEqual(inst.test[0].name, "History Patient") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-readtest") - self.assertEqual(inst.variable[0].defaultValue, "example") - self.assertEqual(inst.variable[0].name, "KnownPatientResourceId") - self.assertEqual(inst.variable[1].defaultValue, "does-not-exist") - self.assertEqual(inst.variable[1].name, "NonExistsPatientResourceId") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-history") + self.assertEqual(inst.variable[0].name, "createResourceId") + self.assertEqual(inst.variable[0].path, "Patient/id") + self.assertEqual(inst.variable[0].sourceId, "fixture-patient-create") self.assertEqual(inst.version, "1.0") - def testTestScript4(self): - inst = self.instantiate_from("testscript-example-rule.json") + def testTestScript3(self): + inst = self.instantiate_from("testscript-example-update.json") self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript4(inst) + self.implTestScript3(inst) js = inst.as_json() self.assertEqual("TestScript", js["resourceType"]) inst2 = testscript.TestScript(js) - self.implTestScript4(inst2) + self.implTestScript3(inst2) - def implTestScript4(self, inst): + def implTestScript3(self, inst): self.assertEqual(inst.contact[0].name, "Support") self.assertEqual(inst.contact[0].telecom[0].system, "email") self.assertEqual(inst.contact[0].telecom[0].use, "work") @@ -355,129 +285,100 @@ def implTestScript4(self, inst): self.assertEqual(inst.copyright, "© HL7.org 2011+") self.assertEqual(inst.date.date, FHIRDate("2017-01-18").date) self.assertEqual(inst.date.as_json(), "2017-01-18") + self.assertEqual(inst.description, "TestScript example resource with setup to delete if present and create a new instance of a Patient; and single test definition to update that Patient with various asserts.") self.assertTrue(inst.experimental) self.assertFalse(inst.fixture[0].autocreate) self.assertFalse(inst.fixture[0].autodelete) self.assertEqual(inst.fixture[0].id, "fixture-patient-create") self.assertFalse(inst.fixture[1].autocreate) self.assertFalse(inst.fixture[1].autodelete) - self.assertEqual(inst.fixture[1].id, "fixture-patient-minimum") - self.assertEqual(inst.id, "testscript-example-rule") + self.assertEqual(inst.fixture[1].id, "fixture-patient-update") + self.assertEqual(inst.id, "testscript-example-update") self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9880") + self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9882") self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.metadata.capability[0].description, "Patient Update, Read and Delete Operations") - self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#delete") - self.assertEqual(inst.metadata.capability[0].link[1], "http://hl7.org/fhir/http.html#read") - self.assertEqual(inst.metadata.capability[0].link[2], "http://hl7.org/fhir/http.html#update") + self.assertEqual(inst.metadata.capability[0].capabilities, "CapabilityStatement/example") + self.assertEqual(inst.metadata.capability[0].description, "Patient Update and Delete Operations") + self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#update") + self.assertEqual(inst.metadata.capability[0].link[1], "http://hl7.org/fhir/http.html#delete") self.assertTrue(inst.metadata.capability[0].required) + self.assertFalse(inst.metadata.capability[0].validated) self.assertEqual(inst.metadata.link[0].description, "Demographics and other administrative information about an individual or animal receiving care or other health-related services.") self.assertEqual(inst.metadata.link[0].url, "http://hl7.org/fhir/patient.html") - self.assertEqual(inst.name, "TestScript Example") + self.assertEqual(inst.name, "TestScript Example Update") self.assertEqual(inst.publisher, "HL7") - self.assertEqual(inst.purpose, "Patient Conditional Create (Update), Read and Delete Operations") - self.assertEqual(inst.rule[0].id, "rule-responseStatusCode") - self.assertEqual(inst.rule[0].param[0].name, "expectedStatusCode") - self.assertEqual(inst.rule[0].param[0].value, "200") - self.assertEqual(inst.ruleset[0].id, "ruleset-responseContentTypeStatusCode") - self.assertEqual(inst.ruleset[0].rule[0].param[0].name, "expectedContentType") - self.assertEqual(inst.ruleset[0].rule[0].param[0].value, "json") - self.assertEqual(inst.ruleset[0].rule[0].ruleId, "RuleResponseContentType") - self.assertEqual(inst.ruleset[0].rule[1].param[0].name, "expectedStatusCode") - self.assertEqual(inst.ruleset[0].rule[1].param[0].value, "200") - self.assertEqual(inst.ruleset[0].rule[1].ruleId, "RuleResponseStatusCode") - self.assertEqual(inst.setup.action[0].operation.accept, "json") + self.assertEqual(inst.purpose, "Patient (Conditional) Create, Update, Delete Operations") + self.assertEqual(inst.setup.action[0].operation.accept, "xml") self.assertEqual(inst.setup.action[0].operation.description, "Execute a delete operation to insure the patient does not exist on the server.") + self.assertTrue(inst.setup.action[0].operation.encodeRequestUrl) self.assertEqual(inst.setup.action[0].operation.label, "SetupDeletePatient") self.assertEqual(inst.setup.action[0].operation.params, "/${createResourceId}") self.assertEqual(inst.setup.action[0].operation.resource, "Patient") self.assertEqual(inst.setup.action[0].operation.type.code, "delete") - self.assertEqual(inst.setup.action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.setup.action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.setup.action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK) or 204(No Content).") self.assertEqual(inst.setup.action[1].assert_fhir.direction, "response") self.assertEqual(inst.setup.action[1].assert_fhir.operator, "in") self.assertEqual(inst.setup.action[1].assert_fhir.responseCode, "200,204") - self.assertEqual(inst.setup.action[2].operation.accept, "json") - self.assertEqual(inst.setup.action[2].operation.contentType, "json") + self.assertFalse(inst.setup.action[1].assert_fhir.warningOnly) + self.assertEqual(inst.setup.action[2].operation.accept, "xml") + self.assertEqual(inst.setup.action[2].operation.contentType, "xml") self.assertEqual(inst.setup.action[2].operation.description, "Create patient resource on test server using the contents of fixture-patient-create") + self.assertTrue(inst.setup.action[2].operation.encodeRequestUrl) self.assertEqual(inst.setup.action[2].operation.label, "SetupCreatePatient") self.assertEqual(inst.setup.action[2].operation.params, "/${createResourceId}") self.assertEqual(inst.setup.action[2].operation.resource, "Patient") self.assertEqual(inst.setup.action[2].operation.sourceId, "fixture-patient-create") self.assertEqual(inst.setup.action[2].operation.type.code, "update") - self.assertEqual(inst.setup.action[2].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.setup.action[2].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.setup.action[3].assert_fhir.description, "Confirm that the returned HTTP status is 201(Created).") self.assertEqual(inst.setup.action[3].assert_fhir.direction, "response") - self.assertEqual(inst.setup.action[3].assert_fhir.label, "Setup-RuleCreateOK") - self.assertEqual(inst.setup.action[3].assert_fhir.rule.param[0].name, "expectedStatusCode") - self.assertEqual(inst.setup.action[3].assert_fhir.rule.param[0].value, "201") - self.assertEqual(inst.setup.action[3].assert_fhir.rule.ruleId, "rule-responseStatusCode") + self.assertEqual(inst.setup.action[3].assert_fhir.responseCode, "201") + self.assertFalse(inst.setup.action[3].assert_fhir.warningOnly) self.assertEqual(inst.status, "draft") - self.assertEqual(inst.test[0].action[0].operation.description, "Read the patient resource on the test server using the id from fixture-patient-create. Prevent URL encoding of the request.") - self.assertFalse(inst.test[0].action[0].operation.encodeRequestUrl) + self.assertEqual(inst.test[0].action[0].operation.accept, "xml") + self.assertEqual(inst.test[0].action[0].operation.contentType, "xml") + self.assertEqual(inst.test[0].action[0].operation.description, "Update patient resource on test server using the contents of fixture-patient-update") + self.assertTrue(inst.test[0].action[0].operation.encodeRequestUrl) + self.assertEqual(inst.test[0].action[0].operation.label, "SetupUpdatePatient") + self.assertEqual(inst.test[0].action[0].operation.params, "/${createResourceId}") self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") - self.assertEqual(inst.test[0].action[0].operation.responseId, "fixture-patient-read") - self.assertEqual(inst.test[0].action[0].operation.targetId, "fixture-patient-create") - self.assertEqual(inst.test[0].action[0].operation.type.code, "read") - self.assertEqual(inst.test[0].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[0].action[0].operation.sourceId, "fixture-patient-update") + self.assertEqual(inst.test[0].action[0].operation.type.code, "update") + self.assertEqual(inst.test[0].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") - self.assertEqual(inst.test[0].action[1].assert_fhir.label, "01-RuleReadPatientOK") - self.assertEqual(inst.test[0].action[1].assert_fhir.rule.ruleId, "rule-responseStatusCode") - self.assertEqual(inst.test[0].action[2].assert_fhir.label, "01-RuleReadPatientContentType") - self.assertEqual(inst.test[0].action[2].assert_fhir.ruleset.rule[0].param[0].name, "expectedContentType") - self.assertEqual(inst.test[0].action[2].assert_fhir.ruleset.rule[0].param[0].value, "XML") - self.assertEqual(inst.test[0].action[2].assert_fhir.ruleset.rule[0].ruleId, "RuleResponseContentType") - self.assertEqual(inst.test[0].action[2].assert_fhir.ruleset.rulesetId, "ruleset-responseResourcePatient") - self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server may not support versioning.") - self.assertEqual(inst.test[0].action[3].assert_fhir.direction, "response") + self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") + self.assertFalse(inst.test[0].action[1].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[2].assert_fhir.contentType, "xml") + self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned format is XML.") + self.assertFalse(inst.test[0].action[2].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server might not support versioning.") self.assertEqual(inst.test[0].action[3].assert_fhir.headerField, "Last-Modified") self.assertEqual(inst.test[0].action[3].assert_fhir.operator, "notEmpty") self.assertTrue(inst.test[0].action[3].assert_fhir.warningOnly) - self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned resource type is Patient.") - self.assertEqual(inst.test[0].action[4].assert_fhir.resource, "Patient") - self.assertEqual(inst.test[0].action[5].assert_fhir.description, "Confirm that the returned Patient conforms to the base FHIR specification.") - self.assertEqual(inst.test[0].action[5].assert_fhir.validateProfileId, "patient-profile") - self.assertEqual(inst.test[0].action[6].assert_fhir.description, "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit sourceId reference to read responseId fixture.") - self.assertEqual(inst.test[0].action[6].assert_fhir.operator, "equals") - self.assertEqual(inst.test[0].action[6].assert_fhir.path, "fhir:Patient/fhir:name/fhir:family/@value") - self.assertEqual(inst.test[0].action[6].assert_fhir.sourceId, "fixture-patient-read") - self.assertEqual(inst.test[0].action[6].assert_fhir.value, "Chalmers") - self.assertEqual(inst.test[0].action[7].assert_fhir.description, "Confirm that the returned Patient contains the expected given name 'Peter'. Uses explicit sourceId reference to read responseId fixture.") - self.assertEqual(inst.test[0].action[7].assert_fhir.operator, "equals") - self.assertEqual(inst.test[0].action[7].assert_fhir.path, "fhir:Patient/fhir:name/fhir:given/@value") - self.assertEqual(inst.test[0].action[7].assert_fhir.sourceId, "fixture-patient-read") - self.assertEqual(inst.test[0].action[7].assert_fhir.value, "Peter") - self.assertEqual(inst.test[0].action[8].assert_fhir.compareToSourceId, "fixture-patient-create") - self.assertEqual(inst.test[0].action[8].assert_fhir.compareToSourcePath, "fhir:Patient/fhir:name/fhir:family/@value") - self.assertEqual(inst.test[0].action[8].assert_fhir.operator, "equals") - self.assertEqual(inst.test[0].action[8].assert_fhir.path, "fhir:Patient/fhir:name/fhir:family/@value") - self.assertEqual(inst.test[0].action[9].assert_fhir.compareToSourceId, "fixture-patient-create") - self.assertEqual(inst.test[0].action[9].assert_fhir.compareToSourcePath, "fhir:Patient/fhir:name/fhir:given/@value") - self.assertEqual(inst.test[0].action[9].assert_fhir.path, "fhir:Patient/fhir:name/fhir:given/@value") - self.assertEqual(inst.test[0].action[9].assert_fhir.sourceId, "fixture-patient-read") - self.assertEqual(inst.test[0].description, "Read a patient and validate response.") - self.assertEqual(inst.test[0].id, "01-ReadPatient") - self.assertEqual(inst.test[0].name, "Read Patient") + self.assertEqual(inst.test[0].description, "Update a Patient and validate response.") + self.assertEqual(inst.test[0].id, "01-UpdatePatient") + self.assertEqual(inst.test[0].name, "Update Patient") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-rule") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-update") self.assertEqual(inst.variable[0].name, "createResourceId") self.assertEqual(inst.variable[0].path, "Patient/id") self.assertEqual(inst.variable[0].sourceId, "fixture-patient-create") self.assertEqual(inst.version, "1.0") - def testTestScript5(self): + def testTestScript4(self): inst = self.instantiate_from("testscript-example-search.json") self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript5(inst) + self.implTestScript4(inst) js = inst.as_json() self.assertEqual("TestScript", js["resourceType"]) inst2 = testscript.TestScript(js) - self.implTestScript5(inst2) + self.implTestScript4(inst2) - def implTestScript5(self, inst): + def implTestScript4(self, inst): self.assertEqual(inst.contact[0].name, "Support") self.assertEqual(inst.contact[0].telecom[0].system, "email") self.assertEqual(inst.contact[0].telecom[0].use, "work") @@ -487,6 +388,8 @@ def implTestScript5(self, inst): self.assertEqual(inst.date.as_json(), "2017-01-18") self.assertEqual(inst.description, "TestScript example resource with simple Patient search test. The read tests will utilize user defined dynamic variables that will hold the Patient search parameter values.") self.assertTrue(inst.experimental) + self.assertFalse(inst.fixture[0].autocreate) + self.assertFalse(inst.fixture[0].autodelete) self.assertEqual(inst.fixture[0].id, "fixture-patient-create") self.assertEqual(inst.id, "testscript-example-search") self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") @@ -494,9 +397,11 @@ def implTestScript5(self, inst): self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.metadata.capability[0].capabilities, "CapabilityStatement/example") self.assertEqual(inst.metadata.capability[0].description, "Patient Search Operation") self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#search") self.assertTrue(inst.metadata.capability[0].required) + self.assertFalse(inst.metadata.capability[0].validated) self.assertEqual(inst.metadata.link[0].description, "Demographics and other administrative information about an individual or animal receiving care or other health-related services.") self.assertEqual(inst.metadata.link[0].url, "http://hl7.org/fhir/patient.html") self.assertEqual(inst.name, "TestScript Example Search") @@ -504,68 +409,86 @@ def implTestScript5(self, inst): self.assertEqual(inst.purpose, "Patient Search Operation") self.assertEqual(inst.setup.action[0].operation.accept, "xml") self.assertEqual(inst.setup.action[0].operation.description, "Test simple search to verify server support.") + self.assertTrue(inst.setup.action[0].operation.encodeRequestUrl) self.assertEqual(inst.setup.action[0].operation.params, "?family=DONTEXPECTAMATCH&given=DONTEXPECTAMATCH") self.assertEqual(inst.setup.action[0].operation.resource, "Patient") self.assertEqual(inst.setup.action[0].operation.type.code, "search") - self.assertEqual(inst.setup.action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.setup.action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.setup.action[1].assert_fhir.description, "Confirm that the request url contains the family search parameter.") self.assertEqual(inst.setup.action[1].assert_fhir.direction, "request") self.assertEqual(inst.setup.action[1].assert_fhir.operator, "contains") self.assertEqual(inst.setup.action[1].assert_fhir.requestURL, "family") + self.assertFalse(inst.setup.action[1].assert_fhir.warningOnly) self.assertEqual(inst.setup.action[2].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") self.assertEqual(inst.setup.action[2].assert_fhir.direction, "response") self.assertEqual(inst.setup.action[2].assert_fhir.responseCode, "200") + self.assertFalse(inst.setup.action[2].assert_fhir.warningOnly) self.assertEqual(inst.setup.action[3].assert_fhir.description, "Confirm that the returned resource type is Bundle.") self.assertEqual(inst.setup.action[3].assert_fhir.resource, "Bundle") + self.assertFalse(inst.setup.action[3].assert_fhir.warningOnly) self.assertEqual(inst.setup.action[4].assert_fhir.description, "Confirm that the returned Bundle correctly defines the navigation links.") self.assertTrue(inst.setup.action[4].assert_fhir.navigationLinks) + self.assertFalse(inst.setup.action[4].assert_fhir.warningOnly) self.assertEqual(inst.status, "draft") self.assertEqual(inst.test[0].action[0].operation.accept, "xml") self.assertEqual(inst.test[0].action[0].operation.contentType, "xml") self.assertEqual(inst.test[0].action[0].operation.description, "Create a Patient resource and capture the returned HTTP Header Location.") + self.assertTrue(inst.test[0].action[0].operation.encodeRequestUrl) self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") self.assertEqual(inst.test[0].action[0].operation.responseId, "PatientCreateResponse") self.assertEqual(inst.test[0].action[0].operation.sourceId, "fixture-patient-create") self.assertEqual(inst.test[0].action[0].operation.type.code, "create") - self.assertEqual(inst.test[0].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[0].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 201(Created).") self.assertEqual(inst.test[0].action[1].assert_fhir.response, "created") + self.assertFalse(inst.test[0].action[1].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned HTTP Header Location is present.") self.assertEqual(inst.test[0].action[2].assert_fhir.direction, "response") self.assertEqual(inst.test[0].action[2].assert_fhir.headerField, "Location") self.assertEqual(inst.test[0].action[2].assert_fhir.operator, "notEmpty") + self.assertFalse(inst.test[0].action[2].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[3].operation.accept, "xml") self.assertEqual(inst.test[0].action[3].operation.description, "Read the created Patient using the captured Location URL value.") + self.assertTrue(inst.test[0].action[3].operation.encodeRequestUrl) self.assertEqual(inst.test[0].action[3].operation.type.code, "read") - self.assertEqual(inst.test[0].action[3].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[0].action[3].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[0].action[3].operation.url, "${PatientCreateLocation}") self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") self.assertEqual(inst.test[0].action[4].assert_fhir.response, "okay") + self.assertFalse(inst.test[0].action[4].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[5].assert_fhir.description, "Confirm that the returned resource type is Patient.") self.assertEqual(inst.test[0].action[5].assert_fhir.resource, "Patient") + self.assertFalse(inst.test[0].action[5].assert_fhir.warningOnly) self.assertEqual(inst.test[0].description, "Create a Patient resource and capture the returned HTTP Header Location. Then search for (read) that Patient using the Location URL value and validate the response.") self.assertEqual(inst.test[0].id, "01-PatientCreateSearch") self.assertEqual(inst.test[0].name, "Patient Create Search") self.assertEqual(inst.test[1].action[0].operation.accept, "xml") self.assertEqual(inst.test[1].action[0].operation.description, "Search for Patient resources on the destination test system.") + self.assertTrue(inst.test[1].action[0].operation.encodeRequestUrl) self.assertEqual(inst.test[1].action[0].operation.params, "?family=${PatientSearchFamilyName}&given=${PatientSearchGivenName}") self.assertEqual(inst.test[1].action[0].operation.resource, "Patient") self.assertEqual(inst.test[1].action[0].operation.type.code, "search") - self.assertEqual(inst.test[1].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[1].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[1].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") self.assertEqual(inst.test[1].action[1].assert_fhir.response, "okay") + self.assertFalse(inst.test[1].action[1].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[2].assert_fhir.contentType, "xml") self.assertEqual(inst.test[1].action[2].assert_fhir.description, "Confirm that the returned format is XML.") + self.assertFalse(inst.test[1].action[2].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[3].assert_fhir.description, "Confirm that the returned resource type is Bundle.") self.assertEqual(inst.test[1].action[3].assert_fhir.resource, "Bundle") + self.assertFalse(inst.test[1].action[3].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[4].assert_fhir.description, "Confirm that the returned Bundle conforms to the base FHIR specification.") self.assertEqual(inst.test[1].action[4].assert_fhir.validateProfileId, "bundle-profile") + self.assertFalse(inst.test[1].action[4].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[5].assert_fhir.description, "Confirm that the returned Bundle type equals 'searchset'.") self.assertEqual(inst.test[1].action[5].assert_fhir.operator, "equals") self.assertEqual(inst.test[1].action[5].assert_fhir.path, "fhir:Bundle/fhir:type/@value") self.assertEqual(inst.test[1].action[5].assert_fhir.value, "searchset") + self.assertFalse(inst.test[1].action[5].assert_fhir.warningOnly) self.assertEqual(inst.test[1].action[6].assert_fhir.description, "Confirm that the returned Bundle total is greater than or equal to the number of returned entries.") self.assertEqual(inst.test[1].action[6].assert_fhir.expression, "Bundle.total.toInteger() >= entry.count()") + self.assertFalse(inst.test[1].action[6].assert_fhir.warningOnly) self.assertEqual(inst.test[1].description, "Search for Patient resources using the user defined dynamic variables ${PatientSearchFamilyName} and ${PatientSearchGivenName} and validate response.") self.assertEqual(inst.test[1].id, "02-PatientSearchDynamic") self.assertEqual(inst.test[1].name, "Patient Search Dynamic") @@ -585,109 +508,17 @@ def implTestScript5(self, inst): self.assertEqual(inst.variable[3].name, "PatientSearchBundleTotal") self.assertEqual(inst.version, "1.0") - def testTestScript6(self): - inst = self.instantiate_from("testscript-example-update.json") - self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript6(inst) - - js = inst.as_json() - self.assertEqual("TestScript", js["resourceType"]) - inst2 = testscript.TestScript(js) - self.implTestScript6(inst2) - - def implTestScript6(self, inst): - self.assertEqual(inst.contact[0].name, "Support") - self.assertEqual(inst.contact[0].telecom[0].system, "email") - self.assertEqual(inst.contact[0].telecom[0].use, "work") - self.assertEqual(inst.contact[0].telecom[0].value, "support@HL7.org") - self.assertEqual(inst.copyright, "© HL7.org 2011+") - self.assertEqual(inst.date.date, FHIRDate("2017-01-18").date) - self.assertEqual(inst.date.as_json(), "2017-01-18") - self.assertEqual(inst.description, "TestScript example resource with setup to delete if present and create a new instance of a Patient; and single test definition to update that Patient with various asserts.") - self.assertTrue(inst.experimental) - self.assertFalse(inst.fixture[0].autocreate) - self.assertFalse(inst.fixture[0].autodelete) - self.assertEqual(inst.fixture[0].id, "fixture-patient-create") - self.assertFalse(inst.fixture[1].autocreate) - self.assertFalse(inst.fixture[1].autodelete) - self.assertEqual(inst.fixture[1].id, "fixture-patient-update") - self.assertEqual(inst.id, "testscript-example-update") - self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9882") - self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") - self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") - self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") - self.assertEqual(inst.metadata.capability[0].description, "Patient Update and Delete Operations") - self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#update") - self.assertEqual(inst.metadata.capability[0].link[1], "http://hl7.org/fhir/http.html#delete") - self.assertTrue(inst.metadata.capability[0].required) - self.assertEqual(inst.metadata.link[0].description, "Demographics and other administrative information about an individual or animal receiving care or other health-related services.") - self.assertEqual(inst.metadata.link[0].url, "http://hl7.org/fhir/patient.html") - self.assertEqual(inst.name, "TestScript Example Update") - self.assertEqual(inst.publisher, "HL7") - self.assertEqual(inst.purpose, "Patient (Conditional) Create, Update, Delete Operations") - self.assertEqual(inst.setup.action[0].operation.accept, "xml") - self.assertEqual(inst.setup.action[0].operation.description, "Execute a delete operation to insure the patient does not exist on the server.") - self.assertEqual(inst.setup.action[0].operation.label, "SetupDeletePatient") - self.assertEqual(inst.setup.action[0].operation.params, "/${createResourceId}") - self.assertEqual(inst.setup.action[0].operation.resource, "Patient") - self.assertEqual(inst.setup.action[0].operation.type.code, "delete") - self.assertEqual(inst.setup.action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.setup.action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK) or 204(No Content).") - self.assertEqual(inst.setup.action[1].assert_fhir.direction, "response") - self.assertEqual(inst.setup.action[1].assert_fhir.operator, "in") - self.assertEqual(inst.setup.action[1].assert_fhir.responseCode, "200,204") - self.assertEqual(inst.setup.action[2].operation.accept, "xml") - self.assertEqual(inst.setup.action[2].operation.contentType, "xml") - self.assertEqual(inst.setup.action[2].operation.description, "Create patient resource on test server using the contents of fixture-patient-create") - self.assertEqual(inst.setup.action[2].operation.label, "SetupCreatePatient") - self.assertEqual(inst.setup.action[2].operation.params, "/${createResourceId}") - self.assertEqual(inst.setup.action[2].operation.resource, "Patient") - self.assertEqual(inst.setup.action[2].operation.sourceId, "fixture-patient-create") - self.assertEqual(inst.setup.action[2].operation.type.code, "update") - self.assertEqual(inst.setup.action[2].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.setup.action[3].assert_fhir.description, "Confirm that the returned HTTP status is 201(Created).") - self.assertEqual(inst.setup.action[3].assert_fhir.direction, "response") - self.assertEqual(inst.setup.action[3].assert_fhir.responseCode, "201") - self.assertEqual(inst.status, "draft") - self.assertEqual(inst.test[0].action[0].operation.accept, "xml") - self.assertEqual(inst.test[0].action[0].operation.contentType, "xml") - self.assertEqual(inst.test[0].action[0].operation.description, "Update patient resource on test server using the contents of fixture-patient-update") - self.assertEqual(inst.test[0].action[0].operation.label, "SetupUpdatePatient") - self.assertEqual(inst.test[0].action[0].operation.params, "/${createResourceId}") - self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") - self.assertEqual(inst.test[0].action[0].operation.sourceId, "fixture-patient-update") - self.assertEqual(inst.test[0].action[0].operation.type.code, "update") - self.assertEqual(inst.test[0].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") - self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") - self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") - self.assertEqual(inst.test[0].action[2].assert_fhir.contentType, "xml") - self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned format is XML.") - self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server may not support versioning.") - self.assertEqual(inst.test[0].action[3].assert_fhir.headerField, "Last-Modified") - self.assertEqual(inst.test[0].action[3].assert_fhir.operator, "notEmpty") - self.assertTrue(inst.test[0].action[3].assert_fhir.warningOnly) - self.assertEqual(inst.test[0].description, "Update a Patient and validate response.") - self.assertEqual(inst.test[0].id, "01-UpdatePatient") - self.assertEqual(inst.test[0].name, "Update Patient") - self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-update") - self.assertEqual(inst.variable[0].name, "createResourceId") - self.assertEqual(inst.variable[0].path, "Patient/id") - self.assertEqual(inst.variable[0].sourceId, "fixture-patient-create") - self.assertEqual(inst.version, "1.0") - - def testTestScript7(self): + def testTestScript5(self): inst = self.instantiate_from("testscript-example.json") self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") - self.implTestScript7(inst) + self.implTestScript5(inst) js = inst.as_json() self.assertEqual("TestScript", js["resourceType"]) inst2 = testscript.TestScript(js) - self.implTestScript7(inst2) + self.implTestScript5(inst2) - def implTestScript7(self, inst): + def implTestScript5(self, inst): self.assertEqual(inst.contact[0].name, "Support") self.assertEqual(inst.contact[0].telecom[0].system, "email") self.assertEqual(inst.contact[0].telecom[0].use, "work") @@ -709,11 +540,13 @@ def implTestScript7(self, inst): self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.metadata.capability[0].capabilities, "CapabilityStatement/example") self.assertEqual(inst.metadata.capability[0].description, "Patient Update, Read and Delete Operations") self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#delete") self.assertEqual(inst.metadata.capability[0].link[1], "http://hl7.org/fhir/http.html#read") self.assertEqual(inst.metadata.capability[0].link[2], "http://hl7.org/fhir/http.html#update") self.assertTrue(inst.metadata.capability[0].required) + self.assertFalse(inst.metadata.capability[0].validated) self.assertEqual(inst.metadata.link[0].description, "Demographics and other administrative information about an individual or animal receiving care or other health-related services.") self.assertEqual(inst.metadata.link[0].url, "http://hl7.org/fhir/patient.html") self.assertEqual(inst.name, "TestScript Example") @@ -721,83 +554,98 @@ def implTestScript7(self, inst): self.assertEqual(inst.purpose, "Patient Conditional Create (Update), Read and Delete Operations") self.assertEqual(inst.setup.action[0].operation.accept, "json") self.assertEqual(inst.setup.action[0].operation.description, "Execute a delete operation to insure the patient does not exist on the server.") + self.assertTrue(inst.setup.action[0].operation.encodeRequestUrl) self.assertEqual(inst.setup.action[0].operation.label, "SetupDeletePatient") self.assertEqual(inst.setup.action[0].operation.params, "/${createResourceId}") self.assertEqual(inst.setup.action[0].operation.resource, "Patient") self.assertEqual(inst.setup.action[0].operation.type.code, "delete") - self.assertEqual(inst.setup.action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.setup.action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.setup.action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK) or 204(No Content).") self.assertEqual(inst.setup.action[1].assert_fhir.direction, "response") self.assertEqual(inst.setup.action[1].assert_fhir.operator, "in") self.assertEqual(inst.setup.action[1].assert_fhir.responseCode, "200,204") + self.assertFalse(inst.setup.action[1].assert_fhir.warningOnly) self.assertEqual(inst.setup.action[2].operation.accept, "json") self.assertEqual(inst.setup.action[2].operation.contentType, "json") self.assertEqual(inst.setup.action[2].operation.description, "Create patient resource on test server using the contents of fixture-patient-create") + self.assertTrue(inst.setup.action[2].operation.encodeRequestUrl) self.assertEqual(inst.setup.action[2].operation.label, "SetupCreatePatient") self.assertEqual(inst.setup.action[2].operation.params, "/${createResourceId}") self.assertEqual(inst.setup.action[2].operation.resource, "Patient") self.assertEqual(inst.setup.action[2].operation.sourceId, "fixture-patient-create") self.assertEqual(inst.setup.action[2].operation.type.code, "update") - self.assertEqual(inst.setup.action[2].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.setup.action[2].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.setup.action[3].assert_fhir.description, "Confirm that the returned HTTP status is 201(Created).") self.assertEqual(inst.setup.action[3].assert_fhir.direction, "response") self.assertEqual(inst.setup.action[3].assert_fhir.responseCode, "201") + self.assertFalse(inst.setup.action[3].assert_fhir.warningOnly) self.assertEqual(inst.setup.action[4].operation.description, "Read the created patient resource on the test server using the id from fixture-patient-create. Verify contents.") + self.assertTrue(inst.setup.action[4].operation.encodeRequestUrl) self.assertEqual(inst.setup.action[4].operation.resource, "Patient") self.assertEqual(inst.setup.action[4].operation.targetId, "fixture-patient-create") self.assertEqual(inst.setup.action[4].operation.type.code, "read") - self.assertEqual(inst.setup.action[4].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.setup.action[4].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.setup.action[5].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") self.assertEqual(inst.setup.action[5].assert_fhir.direction, "response") self.assertEqual(inst.setup.action[5].assert_fhir.response, "okay") + self.assertFalse(inst.setup.action[5].assert_fhir.warningOnly) self.assertEqual(inst.setup.action[6].assert_fhir.compareToSourceExpression, "Patient.name.first().family") self.assertEqual(inst.setup.action[6].assert_fhir.compareToSourceId, "fixture-patient-create") self.assertEqual(inst.setup.action[6].assert_fhir.description, "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit compareToSourceId reference to fixture-patient-create used to create the Patient.") self.assertEqual(inst.setup.action[6].assert_fhir.operator, "equals") + self.assertFalse(inst.setup.action[6].assert_fhir.warningOnly) self.assertEqual(inst.status, "draft") self.assertEqual(inst.teardown.action[0].operation.description, "Delete the patient resource on the test server using the id from fixture-patient-create.") + self.assertTrue(inst.teardown.action[0].operation.encodeRequestUrl) self.assertEqual(inst.teardown.action[0].operation.resource, "Patient") self.assertEqual(inst.teardown.action[0].operation.targetId, "fixture-patient-create") self.assertEqual(inst.teardown.action[0].operation.type.code, "delete") - self.assertEqual(inst.teardown.action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.teardown.action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[0].action[0].operation.description, "Read the patient resource on the test server using the id from fixture-patient-create. Prevent URL encoding of the request.") self.assertFalse(inst.test[0].action[0].operation.encodeRequestUrl) self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") self.assertEqual(inst.test[0].action[0].operation.responseId, "fixture-patient-read") self.assertEqual(inst.test[0].action[0].operation.targetId, "fixture-patient-create") self.assertEqual(inst.test[0].action[0].operation.type.code, "read") - self.assertEqual(inst.test[0].action[0].operation.type.system, "http://hl7.org/fhir/testscript-operation-codes") + self.assertEqual(inst.test[0].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") self.assertEqual(inst.test[0].action[1].assert_fhir.direction, "response") self.assertEqual(inst.test[0].action[1].assert_fhir.label, "01-ReadPatientOK") self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") - self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server may not support versioning.") + self.assertFalse(inst.test[0].action[1].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server might not support versioning.") self.assertEqual(inst.test[0].action[2].assert_fhir.direction, "response") self.assertEqual(inst.test[0].action[2].assert_fhir.headerField, "Last-Modified") self.assertEqual(inst.test[0].action[2].assert_fhir.operator, "notEmpty") self.assertTrue(inst.test[0].action[2].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned resource type is Patient.") self.assertEqual(inst.test[0].action[3].assert_fhir.resource, "Patient") + self.assertFalse(inst.test[0].action[3].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned Patient conforms to the base FHIR specification.") self.assertEqual(inst.test[0].action[4].assert_fhir.validateProfileId, "patient-profile") + self.assertFalse(inst.test[0].action[4].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[5].assert_fhir.description, "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit sourceId reference to read responseId fixture.") self.assertEqual(inst.test[0].action[5].assert_fhir.operator, "equals") self.assertEqual(inst.test[0].action[5].assert_fhir.path, "fhir:Patient/fhir:name/fhir:family/@value") self.assertEqual(inst.test[0].action[5].assert_fhir.sourceId, "fixture-patient-read") self.assertEqual(inst.test[0].action[5].assert_fhir.value, "Chalmers") + self.assertFalse(inst.test[0].action[5].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[6].assert_fhir.description, "Confirm that the returned Patient contains the expected given name 'Peter'. Uses explicit sourceId reference to read responseId fixture.") self.assertEqual(inst.test[0].action[6].assert_fhir.operator, "equals") self.assertEqual(inst.test[0].action[6].assert_fhir.path, "fhir:Patient/fhir:name/fhir:given/@value") self.assertEqual(inst.test[0].action[6].assert_fhir.sourceId, "fixture-patient-read") self.assertEqual(inst.test[0].action[6].assert_fhir.value, "Peter") + self.assertFalse(inst.test[0].action[6].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[7].assert_fhir.compareToSourceId, "fixture-patient-create") self.assertEqual(inst.test[0].action[7].assert_fhir.compareToSourcePath, "fhir:Patient/fhir:name/fhir:family/@value") self.assertEqual(inst.test[0].action[7].assert_fhir.operator, "equals") self.assertEqual(inst.test[0].action[7].assert_fhir.path, "fhir:Patient/fhir:name/fhir:family/@value") + self.assertFalse(inst.test[0].action[7].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[8].assert_fhir.compareToSourceId, "fixture-patient-create") self.assertEqual(inst.test[0].action[8].assert_fhir.compareToSourcePath, "fhir:Patient/fhir:name/fhir:given/@value") self.assertEqual(inst.test[0].action[8].assert_fhir.path, "fhir:Patient/fhir:name/fhir:given/@value") self.assertEqual(inst.test[0].action[8].assert_fhir.sourceId, "fixture-patient-read") + self.assertFalse(inst.test[0].action[8].assert_fhir.warningOnly) self.assertEqual(inst.test[0].action[9].assert_fhir.description, "Confirm that the returned resource contains the expected retained elements and values. Warning only to provide users with reviewable results.") self.assertEqual(inst.test[0].action[9].assert_fhir.minimumId, "fixture-patient-minimum") self.assertTrue(inst.test[0].action[9].assert_fhir.warningOnly) @@ -807,11 +655,120 @@ def implTestScript7(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example") self.assertEqual(inst.useContext[0].code.code, "focus") - self.assertEqual(inst.useContext[0].code.system, "http://hl7.org/fhir/usage-context-type") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].code, "positive") - self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://hl7.org/fhir/variant-state") + self.assertEqual(inst.useContext[0].valueCodeableConcept.coding[0].system, "http://terminology.hl7.org/CodeSystem/variant-state") self.assertEqual(inst.variable[0].name, "createResourceId") self.assertEqual(inst.variable[0].path, "Patient/id") self.assertEqual(inst.variable[0].sourceId, "fixture-patient-create") self.assertEqual(inst.version, "1.0") + + def testTestScript6(self): + inst = self.instantiate_from("testscript-example-readtest.json") + self.assertIsNotNone(inst, "Must have instantiated a TestScript instance") + self.implTestScript6(inst) + + js = inst.as_json() + self.assertEqual("TestScript", js["resourceType"]) + inst2 = testscript.TestScript(js) + self.implTestScript6(inst2) + + def implTestScript6(self, inst): + self.assertEqual(inst.contact[0].name, "Support") + self.assertEqual(inst.contact[0].telecom[0].system, "email") + self.assertEqual(inst.contact[0].telecom[0].use, "work") + self.assertEqual(inst.contact[0].telecom[0].value, "support@HL7.org") + self.assertEqual(inst.copyright, "© HL7.org 2011+") + self.assertEqual(inst.date.date, FHIRDate("2017-01-18").date) + self.assertEqual(inst.date.as_json(), "2017-01-18") + self.assertEqual(inst.description, "TestScript example resource with ported Sprinkler basic read tests R001, R002, R003, R004. The read tests will utilize user defined dynamic variables that will hold the Patient resource id values.") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "testscript-example-readtest") + self.assertEqual(inst.identifier.system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9879") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") + self.assertEqual(inst.jurisdiction[0].coding[0].display, "United States of America (the)") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.metadata.capability[0].capabilities, "CapabilityStatement/example") + self.assertEqual(inst.metadata.capability[0].description, "Patient Read Operation") + self.assertEqual(inst.metadata.capability[0].link[0], "http://hl7.org/fhir/http.html#read") + self.assertTrue(inst.metadata.capability[0].required) + self.assertFalse(inst.metadata.capability[0].validated) + self.assertEqual(inst.metadata.link[0].description, "Demographics and other administrative information about an individual or animal receiving care or other health-related services.") + self.assertEqual(inst.metadata.link[0].url, "http://hl7.org/fhir/patient.html") + self.assertEqual(inst.name, "TestScript Example Read Test") + self.assertEqual(inst.publisher, "HL7") + self.assertEqual(inst.purpose, "Patient Read Operation") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.test[0].action[0].operation.accept, "xml") + self.assertEqual(inst.test[0].action[0].operation.description, "Read the known Patient resource on the destination test system using the user defined dynamic variable ${KnownPatientResourceId}.") + self.assertTrue(inst.test[0].action[0].operation.encodeRequestUrl) + self.assertEqual(inst.test[0].action[0].operation.params, "/${KnownPatientResourceId}") + self.assertEqual(inst.test[0].action[0].operation.resource, "Patient") + self.assertEqual(inst.test[0].action[0].operation.type.code, "read") + self.assertEqual(inst.test[0].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") + self.assertEqual(inst.test[0].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 200(OK).") + self.assertEqual(inst.test[0].action[1].assert_fhir.response, "okay") + self.assertFalse(inst.test[0].action[1].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[2].assert_fhir.contentType, "xml") + self.assertEqual(inst.test[0].action[2].assert_fhir.description, "Confirm that the returned format is XML.") + self.assertFalse(inst.test[0].action[2].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[3].assert_fhir.description, "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server might not support versioning.") + self.assertEqual(inst.test[0].action[3].assert_fhir.headerField, "Last-Modified") + self.assertEqual(inst.test[0].action[3].assert_fhir.operator, "notEmpty") + self.assertTrue(inst.test[0].action[3].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[4].assert_fhir.description, "Confirm that the returned resource type is Patient.") + self.assertEqual(inst.test[0].action[4].assert_fhir.resource, "Patient") + self.assertFalse(inst.test[0].action[4].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].action[5].assert_fhir.description, "Confirm that the returned Patient conforms to the base FHIR specification.") + self.assertEqual(inst.test[0].action[5].assert_fhir.validateProfileId, "patient-profile") + self.assertFalse(inst.test[0].action[5].assert_fhir.warningOnly) + self.assertEqual(inst.test[0].description, "Read a known Patient and validate response.") + self.assertEqual(inst.test[0].id, "R001") + self.assertEqual(inst.test[0].name, "Sprinkler Read Test R001") + self.assertEqual(inst.test[1].action[0].operation.accept, "xml") + self.assertTrue(inst.test[1].action[0].operation.encodeRequestUrl) + self.assertEqual(inst.test[1].action[0].operation.params, "/1") + self.assertEqual(inst.test[1].action[0].operation.resource, "Patient") + self.assertEqual(inst.test[1].action[0].operation.type.code, "read") + self.assertEqual(inst.test[1].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") + self.assertEqual(inst.test[1].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 404(Not Found).") + self.assertEqual(inst.test[1].action[1].assert_fhir.response, "notFound") + self.assertFalse(inst.test[1].action[1].assert_fhir.warningOnly) + self.assertEqual(inst.test[1].description, "Read an unknown Resource Type and validate response.") + self.assertEqual(inst.test[1].id, "R002") + self.assertEqual(inst.test[1].name, "Sprinkler Read Test R002") + self.assertEqual(inst.test[2].action[0].operation.accept, "xml") + self.assertEqual(inst.test[2].action[0].operation.description, "Attempt to read the non-existing Patient resource on the destination test system using the user defined dynamic variable ${NonExistsPatientResourceId}.") + self.assertTrue(inst.test[2].action[0].operation.encodeRequestUrl) + self.assertEqual(inst.test[2].action[0].operation.params, "/${NonExistsPatientResourceId}") + self.assertEqual(inst.test[2].action[0].operation.resource, "Patient") + self.assertEqual(inst.test[2].action[0].operation.type.code, "read") + self.assertEqual(inst.test[2].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") + self.assertEqual(inst.test[2].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 404(Not Found).") + self.assertEqual(inst.test[2].action[1].assert_fhir.response, "notFound") + self.assertFalse(inst.test[2].action[1].assert_fhir.warningOnly) + self.assertEqual(inst.test[2].description, "Read a known, non-existing Patient and validate response.") + self.assertEqual(inst.test[2].id, "R003") + self.assertEqual(inst.test[2].name, "Sprinkler Read Test R003") + self.assertEqual(inst.test[3].action[0].operation.accept, "xml") + self.assertEqual(inst.test[3].action[0].operation.description, "Attempt to read a Patient resource on the destination test system using known bad formatted resource id.") + self.assertTrue(inst.test[3].action[0].operation.encodeRequestUrl) + self.assertEqual(inst.test[3].action[0].operation.params, "/ID-may-not-contain-CAPITALS") + self.assertEqual(inst.test[3].action[0].operation.resource, "Patient") + self.assertEqual(inst.test[3].action[0].operation.type.code, "read") + self.assertEqual(inst.test[3].action[0].operation.type.system, "http://terminology.hl7.org/CodeSystem/testscript-operation-codes") + self.assertEqual(inst.test[3].action[1].assert_fhir.description, "Confirm that the returned HTTP status is 400(Bad Request).") + self.assertEqual(inst.test[3].action[1].assert_fhir.response, "bad") + self.assertFalse(inst.test[3].action[1].assert_fhir.warningOnly) + self.assertEqual(inst.test[3].description, "Read a Patient using a known bad formatted resource id and validate response.") + self.assertEqual(inst.test[3].id, "R004") + self.assertEqual(inst.test[3].name, "Sprinkler Read Test R004") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/TestScript/testscript-example-readtest") + self.assertEqual(inst.variable[0].defaultValue, "example") + self.assertEqual(inst.variable[0].name, "KnownPatientResourceId") + self.assertEqual(inst.variable[1].defaultValue, "does-not-exist") + self.assertEqual(inst.variable[1].name, "NonExistsPatientResourceId") + self.assertEqual(inst.version, "1.0") diff --git a/fhirclient/models/timing.py b/fhirclient/models/timing.py index 051db4fca..9b10bc131 100644 --- a/fhirclient/models/timing.py +++ b/fhirclient/models/timing.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Timing) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Timing) on 2019-05-07. +# 2019, SMART Health IT. -from . import element +from . import backboneelement -class Timing(element.Element): +class Timing(backboneelement.BackboneElement): """ A timing schedule that specifies an event that may occur multiple times. Specifies an event that may occur multiple times. Timing schedules are used @@ -28,7 +28,7 @@ def __init__(self, jsondict=None, strict=True): """ self.code = None - """ BID | TID | QID | AM | PM | QD | QOD | Q4H | Q6H +. + """ BID | TID | QID | AM | PM | QD | QOD | +. Type `CodeableConcept` (represented as `dict` in JSON). """ self.event = None @@ -51,6 +51,8 @@ def elementProperties(self): return js +from . import element + class TimingRepeat(element.Element): """ When the event is to occur. @@ -132,7 +134,7 @@ def __init__(self, jsondict=None, strict=True): List of `FHIRDate` items (represented as `str` in JSON). """ self.when = None - """ Regular life events the event is tied to. + """ Code for time period of occurrence. List of `str` items. """ super(TimingRepeat, self).__init__(jsondict=jsondict, strict=strict) diff --git a/fhirclient/models/triggerdefinition.py b/fhirclient/models/triggerdefinition.py index f5529fda4..b3004606e 100644 --- a/fhirclient/models/triggerdefinition.py +++ b/fhirclient/models/triggerdefinition.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/TriggerDefinition) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/TriggerDefinition) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -10,7 +10,8 @@ class TriggerDefinition(element.Element): """ Defines an expected trigger for a module. - A description of a triggering event. + A description of a triggering event. Triggering events can be named events, + data events, or periodic, as determined by the type element. """ resource_type = "TriggerDefinition" @@ -23,33 +24,37 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ - self.eventData = None - """ Triggering data of the event. - Type `DataRequirement` (represented as `dict` in JSON). """ + self.condition = None + """ Whether the event triggers (boolean expression). + Type `Expression` (represented as `dict` in JSON). """ - self.eventName = None - """ Triggering event name. + self.data = None + """ Triggering data of the event (multiple = 'and'). + List of `DataRequirement` items (represented as `dict` in JSON). """ + + self.name = None + """ Name or URI that identifies the event. Type `str`. """ - self.eventTimingDate = None + self.timingDate = None """ Timing of the event. Type `FHIRDate` (represented as `str` in JSON). """ - self.eventTimingDateTime = None + self.timingDateTime = None """ Timing of the event. Type `FHIRDate` (represented as `str` in JSON). """ - self.eventTimingReference = None + self.timingReference = None """ Timing of the event. - Type `FHIRReference` referencing `Schedule` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ - self.eventTimingTiming = None + self.timingTiming = None """ Timing of the event. Type `Timing` (represented as `dict` in JSON). """ self.type = None - """ named-event | periodic | data-added | data-modified | data-removed - | data-accessed | data-access-ended. + """ named-event | periodic | data-changed | data-added | data-modified + | data-removed | data-accessed | data-access-ended. Type `str`. """ super(TriggerDefinition, self).__init__(jsondict=jsondict, strict=strict) @@ -57,12 +62,13 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(TriggerDefinition, self).elementProperties() js.extend([ - ("eventData", "eventData", datarequirement.DataRequirement, False, None, False), - ("eventName", "eventName", str, False, None, False), - ("eventTimingDate", "eventTimingDate", fhirdate.FHIRDate, False, "eventTiming", False), - ("eventTimingDateTime", "eventTimingDateTime", fhirdate.FHIRDate, False, "eventTiming", False), - ("eventTimingReference", "eventTimingReference", fhirreference.FHIRReference, False, "eventTiming", False), - ("eventTimingTiming", "eventTimingTiming", timing.Timing, False, "eventTiming", False), + ("condition", "condition", expression.Expression, False, None, False), + ("data", "data", datarequirement.DataRequirement, True, None, False), + ("name", "name", str, False, None, False), + ("timingDate", "timingDate", fhirdate.FHIRDate, False, "timing", False), + ("timingDateTime", "timingDateTime", fhirdate.FHIRDate, False, "timing", False), + ("timingReference", "timingReference", fhirreference.FHIRReference, False, "timing", False), + ("timingTiming", "timingTiming", timing.Timing, False, "timing", False), ("type", "type", str, False, None, True), ]) return js @@ -73,6 +79,10 @@ def elementProperties(self): from . import datarequirement except ImportError: datarequirement = sys.modules[__package__ + '.datarequirement'] +try: + from . import expression +except ImportError: + expression = sys.modules[__package__ + '.expression'] try: from . import fhirdate except ImportError: diff --git a/fhirclient/models/usagecontext.py b/fhirclient/models/usagecontext.py index 79e419fe2..24056aed8 100644 --- a/fhirclient/models/usagecontext.py +++ b/fhirclient/models/usagecontext.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/UsageContext) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/UsageContext) on 2019-05-07. +# 2019, SMART Health IT. from . import element @@ -10,7 +10,7 @@ class UsageContext(element.Element): """ Describes the context of use for a conformance or knowledge resource. - Specifies clinical/business/etc metadata that can be used to retrieve, + Specifies clinical/business/etc. metadata that can be used to retrieve, index and/or categorize an artifact. This metadata can either be specific to the applicable population (e.g., age category, DRG) or the specific context of care (e.g., venue, care setting, provider of care). @@ -42,6 +42,10 @@ def __init__(self, jsondict=None, strict=True): """ Value that defines the context. Type `Range` (represented as `dict` in JSON). """ + self.valueReference = None + """ Value that defines the context. + Type `FHIRReference` (represented as `dict` in JSON). """ + super(UsageContext, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): @@ -51,6 +55,7 @@ def elementProperties(self): ("valueCodeableConcept", "valueCodeableConcept", codeableconcept.CodeableConcept, False, "value", True), ("valueQuantity", "valueQuantity", quantity.Quantity, False, "value", True), ("valueRange", "valueRange", range.Range, False, "value", True), + ("valueReference", "valueReference", fhirreference.FHIRReference, False, "value", True), ]) return js @@ -64,6 +69,10 @@ def elementProperties(self): from . import coding except ImportError: coding = sys.modules[__package__ + '.coding'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import quantity except ImportError: diff --git a/fhirclient/models/valueset.py b/fhirclient/models/valueset.py index c02ae6f74..5465bdabd 100644 --- a/fhirclient/models/valueset.py +++ b/fhirclient/models/valueset.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,7 +10,10 @@ class ValueSet(domainresource.DomainResource): """ A set of codes drawn from one or more code systems. - A value set specifies a set of codes drawn from one or more code systems. + A ValueSet resource instance specifies a set of codes drawn from one or + more code systems, intended for use in a particular context. Value sets + link between [CodeSystem](codesystem.html) definitions and their use in + [coded elements](terminologies.html). """ resource_type = "ValueSet" @@ -24,7 +27,7 @@ def __init__(self, jsondict=None, strict=True): """ self.compose = None - """ Definition of the content of the value set (CLD). + """ Content logical definition of the value set (CLD). Type `ValueSetCompose` (represented as `dict` in JSON). """ self.contact = None @@ -36,7 +39,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.date = None - """ Date this was last changed. + """ Date last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None @@ -51,12 +54,8 @@ def __init__(self, jsondict=None, strict=True): """ For testing purposes, not real usage. Type `bool`. """ - self.extensible = None - """ Whether this is intended to be used with an extensible binding. - Type `bool`. """ - self.identifier = None - """ Additional identifier for the value set. + """ Additional identifier for the value set (business identifier). List of `Identifier` items (represented as `dict` in JSON). """ self.immutable = None @@ -89,11 +88,12 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.url = None - """ Logical URI to reference this value set (globally unique). + """ Canonical identifier for this value set, represented as a URI + (globally unique). Type `str`. """ self.useContext = None - """ Context the content is intended to support. + """ The context that the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.version = None @@ -112,7 +112,6 @@ def elementProperties(self): ("description", "description", str, False, None, False), ("expansion", "expansion", ValueSetExpansion, False, None, False), ("experimental", "experimental", bool, False, None, False), - ("extensible", "extensible", bool, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), ("immutable", "immutable", bool, False, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), @@ -131,11 +130,11 @@ def elementProperties(self): from . import backboneelement class ValueSetCompose(backboneelement.BackboneElement): - """ Definition of the content of the value set (CLD). + """ Content logical definition of the value set (CLD). - A set of criteria that define the content logical definition of the value - set by including or excluding codes from outside this value set. This I - also known as the "Content Logical Definition" (CLD). + A set of criteria that define the contents of the value set by including or + excluding codes selected from the specified code system(s) that the value + set draws from. This is also known as the Content Logical Definition (CLD). """ resource_type = "ValueSetCompose" @@ -161,7 +160,7 @@ def __init__(self, jsondict=None, strict=True): List of `ValueSetComposeInclude` items (represented as `dict` in JSON). """ self.lockedDate = None - """ Fixed date for version-less references (transitive). + """ Fixed date for references with no specified version (transitive). Type `FHIRDate` (represented as `str` in JSON). """ super(ValueSetCompose, self).__init__(jsondict=jsondict, strict=strict) @@ -204,7 +203,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.valueSet = None - """ Select only contents included in this value set. + """ Select the contents included in this value set. List of `str` items. """ self.version = None @@ -288,7 +287,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.use = None - """ Details how this designation would be used. + """ Types of uses of designations. Type `Coding` (represented as `dict` in JSON). """ self.value = None @@ -310,9 +309,9 @@ def elementProperties(self): class ValueSetComposeIncludeFilter(backboneelement.BackboneElement): """ Select codes/concepts by their properties (including relationships). - Select concepts by specify a matching criteria based on the properties - (including relationships) defined by the system. If multiple filters are - specified, they SHALL all be true. + Select concepts by specify a matching criterion based on the properties + (including relationships) defined by the system, or on filters defined by + the system. If multiple filters are specified, they SHALL all be true. """ resource_type = "ValueSetComposeIncludeFilter" @@ -331,7 +330,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.property = None - """ A property defined by the code system. + """ A property/filter defined by the code system. Type `str`. """ self.value = None @@ -374,7 +373,7 @@ def __init__(self, jsondict=None, strict=True): List of `ValueSetExpansionContains` items (represented as `dict` in JSON). """ self.identifier = None - """ Uniquely identifies this expansion. + """ Identifies the value set expansion (business identifier). Type `str`. """ self.offset = None @@ -399,7 +398,7 @@ def elementProperties(self): js = super(ValueSetExpansion, self).elementProperties() js.extend([ ("contains", "contains", ValueSetExpansionContains, True, None, False), - ("identifier", "identifier", str, False, None, True), + ("identifier", "identifier", str, False, None, False), ("offset", "offset", int, False, None, False), ("parameter", "parameter", ValueSetExpansionParameter, True, None, False), ("timestamp", "timestamp", fhirdate.FHIRDate, False, None, True), @@ -492,7 +491,7 @@ def __init__(self, jsondict=None, strict=True): """ self.name = None - """ Name as assigned by the server. + """ Name as assigned by the client or server. Type `str`. """ self.valueBoolean = None @@ -503,6 +502,10 @@ def __init__(self, jsondict=None, strict=True): """ Value of the named parameter. Type `str`. """ + self.valueDateTime = None + """ Value of the named parameter. + Type `FHIRDate` (represented as `str` in JSON). """ + self.valueDecimal = None """ Value of the named parameter. Type `float`. """ @@ -527,6 +530,7 @@ def elementProperties(self): ("name", "name", str, False, None, True), ("valueBoolean", "valueBoolean", bool, False, "value", False), ("valueCode", "valueCode", str, False, "value", False), + ("valueDateTime", "valueDateTime", fhirdate.FHIRDate, False, "value", False), ("valueDecimal", "valueDecimal", float, False, "value", False), ("valueInteger", "valueInteger", int, False, "value", False), ("valueString", "valueString", str, False, "value", False), diff --git a/fhirclient/models/valueset_tests.py b/fhirclient/models/valueset_tests.py index 1da56454f..385ad8979 100644 --- a/fhirclient/models/valueset_tests.py +++ b/fhirclient/models/valueset_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -22,7 +22,7 @@ def instantiate_from(self, filename): return valueset.ValueSet(js) def testValueSet1(self): - inst = self.instantiate_from("valueset-example-expansion.json") + inst = self.instantiate_from("valueset-example.json") self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") self.implValueSet1(inst) @@ -32,6 +32,196 @@ def testValueSet1(self): self.implValueSet1(inst2) def implValueSet1(self, inst): + self.assertTrue(inst.compose.inactive) + self.assertEqual(inst.compose.include[0].concept[0].code, "14647-2") + self.assertEqual(inst.compose.include[0].concept[0].display, "Cholesterol [Moles/Volume]") + self.assertEqual(inst.compose.include[0].concept[1].code, "2093-3") + self.assertEqual(inst.compose.include[0].concept[1].display, "Cholesterol [Mass/Volume]") + self.assertEqual(inst.compose.include[0].concept[2].code, "35200-5") + self.assertEqual(inst.compose.include[0].concept[2].display, "Cholesterol [Mass Or Moles/Volume]") + self.assertEqual(inst.compose.include[0].concept[3].code, "9342-7") + self.assertEqual(inst.compose.include[0].concept[3].display, "Cholesterol [Percentile]") + self.assertEqual(inst.compose.include[0].system, "http://loinc.org") + self.assertEqual(inst.compose.include[0].version, "2.36") + self.assertEqual(inst.compose.lockedDate.date, FHIRDate("2012-06-13").date) + self.assertEqual(inst.compose.lockedDate.as_json(), "2012-06-13") + self.assertEqual(inst.contact[0].name, "FHIR project team") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.copyright, "This content from LOINC ® is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use.") + self.assertEqual(inst.date.date, FHIRDate("2015-06-22").date) + self.assertEqual(inst.date.as_json(), "2015-06-22") + self.assertEqual(inst.description, "This is an example value set that includes all the LOINC codes for serum/plasma cholesterol from v2.36.") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-extensional") + self.assertEqual(inst.identifier[0].system, "http://acme.com/identifiers/valuesets") + self.assertEqual(inst.identifier[0].value, "loinc-cholesterol-int") + self.assertEqual(inst.jurisdiction[0].coding[0].code, "US") + self.assertEqual(inst.jurisdiction[0].coding[0].system, "urn:iso:std:iso:3166") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablevalueset") + self.assertEqual(inst.name, "LOINC Codes for Cholesterol in Serum/Plasma") + self.assertEqual(inst.publisher, "HL7 International") + self.assertEqual(inst.purpose, "This value set was published by ACME Inc in order to make clear which codes are used for Cholesterol by AcmeClinicals (Adult Ambulatory care support in USA)") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-extensional") + self.assertEqual(inst.useContext[0].code.code, "age") + self.assertEqual(inst.useContext[0].code.system, "http://terminology.hl7.org/CodeSystem/usage-context-type") + self.assertEqual(inst.useContext[0].valueQuantity.code, "a") + self.assertEqual(inst.useContext[0].valueQuantity.comparator, ">") + self.assertEqual(inst.useContext[0].valueQuantity.system, "http://unitsofmeasure.org") + self.assertEqual(inst.useContext[0].valueQuantity.unit, "yrs") + self.assertEqual(inst.useContext[0].valueQuantity.value, 18) + self.assertEqual(inst.version, "20150622") + + def testValueSet2(self): + inst = self.instantiate_from("valueset-example-hierarchical.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet2(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet2(inst2) + + def implValueSet2(self, inst): + self.assertEqual(inst.compose.include[0].concept[0].code, "invalid") + self.assertEqual(inst.compose.include[0].concept[1].code, "structure") + self.assertEqual(inst.compose.include[0].concept[2].code, "required") + self.assertEqual(inst.compose.include[0].concept[3].code, "value") + self.assertEqual(inst.compose.include[0].concept[4].code, "processing") + self.assertEqual(inst.compose.include[0].concept[5].code, "duplicate") + self.assertEqual(inst.compose.include[0].concept[6].code, "not-found") + self.assertEqual(inst.compose.include[0].concept[7].code, "conflict") + self.assertEqual(inst.compose.include[0].concept[8].code, "lock") + self.assertEqual(inst.compose.include[0].concept[9].code, "exception") + self.assertEqual(inst.compose.include[0].extension[0].url, "http://hl7.org/fhir/StructureDefinition/valueset-expand-rules") + self.assertEqual(inst.compose.include[0].extension[0].valueCode, "groups-only") + self.assertEqual(inst.compose.include[0].extension[1].extension[0].url, "display") + self.assertEqual(inst.compose.include[0].extension[1].extension[0].valueString, "(Most common)") + self.assertEqual(inst.compose.include[0].extension[1].extension[1].url, "member") + self.assertEqual(inst.compose.include[0].extension[1].extension[1].valueCode, "login") + self.assertEqual(inst.compose.include[0].extension[1].extension[2].url, "member") + self.assertEqual(inst.compose.include[0].extension[1].extension[2].valueCode, "conflict") + self.assertEqual(inst.compose.include[0].extension[1].url, "http://hl7.org/fhir/StructureDefinition/valueset-expand-group") + self.assertEqual(inst.compose.include[0].extension[2].extension[0].url, "code") + self.assertEqual(inst.compose.include[0].extension[2].extension[0].valueString, "processing") + self.assertEqual(inst.compose.include[0].extension[2].extension[1].url, "member") + self.assertEqual(inst.compose.include[0].extension[2].extension[1].valueCode, "duplicate") + self.assertEqual(inst.compose.include[0].extension[2].extension[2].url, "member") + self.assertEqual(inst.compose.include[0].extension[2].extension[2].valueCode, "not-found") + self.assertEqual(inst.compose.include[0].extension[2].url, "http://hl7.org/fhir/StructureDefinition/valueset-expand-group") + self.assertEqual(inst.compose.include[0].extension[3].extension[0].url, "code") + self.assertEqual(inst.compose.include[0].extension[3].extension[0].valueString, "invalid") + self.assertEqual(inst.compose.include[0].extension[3].extension[1].url, "member") + self.assertEqual(inst.compose.include[0].extension[3].extension[1].valueCode, "structure") + self.assertEqual(inst.compose.include[0].extension[3].extension[2].url, "member") + self.assertEqual(inst.compose.include[0].extension[3].extension[2].valueCode, "required") + self.assertEqual(inst.compose.include[0].extension[3].extension[3].url, "value") + self.assertEqual(inst.compose.include[0].extension[3].extension[3].valueCode, "required") + self.assertEqual(inst.compose.include[0].extension[3].url, "http://hl7.org/fhir/StructureDefinition/valueset-expand-group") + self.assertEqual(inst.compose.include[0].extension[4].extension[0].url, "code") + self.assertEqual(inst.compose.include[0].extension[4].extension[0].valueString, "transient") + self.assertEqual(inst.compose.include[0].extension[4].extension[1].url, "member") + self.assertEqual(inst.compose.include[0].extension[4].extension[1].valueCode, "lock") + self.assertEqual(inst.compose.include[0].extension[4].extension[2].url, "member") + self.assertEqual(inst.compose.include[0].extension[4].extension[2].valueCode, "exception") + self.assertEqual(inst.compose.include[0].extension[4].extension[3].url, "value") + self.assertEqual(inst.compose.include[0].extension[4].extension[3].valueCode, "throttled") + self.assertEqual(inst.compose.include[0].extension[4].url, "http://hl7.org/fhir/StructureDefinition/valueset-expand-group") + self.assertEqual(inst.compose.include[0].extension[5].extension[0].url, "code") + self.assertEqual(inst.compose.include[0].extension[5].extension[0].valueString, "security") + self.assertEqual(inst.compose.include[0].extension[5].extension[1].url, "member") + self.assertEqual(inst.compose.include[0].extension[5].extension[1].valueCode, "login") + self.assertEqual(inst.compose.include[0].extension[5].extension[2].url, "member") + self.assertEqual(inst.compose.include[0].extension[5].extension[2].valueCode, "unknown") + self.assertEqual(inst.compose.include[0].extension[5].url, "http://hl7.org/fhir/StructureDefinition/valueset-expand-group") + self.assertEqual(inst.compose.include[0].system, "#hacked") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.contained[0].id, "hacked") + self.assertEqual(inst.date.date, FHIRDate("2018-07-20").date) + self.assertEqual(inst.date.as_json(), "2018-07-20") + self.assertEqual(inst.description, "Demonstration of extensions that build a hierarchical contains") + self.assertTrue(inst.expansion.contains[0].abstract) + self.assertEqual(inst.expansion.contains[0].contains[0].code, "login") + self.assertEqual(inst.expansion.contains[0].contains[0].display, "Login Required") + self.assertEqual(inst.expansion.contains[0].contains[0].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[0].contains[1].code, "conflict") + self.assertEqual(inst.expansion.contains[0].contains[1].display, "Edit Version Conflict") + self.assertEqual(inst.expansion.contains[0].contains[1].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[0].display, "(Most common)") + self.assertEqual(inst.expansion.contains[1].code, "processing") + self.assertEqual(inst.expansion.contains[1].contains[0].code, "duplicate") + self.assertEqual(inst.expansion.contains[1].contains[0].display, "Duplicate") + self.assertEqual(inst.expansion.contains[1].contains[0].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[1].contains[1].code, "not-found") + self.assertEqual(inst.expansion.contains[1].contains[1].display, "Not Found") + self.assertEqual(inst.expansion.contains[1].contains[1].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[1].display, "Processing Failure") + self.assertEqual(inst.expansion.contains[1].system, "http://hl7.org/fhir/hacked") + self.assertTrue(inst.expansion.contains[2].abstract) + self.assertEqual(inst.expansion.contains[2].code, "invalid") + self.assertEqual(inst.expansion.contains[2].contains[0].code, "structure") + self.assertEqual(inst.expansion.contains[2].contains[0].display, "Structural Issue") + self.assertEqual(inst.expansion.contains[2].contains[0].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[2].contains[1].code, "required") + self.assertEqual(inst.expansion.contains[2].contains[1].display, "Required element missing") + self.assertEqual(inst.expansion.contains[2].contains[1].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[2].contains[2].code, "value") + self.assertEqual(inst.expansion.contains[2].contains[2].display, "Element value invalid") + self.assertEqual(inst.expansion.contains[2].contains[2].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[2].display, "Invalid Content") + self.assertEqual(inst.expansion.contains[2].system, "http://hl7.org/fhir/hacked") + self.assertTrue(inst.expansion.contains[3].abstract) + self.assertEqual(inst.expansion.contains[3].code, "transient") + self.assertEqual(inst.expansion.contains[3].contains[0].code, "lock-error") + self.assertEqual(inst.expansion.contains[3].contains[0].display, "Lock Error") + self.assertEqual(inst.expansion.contains[3].contains[0].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[3].contains[1].code, "exception") + self.assertEqual(inst.expansion.contains[3].contains[1].display, "Exception") + self.assertEqual(inst.expansion.contains[3].contains[1].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[3].contains[2].code, "throttled") + self.assertEqual(inst.expansion.contains[3].contains[2].display, "Throttled") + self.assertEqual(inst.expansion.contains[3].contains[2].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[3].display, "Transient Issue") + self.assertEqual(inst.expansion.contains[3].system, "http://hl7.org/fhir/hacked") + self.assertTrue(inst.expansion.contains[4].abstract) + self.assertEqual(inst.expansion.contains[4].code, "security") + self.assertEqual(inst.expansion.contains[4].contains[0].code, "login") + self.assertEqual(inst.expansion.contains[4].contains[0].display, "Login Required") + self.assertEqual(inst.expansion.contains[4].contains[0].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[4].contains[1].code, "unknown") + self.assertEqual(inst.expansion.contains[4].contains[1].display, "Unknown User") + self.assertEqual(inst.expansion.contains[4].contains[1].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.contains[4].display, "Security Problem") + self.assertEqual(inst.expansion.contains[4].system, "http://hl7.org/fhir/hacked") + self.assertEqual(inst.expansion.identifier, "urn:uuid:42316ff8-2714-4680-9980-f37a6d1a71bc") + self.assertEqual(inst.expansion.parameter[0].name, "excludeNotForUI") + self.assertEqual(inst.expansion.parameter[0].valueUri, "false") + self.assertEqual(inst.expansion.timestamp.date, FHIRDate("2018-07-20T23:14:07+10:00").date) + self.assertEqual(inst.expansion.timestamp.as_json(), "2018-07-20T23:14:07+10:00") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-hierarchical") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablevalueset") + self.assertEqual(inst.name, "Example Hierarchical ValueSet") + self.assertEqual(inst.publisher, "FHIR Project team") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-hierarchical") + self.assertEqual(inst.version, "4.0.0") + + def testValueSet3(self): + inst = self.instantiate_from("valueset-example-expansion.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet3(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet3(inst2) + + def implValueSet3(self, inst): self.assertEqual(inst.compose.include[0].filter[0].op, "=") self.assertEqual(inst.compose.include[0].filter[0].property, "parent") self.assertEqual(inst.compose.include[0].filter[0].value, "LP43571-6") @@ -97,39 +287,39 @@ def implValueSet1(self, inst): self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-expansion") self.assertEqual(inst.version, "20150622") - def testValueSet2(self): + def testValueSet4(self): inst = self.instantiate_from("valueset-example-inactive.json") self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet2(inst) + self.implValueSet4(inst) js = inst.as_json() self.assertEqual("ValueSet", js["resourceType"]) inst2 = valueset.ValueSet(js) - self.implValueSet2(inst2) + self.implValueSet4(inst2) - def implValueSet2(self, inst): + def implValueSet4(self, inst): self.assertTrue(inst.compose.inactive) self.assertEqual(inst.compose.include[0].filter[0].op, "descendent-of") self.assertEqual(inst.compose.include[0].filter[0].property, "concept") self.assertEqual(inst.compose.include[0].filter[0].value, "_ActMoodPredicate") - self.assertEqual(inst.compose.include[0].system, "http://hl7.org/fhir/v3/ActMood") - self.assertEqual(inst.description, "HL7 v3 ActMood Prdicate codes, including inactive codes") + self.assertEqual(inst.compose.include[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActMood") + self.assertEqual(inst.description, "HL7 v3 ActMood Predicate codes, including inactive codes") self.assertEqual(inst.expansion.contains[0].code, "CRT") self.assertEqual(inst.expansion.contains[0].display, "criterion") self.assertTrue(inst.expansion.contains[0].inactive) - self.assertEqual(inst.expansion.contains[0].system, "http://hl7.org/fhir/v3/ActMood") + self.assertEqual(inst.expansion.contains[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActMood") self.assertEqual(inst.expansion.contains[1].code, "EXPEC") self.assertEqual(inst.expansion.contains[1].contains[0].code, "GOL") self.assertEqual(inst.expansion.contains[1].contains[0].display, "goal") - self.assertEqual(inst.expansion.contains[1].contains[0].system, "http://hl7.org/fhir/v3/ActMood") + self.assertEqual(inst.expansion.contains[1].contains[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActMood") self.assertEqual(inst.expansion.contains[1].contains[1].code, "RSK") self.assertEqual(inst.expansion.contains[1].contains[1].display, "risk") - self.assertEqual(inst.expansion.contains[1].contains[1].system, "http://hl7.org/fhir/v3/ActMood") + self.assertEqual(inst.expansion.contains[1].contains[1].system, "http://terminology.hl7.org/CodeSystem/v3-ActMood") self.assertEqual(inst.expansion.contains[1].display, "expectation") - self.assertEqual(inst.expansion.contains[1].system, "http://hl7.org/fhir/v3/ActMood") + self.assertEqual(inst.expansion.contains[1].system, "http://terminology.hl7.org/CodeSystem/v3-ActMood") self.assertEqual(inst.expansion.contains[2].code, "OPT") self.assertEqual(inst.expansion.contains[2].display, "option") - self.assertEqual(inst.expansion.contains[2].system, "http://hl7.org/fhir/v3/ActMood") + self.assertEqual(inst.expansion.contains[2].system, "http://terminology.hl7.org/CodeSystem/v3-ActMood") self.assertEqual(inst.expansion.identifier, "urn:uuid:46c00b3f-003a-4f31-9d4b-ea2de58b2a99") self.assertEqual(inst.expansion.timestamp.date, FHIRDate("2017-02-26T10:00:00Z").date) self.assertEqual(inst.expansion.timestamp.as_json(), "2017-02-26T10:00:00Z") @@ -139,69 +329,64 @@ def implValueSet2(self, inst): self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.title, "Example with inactive codes") self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/inactive") + self.assertEqual(inst.version, "4.0.0") - def testValueSet3(self): - inst = self.instantiate_from("valueset-example-intensional.json") + def testValueSet5(self): + inst = self.instantiate_from("valueset-example-filter.json") self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet3(inst) + self.implValueSet5(inst) js = inst.as_json() self.assertEqual("ValueSet", js["resourceType"]) inst2 = valueset.ValueSet(js) - self.implValueSet3(inst2) + self.implValueSet5(inst2) - def implValueSet3(self, inst): - self.assertEqual(inst.compose.exclude[0].concept[0].code, "5932-9") - self.assertEqual(inst.compose.exclude[0].concept[0].display, "Cholesterol [Presence] in Blood by Test strip") - self.assertEqual(inst.compose.exclude[0].system, "http://loinc.org") + def implValueSet5(self, inst): self.assertEqual(inst.compose.include[0].filter[0].op, "=") - self.assertEqual(inst.compose.include[0].filter[0].property, "parent") - self.assertEqual(inst.compose.include[0].filter[0].value, "LP43571-6") - self.assertEqual(inst.compose.include[0].system, "http://loinc.org") + self.assertEqual(inst.compose.include[0].filter[0].property, "acme-plasma") + self.assertEqual(inst.compose.include[0].filter[0].value, "true") + self.assertEqual(inst.compose.include[0].system, "http://hl7.org/fhir/CodeSystem/example") self.assertEqual(inst.contact[0].name, "FHIR project team") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.copyright, "This content from LOINC® is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use") - self.assertEqual(inst.date.date, FHIRDate("2015-06-22").date) - self.assertEqual(inst.date.as_json(), "2015-06-22") - self.assertEqual(inst.description, "This is an example value set that includes all the LOINC codes for serum/plasma cholesterol from v2.36.") + self.assertEqual(inst.date.date, FHIRDate("2018-11-01").date) + self.assertEqual(inst.date.as_json(), "2018-11-01") + self.assertEqual(inst.description, "ACME Codes for Cholesterol: Plasma only - demonstrating the use of a filter defined in a CodeSystem") self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "example-intensional") - self.assertEqual(inst.identifier[0].system, "http://acme.com/identifiers/valuesets") - self.assertEqual(inst.identifier[0].value, "loinc-cholesterol-ext") - self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablevalueset") - self.assertEqual(inst.name, "LOINC Codes for Cholesterol in Serum/Plasma") + self.assertEqual(inst.id, "example-filter") + self.assertEqual(inst.name, "ACMECholCodesPlasma") self.assertEqual(inst.publisher, "HL7 International") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-intensional") - self.assertEqual(inst.version, "20150622") + self.assertEqual(inst.title, "ACME Codes for Cholesterol: Plasma only") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-filter") + self.assertEqual(inst.version, "4.0.0") - def testValueSet4(self): + def testValueSet6(self): inst = self.instantiate_from("valueset-example-yesnodontknow.json") self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet4(inst) + self.implValueSet6(inst) js = inst.as_json() self.assertEqual("ValueSet", js["resourceType"]) inst2 = valueset.ValueSet(js) - self.implValueSet4(inst2) + self.implValueSet6(inst2) - def implValueSet4(self, inst): - self.assertEqual(inst.compose.include[0].valueSet[0], "http://hl7.org/fhir/ValueSet/v2-0136") - self.assertEqual(inst.compose.include[1].concept[0].code, "asked") + def implValueSet6(self, inst): + self.assertEqual(inst.compose.include[0].valueSet[0], "http://terminology.hl7.org/ValueSet/v2-0136") + self.assertEqual(inst.compose.include[1].concept[0].code, "asked-unknown") self.assertEqual(inst.compose.include[1].concept[0].display, "Don't know") - self.assertEqual(inst.compose.include[1].system, "http://hl7.org/fhir/data-absent-reason") + self.assertEqual(inst.compose.include[1].system, "http://terminology.hl7.org/CodeSystem/data-absent-reason") self.assertEqual(inst.description, "For Capturing simple yes-no-don't know answers") self.assertEqual(inst.expansion.contains[0].code, "Y") self.assertEqual(inst.expansion.contains[0].display, "Yes") - self.assertEqual(inst.expansion.contains[0].system, "http://hl7.org/fhir/v2/0136") + self.assertEqual(inst.expansion.contains[0].system, "http://terminology.hl7.org/CodeSystem/v2-0136") self.assertEqual(inst.expansion.contains[1].code, "N") self.assertEqual(inst.expansion.contains[1].display, "No") - self.assertEqual(inst.expansion.contains[1].system, "http://hl7.org/fhir/v2/0136") - self.assertEqual(inst.expansion.contains[2].code, "asked") + self.assertEqual(inst.expansion.contains[1].system, "http://terminology.hl7.org/CodeSystem/v2-0136") + self.assertEqual(inst.expansion.contains[2].code, "asked-unknown") self.assertEqual(inst.expansion.contains[2].display, "Don't know") - self.assertEqual(inst.expansion.contains[2].system, "http://hl7.org/fhir/data-absent-reason") + self.assertEqual(inst.expansion.contains[2].system, "http://terminology.hl7.org/CodeSystem/data-absent-reason") self.assertEqual(inst.expansion.identifier, "urn:uuid:bf99fe50-2c2b-41ad-bd63-bee6919810b4") self.assertEqual(inst.expansion.timestamp.date, FHIRDate("2015-07-14T10:00:00Z").date) self.assertEqual(inst.expansion.timestamp.as_json(), "2015-07-14T10:00:00Z") @@ -210,85 +395,122 @@ def implValueSet4(self, inst): self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/yesnodontknow") + self.assertEqual(inst.version, "4.0.0") - def testValueSet5(self): - inst = self.instantiate_from("valueset-example.json") + def testValueSet7(self): + inst = self.instantiate_from("valueset-examplescenario-actor-type.json") self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet5(inst) + self.implValueSet7(inst) js = inst.as_json() self.assertEqual("ValueSet", js["resourceType"]) inst2 = valueset.ValueSet(js) - self.implValueSet5(inst2) + self.implValueSet7(inst2) - def implValueSet5(self, inst): - self.assertTrue(inst.compose.inactive) - self.assertEqual(inst.compose.include[0].concept[0].code, "14647-2") - self.assertEqual(inst.compose.include[0].concept[0].display, "Cholesterol [Moles/Volume]") - self.assertEqual(inst.compose.include[0].concept[1].code, "2093-3") - self.assertEqual(inst.compose.include[0].concept[1].display, "Cholesterol [Mass/Volume]") - self.assertEqual(inst.compose.include[0].concept[2].code, "35200-5") - self.assertEqual(inst.compose.include[0].concept[2].display, "Cholesterol [Mass Or Moles/Volume]") - self.assertEqual(inst.compose.include[0].concept[3].code, "9342-7") - self.assertEqual(inst.compose.include[0].concept[3].display, "Cholesterol [Percentile]") - self.assertEqual(inst.compose.include[0].system, "http://loinc.org") - self.assertEqual(inst.compose.include[0].version, "2.36") - self.assertEqual(inst.compose.lockedDate.date, FHIRDate("2012-06-13").date) - self.assertEqual(inst.compose.lockedDate.as_json(), "2012-06-13") - self.assertEqual(inst.contact[0].name, "FHIR project team") + def implValueSet7(self, inst): + self.assertEqual(inst.compose.include[0].system, "http://hl7.org/fhir/examplescenario-actor-type") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.copyright, "This content from LOINC ® is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use.") - self.assertEqual(inst.date.date, FHIRDate("2015-06-22").date) - self.assertEqual(inst.date.as_json(), "2015-06-22") - self.assertEqual(inst.description, "This is an example value set that includes all the LOINC codes for serum/plasma cholesterol from v2.36.") - self.assertTrue(inst.experimental) - self.assertEqual(inst.id, "example-extensional") - self.assertEqual(inst.identifier[0].system, "http://acme.com/identifiers/valuesets") - self.assertEqual(inst.identifier[0].value, "loinc-cholesterol-int") + self.assertEqual(inst.contact[0].telecom[1].system, "email") + self.assertEqual(inst.contact[0].telecom[1].value, "fhir@lists.hl7.org") + self.assertEqual(inst.date.date, FHIRDate("2018-12-27T22:37:54+11:00").date) + self.assertEqual(inst.date.as_json(), "2018-12-27T22:37:54+11:00") + self.assertEqual(inst.description, "The type of actor - system or human.") + self.assertFalse(inst.experimental) + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg") + self.assertEqual(inst.extension[0].valueCode, "fhir") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status") + self.assertEqual(inst.extension[1].valueCode, "trial-use") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm") + self.assertEqual(inst.extension[2].valueInteger, 0) + self.assertEqual(inst.id, "examplescenario-actor-type") + self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") + self.assertEqual(inst.identifier[0].value, "urn:oid:2.16.840.1.113883.4.642.3.858") + self.assertTrue(inst.immutable) + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2018-12-27T22:37:54.724+11:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2018-12-27T22:37:54.724+11:00") self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablevalueset") - self.assertEqual(inst.name, "LOINC Codes for Cholesterol in Serum/Plasma") - self.assertEqual(inst.publisher, "HL7 International") + self.assertEqual(inst.name, "ExampleScenarioActorType") + self.assertEqual(inst.publisher, "HL7 (FHIR Project)") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") - self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-extensional") - self.assertEqual(inst.version, "20150622") + self.assertEqual(inst.title, "ExampleScenarioActorType") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/examplescenario-actor-type") + self.assertEqual(inst.version, "4.0.0") - def testValueSet6(self): + def testValueSet8(self): inst = self.instantiate_from("valueset-list-example-codes.json") self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") - self.implValueSet6(inst) + self.implValueSet8(inst) js = inst.as_json() self.assertEqual("ValueSet", js["resourceType"]) inst2 = valueset.ValueSet(js) - self.implValueSet6(inst2) + self.implValueSet8(inst2) - def implValueSet6(self, inst): - self.assertEqual(inst.compose.include[0].system, "http://hl7.org/fhir/list-example-use-codes") + def implValueSet8(self, inst): + self.assertEqual(inst.compose.include[0].system, "http://terminology.hl7.org/CodeSystem/list-example-use-codes") self.assertEqual(inst.contact[0].telecom[0].system, "url") self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") - self.assertEqual(inst.date.date, FHIRDate("2017-03-21T21:41:32+00:00").date) - self.assertEqual(inst.date.as_json(), "2017-03-21T21:41:32+00:00") + self.assertEqual(inst.date.date, FHIRDate("2018-12-27T22:37:54+11:00").date) + self.assertEqual(inst.date.as_json(), "2018-12-27T22:37:54+11:00") self.assertEqual(inst.description, "Example use codes for the List resource - typical kinds of use.") - self.assertTrue(inst.experimental) - self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-ballot-status") - self.assertEqual(inst.extension[0].valueString, "Informative") - self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm") - self.assertEqual(inst.extension[1].valueInteger, 1) - self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg") - self.assertEqual(inst.extension[2].valueCode, "fhir") + self.assertFalse(inst.experimental) + self.assertEqual(inst.extension[0].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg") + self.assertEqual(inst.extension[0].valueCode, "fhir") + self.assertEqual(inst.extension[1].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status") + self.assertEqual(inst.extension[1].valueCode, "draft") + self.assertEqual(inst.extension[2].url, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm") + self.assertEqual(inst.extension[2].valueInteger, 1) self.assertEqual(inst.id, "list-example-codes") self.assertEqual(inst.identifier[0].system, "urn:ietf:rfc:3986") - self.assertEqual(inst.identifier[0].value, "urn:oid:2.16.840.1.113883.4.642.3.307") + self.assertEqual(inst.identifier[0].value, "urn:oid:2.16.840.1.113883.4.642.3.316") self.assertTrue(inst.immutable) - self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2017-03-21T21:41:32.180+00:00").date) - self.assertEqual(inst.meta.lastUpdated.as_json(), "2017-03-21T21:41:32.180+00:00") + self.assertEqual(inst.meta.lastUpdated.date, FHIRDate("2018-12-27T22:37:54.724+11:00").date) + self.assertEqual(inst.meta.lastUpdated.as_json(), "2018-12-27T22:37:54.724+11:00") self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablevalueset") - self.assertEqual(inst.name, "Example Use Codes for List") + self.assertEqual(inst.name, "ExampleUseCodesForList") self.assertEqual(inst.publisher, "FHIR Project") self.assertEqual(inst.status, "draft") self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.title, "Example Use Codes for List") self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/list-example-codes") - self.assertEqual(inst.version, "3.0.0") + self.assertEqual(inst.version, "4.0.0") + + def testValueSet9(self): + inst = self.instantiate_from("valueset-example-intensional.json") + self.assertIsNotNone(inst, "Must have instantiated a ValueSet instance") + self.implValueSet9(inst) + + js = inst.as_json() + self.assertEqual("ValueSet", js["resourceType"]) + inst2 = valueset.ValueSet(js) + self.implValueSet9(inst2) + + def implValueSet9(self, inst): + self.assertEqual(inst.compose.exclude[0].concept[0].code, "5932-9") + self.assertEqual(inst.compose.exclude[0].concept[0].display, "Cholesterol [Presence] in Blood by Test strip") + self.assertEqual(inst.compose.exclude[0].system, "http://loinc.org") + self.assertEqual(inst.compose.include[0].filter[0].op, "=") + self.assertEqual(inst.compose.include[0].filter[0].property, "parent") + self.assertEqual(inst.compose.include[0].filter[0].value, "LP43571-6") + self.assertEqual(inst.compose.include[0].system, "http://loinc.org") + self.assertEqual(inst.contact[0].name, "FHIR project team") + self.assertEqual(inst.contact[0].telecom[0].system, "url") + self.assertEqual(inst.contact[0].telecom[0].value, "http://hl7.org/fhir") + self.assertEqual(inst.copyright, "This content from LOINC® is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use") + self.assertEqual(inst.date.date, FHIRDate("2015-06-22").date) + self.assertEqual(inst.date.as_json(), "2015-06-22") + self.assertEqual(inst.description, "This is an example value set that includes all the LOINC codes for serum/plasma cholesterol from v2.36.") + self.assertTrue(inst.experimental) + self.assertEqual(inst.id, "example-intensional") + self.assertEqual(inst.identifier[0].system, "http://acme.com/identifiers/valuesets") + self.assertEqual(inst.identifier[0].value, "loinc-cholesterol-ext") + self.assertEqual(inst.meta.profile[0], "http://hl7.org/fhir/StructureDefinition/shareablevalueset") + self.assertEqual(inst.name, "LOINC Codes for Cholesterol in Serum/Plasma") + self.assertEqual(inst.publisher, "HL7 International") + self.assertEqual(inst.status, "draft") + self.assertEqual(inst.text.status, "generated") + self.assertEqual(inst.url, "http://hl7.org/fhir/ValueSet/example-intensional") + self.assertEqual(inst.version, "20150622") diff --git a/fhirclient/models/verificationresult.py b/fhirclient/models/verificationresult.py new file mode 100644 index 000000000..6231f5508 --- /dev/null +++ b/fhirclient/models/verificationresult.py @@ -0,0 +1,295 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/VerificationResult) on 2019-05-07. +# 2019, SMART Health IT. + + +from . import domainresource + +class VerificationResult(domainresource.DomainResource): + """ Describes validation requirements, source(s), status and dates for one or + more elements. + """ + + resource_type = "VerificationResult" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.attestation = None + """ Information about the entity attesting to information. + Type `VerificationResultAttestation` (represented as `dict` in JSON). """ + + self.failureAction = None + """ fatal | warn | rec-only | none. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.frequency = None + """ Frequency of revalidation. + Type `Timing` (represented as `dict` in JSON). """ + + self.lastPerformed = None + """ The date/time validation was last completed (including failed + validations). + Type `FHIRDate` (represented as `str` in JSON). """ + + self.need = None + """ none | initial | periodic. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.nextScheduled = None + """ The date when target is next validated, if appropriate. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.primarySource = None + """ Information about the primary source(s) involved in validation. + List of `VerificationResultPrimarySource` items (represented as `dict` in JSON). """ + + self.status = None + """ attested | validated | in-process | req-revalid | val-fail | reval- + fail. + Type `str`. """ + + self.statusDate = None + """ When the validation status was updated. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.target = None + """ A resource that was validated. + List of `FHIRReference` items (represented as `dict` in JSON). """ + + self.targetLocation = None + """ The fhirpath location(s) within the resource that was validated. + List of `str` items. """ + + self.validationProcess = None + """ The primary process by which the target is validated (edit check; + value set; primary source; multiple sources; standalone; in + context). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.validationType = None + """ nothing | primary | multiple. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.validator = None + """ Information about the entity validating information. + List of `VerificationResultValidator` items (represented as `dict` in JSON). """ + + super(VerificationResult, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VerificationResult, self).elementProperties() + js.extend([ + ("attestation", "attestation", VerificationResultAttestation, False, None, False), + ("failureAction", "failureAction", codeableconcept.CodeableConcept, False, None, False), + ("frequency", "frequency", timing.Timing, False, None, False), + ("lastPerformed", "lastPerformed", fhirdate.FHIRDate, False, None, False), + ("need", "need", codeableconcept.CodeableConcept, False, None, False), + ("nextScheduled", "nextScheduled", fhirdate.FHIRDate, False, None, False), + ("primarySource", "primarySource", VerificationResultPrimarySource, True, None, False), + ("status", "status", str, False, None, True), + ("statusDate", "statusDate", fhirdate.FHIRDate, False, None, False), + ("target", "target", fhirreference.FHIRReference, True, None, False), + ("targetLocation", "targetLocation", str, True, None, False), + ("validationProcess", "validationProcess", codeableconcept.CodeableConcept, True, None, False), + ("validationType", "validationType", codeableconcept.CodeableConcept, False, None, False), + ("validator", "validator", VerificationResultValidator, True, None, False), + ]) + return js + + +from . import backboneelement + +class VerificationResultAttestation(backboneelement.BackboneElement): + """ Information about the entity attesting to information. + """ + + resource_type = "VerificationResultAttestation" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.communicationMethod = None + """ The method by which attested information was submitted/retrieved. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.date = None + """ The date the information was attested to. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.onBehalfOf = None + """ When the who is asserting on behalf of another (organization or + individual). + Type `FHIRReference` (represented as `dict` in JSON). """ + + self.proxyIdentityCertificate = None + """ A digital identity certificate associated with the proxy entity + submitting attested information on behalf of the attestation source. + Type `str`. """ + + self.proxySignature = None + """ Proxy signature. + Type `Signature` (represented as `dict` in JSON). """ + + self.sourceIdentityCertificate = None + """ A digital identity certificate associated with the attestation + source. + Type `str`. """ + + self.sourceSignature = None + """ Attester signature. + Type `Signature` (represented as `dict` in JSON). """ + + self.who = None + """ The individual or organization attesting to information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(VerificationResultAttestation, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VerificationResultAttestation, self).elementProperties() + js.extend([ + ("communicationMethod", "communicationMethod", codeableconcept.CodeableConcept, False, None, False), + ("date", "date", fhirdate.FHIRDate, False, None, False), + ("onBehalfOf", "onBehalfOf", fhirreference.FHIRReference, False, None, False), + ("proxyIdentityCertificate", "proxyIdentityCertificate", str, False, None, False), + ("proxySignature", "proxySignature", signature.Signature, False, None, False), + ("sourceIdentityCertificate", "sourceIdentityCertificate", str, False, None, False), + ("sourceSignature", "sourceSignature", signature.Signature, False, None, False), + ("who", "who", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class VerificationResultPrimarySource(backboneelement.BackboneElement): + """ Information about the primary source(s) involved in validation. + """ + + resource_type = "VerificationResultPrimarySource" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.canPushUpdates = None + """ yes | no | undetermined. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.communicationMethod = None + """ Method for exchanging information with the primary source. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.pushTypeAvailable = None + """ specific | any | source. + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.type = None + """ Type of primary source (License Board; Primary Education; + Continuing Education; Postal Service; Relationship owner; + Registration Authority; legal source; issuing source; authoritative + source). + List of `CodeableConcept` items (represented as `dict` in JSON). """ + + self.validationDate = None + """ When the target was validated against the primary source. + Type `FHIRDate` (represented as `str` in JSON). """ + + self.validationStatus = None + """ successful | failed | unknown. + Type `CodeableConcept` (represented as `dict` in JSON). """ + + self.who = None + """ Reference to the primary source. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(VerificationResultPrimarySource, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VerificationResultPrimarySource, self).elementProperties() + js.extend([ + ("canPushUpdates", "canPushUpdates", codeableconcept.CodeableConcept, False, None, False), + ("communicationMethod", "communicationMethod", codeableconcept.CodeableConcept, True, None, False), + ("pushTypeAvailable", "pushTypeAvailable", codeableconcept.CodeableConcept, True, None, False), + ("type", "type", codeableconcept.CodeableConcept, True, None, False), + ("validationDate", "validationDate", fhirdate.FHIRDate, False, None, False), + ("validationStatus", "validationStatus", codeableconcept.CodeableConcept, False, None, False), + ("who", "who", fhirreference.FHIRReference, False, None, False), + ]) + return js + + +class VerificationResultValidator(backboneelement.BackboneElement): + """ Information about the entity validating information. + """ + + resource_type = "VerificationResultValidator" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.attestationSignature = None + """ Validator signature. + Type `Signature` (represented as `dict` in JSON). """ + + self.identityCertificate = None + """ A digital identity certificate associated with the validator. + Type `str`. """ + + self.organization = None + """ Reference to the organization validating information. + Type `FHIRReference` (represented as `dict` in JSON). """ + + super(VerificationResultValidator, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VerificationResultValidator, self).elementProperties() + js.extend([ + ("attestationSignature", "attestationSignature", signature.Signature, False, None, False), + ("identityCertificate", "identityCertificate", str, False, None, False), + ("organization", "organization", fhirreference.FHIRReference, False, None, True), + ]) + return js + + +import sys +try: + from . import codeableconcept +except ImportError: + codeableconcept = sys.modules[__package__ + '.codeableconcept'] +try: + from . import fhirdate +except ImportError: + fhirdate = sys.modules[__package__ + '.fhirdate'] +try: + from . import fhirreference +except ImportError: + fhirreference = sys.modules[__package__ + '.fhirreference'] +try: + from . import signature +except ImportError: + signature = sys.modules[__package__ + '.signature'] +try: + from . import timing +except ImportError: + timing = sys.modules[__package__ + '.timing'] diff --git a/fhirclient/models/verificationresult_tests.py b/fhirclient/models/verificationresult_tests.py new file mode 100644 index 000000000..4e96e66dd --- /dev/null +++ b/fhirclient/models/verificationresult_tests.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. + + +import os +import io +import unittest +import json +from . import verificationresult +from .fhirdate import FHIRDate + + +class VerificationResultTests(unittest.TestCase): + def instantiate_from(self, filename): + datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or '' + with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: + js = json.load(handle) + self.assertEqual("VerificationResult", js["resourceType"]) + return verificationresult.VerificationResult(js) + + def testVerificationResult1(self): + inst = self.instantiate_from("verificationresult-example.json") + self.assertIsNotNone(inst, "Must have instantiated a VerificationResult instance") + self.implVerificationResult1(inst) + + js = inst.as_json() + self.assertEqual("VerificationResult", js["resourceType"]) + inst2 = verificationresult.VerificationResult(js) + self.implVerificationResult1(inst2) + + def implVerificationResult1(self, inst): + self.assertEqual(inst.id, "example") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") + self.assertEqual(inst.status, "attested") + self.assertEqual(inst.text.div, "

Generated Narrative with Details

id: example

status: attested

") + self.assertEqual(inst.text.status, "generated") + diff --git a/fhirclient/models/visionprescription.py b/fhirclient/models/visionprescription.py index 99014da8b..e94052e81 100644 --- a/fhirclient/models/visionprescription.py +++ b/fhirclient/models/visionprescription.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2019-05-07. +# 2019, SMART Health IT. from . import domainresource @@ -10,7 +10,7 @@ class VisionPrescription(domainresource.DomainResource): """ Prescription for vision correction products for a patient. - An authorization for the supply of glasses and/or contact lenses to a + An authorization for the provision of glasses and/or contact lenses to a patient. """ @@ -24,37 +24,33 @@ def __init__(self, jsondict=None, strict=True): :param bool strict: If True (the default), invalid variables will raise a TypeError """ + self.created = None + """ Response creation date. + Type `FHIRDate` (represented as `str` in JSON). """ + self.dateWritten = None """ When prescription was authorized. Type `FHIRDate` (represented as `str` in JSON). """ - self.dispense = None - """ Vision supply authorization. - List of `VisionPrescriptionDispense` items (represented as `dict` in JSON). """ - self.encounter = None """ Created during encounter / admission / stay. - Type `FHIRReference` referencing `Encounter` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.identifier = None - """ Business identifier. + """ Business Identifier for vision prescription. List of `Identifier` items (represented as `dict` in JSON). """ + self.lensSpecification = None + """ Vision lens authorization. + List of `VisionPrescriptionLensSpecification` items (represented as `dict` in JSON). """ + self.patient = None """ Who prescription is for. - Type `FHIRReference` referencing `Patient` (represented as `dict` in JSON). """ + Type `FHIRReference` (represented as `dict` in JSON). """ self.prescriber = None - """ Who authorizes the vision product. - Type `FHIRReference` referencing `Practitioner` (represented as `dict` in JSON). """ - - self.reasonCodeableConcept = None - """ Reason or indication for writing the prescription. - Type `CodeableConcept` (represented as `dict` in JSON). """ - - self.reasonReference = None - """ Reason or indication for writing the prescription. - Type `FHIRReference` referencing `Condition` (represented as `dict` in JSON). """ + """ Who authorized the vision prescription. + Type `FHIRReference` (represented as `dict` in JSON). """ self.status = None """ active | cancelled | draft | entered-in-error. @@ -65,28 +61,28 @@ def __init__(self, jsondict=None, strict=True): def elementProperties(self): js = super(VisionPrescription, self).elementProperties() js.extend([ - ("dateWritten", "dateWritten", fhirdate.FHIRDate, False, None, False), - ("dispense", "dispense", VisionPrescriptionDispense, True, None, False), + ("created", "created", fhirdate.FHIRDate, False, None, True), + ("dateWritten", "dateWritten", fhirdate.FHIRDate, False, None, True), ("encounter", "encounter", fhirreference.FHIRReference, False, None, False), ("identifier", "identifier", identifier.Identifier, True, None, False), - ("patient", "patient", fhirreference.FHIRReference, False, None, False), - ("prescriber", "prescriber", fhirreference.FHIRReference, False, None, False), - ("reasonCodeableConcept", "reasonCodeableConcept", codeableconcept.CodeableConcept, False, "reason", False), - ("reasonReference", "reasonReference", fhirreference.FHIRReference, False, "reason", False), - ("status", "status", str, False, None, False), + ("lensSpecification", "lensSpecification", VisionPrescriptionLensSpecification, True, None, True), + ("patient", "patient", fhirreference.FHIRReference, False, None, True), + ("prescriber", "prescriber", fhirreference.FHIRReference, False, None, True), + ("status", "status", str, False, None, True), ]) return js from . import backboneelement -class VisionPrescriptionDispense(backboneelement.BackboneElement): - """ Vision supply authorization. +class VisionPrescriptionLensSpecification(backboneelement.BackboneElement): + """ Vision lens authorization. - Deals with details of the dispense part of the supply specification. + Contain the details of the individual lens specifications and serves as + the authorization for the fullfillment by certified professionals. """ - resource_type = "VisionPrescriptionDispense" + resource_type = "VisionPrescriptionLensSpecification" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. @@ -97,21 +93,17 @@ def __init__(self, jsondict=None, strict=True): """ self.add = None - """ Lens add. + """ Added power for multifocal levels. Type `float`. """ self.axis = None - """ Lens axis. + """ Lens meridian which contain no power for astigmatism. Type `int`. """ self.backCurve = None """ Contact lens back curvature. Type `float`. """ - self.base = None - """ up | down | in | out. - Type `str`. """ - self.brand = None """ Brand required. Type `str`. """ @@ -121,7 +113,7 @@ def __init__(self, jsondict=None, strict=True): Type `str`. """ self.cylinder = None - """ Lens cylinder. + """ Lens power for astigmatism. Type `float`. """ self.diameter = None @@ -145,41 +137,75 @@ def __init__(self, jsondict=None, strict=True): Type `float`. """ self.prism = None - """ Lens prism. - Type `float`. """ + """ Eye alignment compensation. + List of `VisionPrescriptionLensSpecificationPrism` items (represented as `dict` in JSON). """ self.product = None """ Product to be supplied. Type `CodeableConcept` (represented as `dict` in JSON). """ self.sphere = None - """ Lens sphere. + """ Power of the lens. Type `float`. """ - super(VisionPrescriptionDispense, self).__init__(jsondict=jsondict, strict=strict) + super(VisionPrescriptionLensSpecification, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): - js = super(VisionPrescriptionDispense, self).elementProperties() + js = super(VisionPrescriptionLensSpecification, self).elementProperties() js.extend([ ("add", "add", float, False, None, False), ("axis", "axis", int, False, None, False), ("backCurve", "backCurve", float, False, None, False), - ("base", "base", str, False, None, False), ("brand", "brand", str, False, None, False), ("color", "color", str, False, None, False), ("cylinder", "cylinder", float, False, None, False), ("diameter", "diameter", float, False, None, False), ("duration", "duration", quantity.Quantity, False, None, False), - ("eye", "eye", str, False, None, False), + ("eye", "eye", str, False, None, True), ("note", "note", annotation.Annotation, True, None, False), ("power", "power", float, False, None, False), - ("prism", "prism", float, False, None, False), - ("product", "product", codeableconcept.CodeableConcept, False, None, False), + ("prism", "prism", VisionPrescriptionLensSpecificationPrism, True, None, False), + ("product", "product", codeableconcept.CodeableConcept, False, None, True), ("sphere", "sphere", float, False, None, False), ]) return js +class VisionPrescriptionLensSpecificationPrism(backboneelement.BackboneElement): + """ Eye alignment compensation. + + Allows for adjustment on two axis. + """ + + resource_type = "VisionPrescriptionLensSpecificationPrism" + + def __init__(self, jsondict=None, strict=True): + """ Initialize all valid properties. + + :raises: FHIRValidationError on validation errors, unless strict is False + :param dict jsondict: A JSON dictionary to use for initialization + :param bool strict: If True (the default), invalid variables will raise a TypeError + """ + + self.amount = None + """ Amount of adjustment. + Type `float`. """ + + self.base = None + """ up | down | in | out. + Type `str`. """ + + super(VisionPrescriptionLensSpecificationPrism, self).__init__(jsondict=jsondict, strict=strict) + + def elementProperties(self): + js = super(VisionPrescriptionLensSpecificationPrism, self).elementProperties() + js.extend([ + ("amount", "amount", float, False, None, True), + ("base", "base", str, False, None, True), + ]) + return js + + import sys try: from . import annotation diff --git a/fhirclient/models/visionprescription_tests.py b/fhirclient/models/visionprescription_tests.py index fc559cf9f..01a2d0a9d 100644 --- a/fhirclient/models/visionprescription_tests.py +++ b/fhirclient/models/visionprescription_tests.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Generated from FHIR 3.0.0.11832 on 2017-03-22. -# 2017, SMART Health IT. +# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. +# 2019, SMART Health IT. import os @@ -32,45 +32,48 @@ def testVisionPrescription1(self): self.implVisionPrescription1(inst2) def implVisionPrescription1(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-06-15").date) + self.assertEqual(inst.created.as_json(), "2014-06-15") self.assertEqual(inst.dateWritten.date, FHIRDate("2014-06-15").date) self.assertEqual(inst.dateWritten.as_json(), "2014-06-15") - self.assertEqual(inst.dispense[0].add, 1.75) - self.assertEqual(inst.dispense[0].axis, 160) - self.assertEqual(inst.dispense[0].backCurve, 8.7) - self.assertEqual(inst.dispense[0].brand, "OphthaGuard") - self.assertEqual(inst.dispense[0].color, "green") - self.assertEqual(inst.dispense[0].cylinder, -2.25) - self.assertEqual(inst.dispense[0].diameter, 14.0) - self.assertEqual(inst.dispense[0].duration.code, "month") - self.assertEqual(inst.dispense[0].duration.system, "http://unitsofmeasure.org") - self.assertEqual(inst.dispense[0].duration.unit, "month") - self.assertEqual(inst.dispense[0].duration.value, 1) - self.assertEqual(inst.dispense[0].eye, "right") - self.assertEqual(inst.dispense[0].note[0].text, "Shade treatment for extreme light sensitivity") - self.assertEqual(inst.dispense[0].power, -2.75) - self.assertEqual(inst.dispense[0].product.coding[0].code, "contact") - self.assertEqual(inst.dispense[0].product.coding[0].system, "http://hl7.org/fhir/ex-visionprescriptionproduct") - self.assertEqual(inst.dispense[1].add, 1.75) - self.assertEqual(inst.dispense[1].axis, 160) - self.assertEqual(inst.dispense[1].backCurve, 8.7) - self.assertEqual(inst.dispense[1].brand, "OphthaGuard") - self.assertEqual(inst.dispense[1].color, "green") - self.assertEqual(inst.dispense[1].cylinder, -3.5) - self.assertEqual(inst.dispense[1].diameter, 14.0) - self.assertEqual(inst.dispense[1].duration.code, "month") - self.assertEqual(inst.dispense[1].duration.system, "http://unitsofmeasure.org") - self.assertEqual(inst.dispense[1].duration.unit, "month") - self.assertEqual(inst.dispense[1].duration.value, 1) - self.assertEqual(inst.dispense[1].eye, "left") - self.assertEqual(inst.dispense[1].note[0].text, "Shade treatment for extreme light sensitivity") - self.assertEqual(inst.dispense[1].power, -2.75) - self.assertEqual(inst.dispense[1].product.coding[0].code, "contact") - self.assertEqual(inst.dispense[1].product.coding[0].system, "http://hl7.org/fhir/ex-visionprescriptionproduct") self.assertEqual(inst.id, "33124") self.assertEqual(inst.identifier[0].system, "http://www.happysight.com/prescription") self.assertEqual(inst.identifier[0].value, "15014") - self.assertEqual(inst.reasonCodeableConcept.coding[0].code, "myopia") - self.assertEqual(inst.reasonCodeableConcept.coding[0].system, "http://samplevisionreasoncodes.com") + self.assertEqual(inst.lensSpecification[0].add, 1.75) + self.assertEqual(inst.lensSpecification[0].axis, 160) + self.assertEqual(inst.lensSpecification[0].backCurve, 8.7) + self.assertEqual(inst.lensSpecification[0].brand, "OphthaGuard") + self.assertEqual(inst.lensSpecification[0].color, "green") + self.assertEqual(inst.lensSpecification[0].cylinder, -2.25) + self.assertEqual(inst.lensSpecification[0].diameter, 14.0) + self.assertEqual(inst.lensSpecification[0].duration.code, "month") + self.assertEqual(inst.lensSpecification[0].duration.system, "http://unitsofmeasure.org") + self.assertEqual(inst.lensSpecification[0].duration.unit, "month") + self.assertEqual(inst.lensSpecification[0].duration.value, 1) + self.assertEqual(inst.lensSpecification[0].eye, "right") + self.assertEqual(inst.lensSpecification[0].note[0].text, "Shade treatment for extreme light sensitivity") + self.assertEqual(inst.lensSpecification[0].power, -2.75) + self.assertEqual(inst.lensSpecification[0].product.coding[0].code, "contact") + self.assertEqual(inst.lensSpecification[0].product.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-visionprescriptionproduct") + self.assertEqual(inst.lensSpecification[1].add, 1.75) + self.assertEqual(inst.lensSpecification[1].axis, 160) + self.assertEqual(inst.lensSpecification[1].backCurve, 8.7) + self.assertEqual(inst.lensSpecification[1].brand, "OphthaGuard") + self.assertEqual(inst.lensSpecification[1].color, "green") + self.assertEqual(inst.lensSpecification[1].cylinder, -3.5) + self.assertEqual(inst.lensSpecification[1].diameter, 14.0) + self.assertEqual(inst.lensSpecification[1].duration.code, "month") + self.assertEqual(inst.lensSpecification[1].duration.system, "http://unitsofmeasure.org") + self.assertEqual(inst.lensSpecification[1].duration.unit, "month") + self.assertEqual(inst.lensSpecification[1].duration.value, 1) + self.assertEqual(inst.lensSpecification[1].eye, "left") + self.assertEqual(inst.lensSpecification[1].note[0].text, "Shade treatment for extreme light sensitivity") + self.assertEqual(inst.lensSpecification[1].power, -2.75) + self.assertEqual(inst.lensSpecification[1].product.coding[0].code, "contact") + self.assertEqual(inst.lensSpecification[1].product.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-visionprescriptionproduct") + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.div, "
Sample Contract Lens prescription
") self.assertEqual(inst.text.status, "generated") @@ -86,27 +89,32 @@ def testVisionPrescription2(self): self.implVisionPrescription2(inst2) def implVisionPrescription2(self, inst): + self.assertEqual(inst.created.date, FHIRDate("2014-06-15").date) + self.assertEqual(inst.created.as_json(), "2014-06-15") self.assertEqual(inst.dateWritten.date, FHIRDate("2014-06-15").date) self.assertEqual(inst.dateWritten.as_json(), "2014-06-15") - self.assertEqual(inst.dispense[0].add, 2.0) - self.assertEqual(inst.dispense[0].base, "down") - self.assertEqual(inst.dispense[0].eye, "right") - self.assertEqual(inst.dispense[0].prism, 0.5) - self.assertEqual(inst.dispense[0].product.coding[0].code, "lens") - self.assertEqual(inst.dispense[0].product.coding[0].system, "http://hl7.org/fhir/ex-visionprescriptionproduct") - self.assertEqual(inst.dispense[0].sphere, -2.0) - self.assertEqual(inst.dispense[1].add, 2.0) - self.assertEqual(inst.dispense[1].axis, 180) - self.assertEqual(inst.dispense[1].base, "up") - self.assertEqual(inst.dispense[1].cylinder, -0.5) - self.assertEqual(inst.dispense[1].eye, "left") - self.assertEqual(inst.dispense[1].prism, 0.5) - self.assertEqual(inst.dispense[1].product.coding[0].code, "lens") - self.assertEqual(inst.dispense[1].product.coding[0].system, "http://hl7.org/fhir/ex-visionprescriptionproduct") - self.assertEqual(inst.dispense[1].sphere, -1.0) self.assertEqual(inst.id, "33123") self.assertEqual(inst.identifier[0].system, "http://www.happysight.com/prescription") self.assertEqual(inst.identifier[0].value, "15013") + self.assertEqual(inst.lensSpecification[0].add, 2.0) + self.assertEqual(inst.lensSpecification[0].eye, "right") + self.assertEqual(inst.lensSpecification[0].prism[0].amount, 0.5) + self.assertEqual(inst.lensSpecification[0].prism[0].base, "down") + self.assertEqual(inst.lensSpecification[0].product.coding[0].code, "lens") + self.assertEqual(inst.lensSpecification[0].product.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-visionprescriptionproduct") + self.assertEqual(inst.lensSpecification[0].sphere, -2.0) + self.assertEqual(inst.lensSpecification[1].add, 2.0) + self.assertEqual(inst.lensSpecification[1].axis, 180) + self.assertEqual(inst.lensSpecification[1].cylinder, -0.5) + self.assertEqual(inst.lensSpecification[1].eye, "left") + self.assertEqual(inst.lensSpecification[1].prism[0].amount, 0.5) + self.assertEqual(inst.lensSpecification[1].prism[0].base, "up") + self.assertEqual(inst.lensSpecification[1].product.coding[0].code, "lens") + self.assertEqual(inst.lensSpecification[1].product.coding[0].system, "http://terminology.hl7.org/CodeSystem/ex-visionprescriptionproduct") + self.assertEqual(inst.lensSpecification[1].sphere, -1.0) + self.assertEqual(inst.meta.tag[0].code, "HTEST") + self.assertEqual(inst.meta.tag[0].display, "test health data") + self.assertEqual(inst.meta.tag[0].system, "http://terminology.hl7.org/CodeSystem/v3-ActReason") self.assertEqual(inst.status, "active") self.assertEqual(inst.text.status, "generated") diff --git a/fhirclient/server_tests.py b/fhirclient/server_tests.py old mode 100644 new mode 100755 index f2a43feca..22ce2ebdf --- a/fhirclient/server_tests.py +++ b/fhirclient/server_tests.py @@ -42,14 +42,13 @@ def testInvalidCapabilityStatement(self): mock.get_capability() self.assertTrue(False, "Must have thrown exception") except fabst.FHIRValidationError as e: - self.assertTrue(4 == len(e.errors)) + self.assertEqual(4, len(e.errors)) self.assertEqual("date:", str(e.errors[0])[:5]) self.assertEqual("format:", str(e.errors[1])[:7]) self.assertEqual("rest.0:", str(e.errors[2])[:7]) self.assertEqual("operation.1:", str(e.errors[2].errors[0])[:12]) self.assertEqual("definition:", str(e.errors[2].errors[0].errors[0])[:11]) - self.assertEqual("reference:", str(e.errors[2].errors[0].errors[0].errors[0])[:10]) - self.assertEqual("Wrong type ", str(e.errors[2].errors[0].errors[0].errors[0].errors[0])[:25]) + self.assertEqual("Wrong type ", str(e.errors[2].errors[0].errors[0].errors[0])[:25]) self.assertEqual("security:", str(e.errors[2].errors[1])[:9]) self.assertEqual("service.0:", str(e.errors[2].errors[1].errors[0])[:10]) self.assertEqual("coding.0:", str(e.errors[2].errors[1].errors[0].errors[0])[:9]) diff --git a/fhirclient/test_bundle.json b/fhirclient/test_bundle.json old mode 100644 new mode 100755 index d525c2bfc..67c99010a --- a/fhirclient/test_bundle.json +++ b/fhirclient/test_bundle.json @@ -44,8 +44,7 @@ "reference": "Patient/23" }, "code": {}, - "status": "active", - "comment": "Observation 123, referencing subject relatively" + "status": "active" } }, { @@ -57,8 +56,7 @@ "reference": "urn:uuid:04121321-4af5-424c-a0e1-ed3aab1c349d" }, "code": {}, - "status": "active", - "comment": "Observation 56, referencing subject via UUID" + "status": "active" } }, { @@ -70,8 +68,7 @@ "reference": "https://fhir.smarthealthit.org/dev/Patient/99" }, "code": {}, - "status": "active", - "comment": "Observation 34 with absolute subject reference to different endpoint" + "status": "active" } } ] diff --git a/fhirclient/test_contained_resource.json b/fhirclient/test_contained_resource.json old mode 100644 new mode 100755 index e3c06338c..642170ad5 --- a/fhirclient/test_contained_resource.json +++ b/fhirclient/test_contained_resource.json @@ -142,9 +142,13 @@ "type": "choice", "required": false, "repeats": false, - "options": { - "reference": "#vs2" - }, + "answerOption": [ + { + "valueReference": { + "reference": "#vs2" + } + } + ], "item": [ { "extension": [ diff --git a/fhirclient/test_metadata_invalid.json b/fhirclient/test_metadata_invalid.json old mode 100644 new mode 100755 index 8a1f09845..b7fdebc9c --- a/fhirclient/test_metadata_invalid.json +++ b/fhirclient/test_metadata_invalid.json @@ -1,5 +1,4 @@ { - "acceptUnknown": "no", "date": ["2014-10-29T11:42:32.193-00:00"], "description": "Describes capabilities of this SMART on FHIR server", "fhirVersion": "0.0.82", @@ -20,14 +19,12 @@ "operation": [ { "name": "transaction", - "definition": { - "reference": "#op-trans" - } + "definition": "https://fhir.org/OperationDefinition/made-up-1" }, { "name": "history-system", "definition": { - "reference": {"key": "#op-hist"} + "key": "#op-hist" } } ], diff --git a/fhirclient/test_metadata_valid.json b/fhirclient/test_metadata_valid.json old mode 100644 new mode 100755 index e79ec4d86..7cd529e64 --- a/fhirclient/test_metadata_valid.json +++ b/fhirclient/test_metadata_valid.json @@ -1,5 +1,4 @@ { - "acceptUnknown": "no", "date": "2014-10-29T11:42:32.193-00:00", "description": "Describes capabilities of this SMART on FHIR server", "fhirVersion": "0.0.82", @@ -19,15 +18,11 @@ "operation": [ { "name": "transaction", - "definition": { - "reference": "#op-trans" - } + "definition": "https://fhir.org/OperationDefinition/made-up-1" }, { "name": "history-system", - "definition": { - "reference": "#op-hist" - } + "definition": "https://fhir.org/OperationDefinition/made-up-2" } ], "resource": [], diff --git a/fhirclient/test_relative_reference.json b/fhirclient/test_relative_reference.json old mode 100644 new mode 100755 index 7f0d4aafa..f353c6e12 --- a/fhirclient/test_relative_reference.json +++ b/fhirclient/test_relative_reference.json @@ -31,9 +31,13 @@ "type": "choice", "required": false, "repeats": false, - "options": { - "reference": "ValueSet/vs2r" - }, + "answerOption": [ + { + "valueReference": { + "reference": "ValueSet/vs2r" + } + } + ], "item": [ { "linkId": "Observation.subject._Patient",